Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdirectfbcursor.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
7
9
11 : m_screen(screen)
12{
13#ifndef QT_NO_CURSOR
14 m_image.reset(new QPlatformCursorImage(0, 0, 0, 0, 0, 0));
15#endif
16}
17
18#ifndef QT_NO_CURSOR
19void QDirectFBCursor::changeCursor(QCursor *cursor, QWindow *)
20{
21 int xSpot;
22 int ySpot;
23 QPixmap map;
24
25 const Qt::CursorShape newShape = cursor ? cursor->shape() : Qt::ArrowCursor;
26 if (newShape != Qt::BitmapCursor) {
27 m_image->set(newShape);
28 xSpot = m_image->hotspot().x();
29 ySpot = m_image->hotspot().y();
30 QImage *i = m_image->image();
31 map = QPixmap::fromImage(*i);
32 } else {
33 QPoint point = cursor->hotSpot();
34 xSpot = point.x();
35 ySpot = point.y();
36 map = cursor->pixmap();
37 }
38
39 DFBResult res;
40 IDirectFBDisplayLayer *layer = toDfbLayer(m_screen);
41 IDirectFBSurface* surface(QDirectFbConvenience::dfbSurfaceForPlatformPixmap(map.handle()));
42
43 res = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
44 if (res != DFB_OK) {
45 DirectFBError("Failed to set DLSCL_ADMINISTRATIVE", res);
46 return;
47 }
48
49 layer->SetCursorShape(layer, surface, xSpot, ySpot);
50 layer->SetCooperativeLevel(layer, DLSCL_SHARED);
51}
52#endif
53
54QT_END_NAMESPACE
void changeCursor(QCursor *cursor, QWindow *window) override
This method is called by Qt whenever the cursor graphic should be changed.
The QPlatformScreen class provides an abstraction for visual displays.
Combined button and popup list for selecting options.