qfbcursor.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/platformsupport/fbconvenience/qfbcursor.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4bool QFbCursorDeviceListener::hasMouse() const-
5{-
6 return
never executed: return QGuiApplicationPrivate::inputDeviceManager()->deviceCount(QInputDeviceManager::DeviceTypePointer) > 0;
QGuiApplicationPrivate::inputDeviceManager()->deviceCount(QInputDeviceManager::DeviceTypePointer) > 0;
never executed: return QGuiApplicationPrivate::inputDeviceManager()->deviceCount(QInputDeviceManager::DeviceTypePointer) > 0;
0
7}-
8-
9void QFbCursorDeviceListener::onDeviceListChanged(QInputDeviceManager::DeviceType type)-
10{-
11 if (type == QInputDeviceManager::DeviceTypePointer
type == QInput...iceTypePointerDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
12 m_cursor->updateMouseStatus();
never executed: m_cursor->updateMouseStatus();
0
13}
never executed: end of block
0
14-
15QFbCursor::QFbCursor(QFbScreen *screen)-
16 : mVisible(true),-
17 mScreen(screen),-
18 mDirty(false),-
19 mOnScreen(false),-
20 mGraphic(0),-
21 mDeviceListener(0)-
22{-
23 QByteArray hideCursorVal = qgetenv("QT_QPA_FB_HIDECURSOR");-
24 if (!hideCursorVal.isEmpty()
!hideCursorVal.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
25 mVisible = hideCursorVal.toInt() == 0;
never executed: mVisible = hideCursorVal.toInt() == 0;
0
26 if (!mVisible
!mVisibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
27 return;
never executed: return;
0
28-
29 mGraphic = new QPlatformCursorImage(0, 0, 0, 0, 0, 0);-
30 setCursor(Qt::ArrowCursor);-
31-
32 mDeviceListener = new QFbCursorDeviceListener(this);-
33 connect(QGuiApplicationPrivate::inputDeviceManager(), &QInputDeviceManager::deviceListChanged,-
34 mDeviceListener, &QFbCursorDeviceListener::onDeviceListChanged);-
35 updateMouseStatus();-
36}
never executed: end of block
0
37-
38QFbCursor::~QFbCursor()-
39{-
40 delete mDeviceListener;-
41}
never executed: end of block
0
42-
43QRect QFbCursor::getCurrentRect()-
44{-
45 QRect rect = mGraphic->image()->rect().translated(-mGraphic->hotspot().x(),-
46 -mGraphic->hotspot().y());-
47 rect.translate(m_pos);-
48 QPoint mScreenOffset = mScreen->geometry().topLeft();-
49 rect.translate(-mScreenOffset);-
50 return
never executed: return rect;
rect;
never executed: return rect;
0
51}-
52-
53QPoint QFbCursor::pos() const-
54{-
55 return
never executed: return m_pos;
m_pos;
never executed: return m_pos;
0
56}-
57-
58void QFbCursor::setPos(const QPoint &pos)-
59{-
60 QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);-
61 m_pos = pos;-
62 mCurrentRect = getCurrentRect();-
63 if (mOnScreen
mOnScreenDescription
TRUEnever evaluated
FALSEnever evaluated
|| mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft()))
mScreen->geome...().topLeft()))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
64 setDirty();
never executed: setDirty();
0
65}
never executed: end of block
0
66-
67void QFbCursor::pointerEvent(const QMouseEvent &e)-
68{-
69 if (e.type() != QEvent::MouseMove
e.type() != QEvent::MouseMoveDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
70 return;
never executed: return;
0
71 m_pos = e.screenPos().toPoint();-
72 mCurrentRect = getCurrentRect();-
73 if (mOnScreen
mOnScreenDescription
TRUEnever evaluated
FALSEnever evaluated
|| mScreen->geometry().intersects(mCurrentRect.translated(mScreen->geometry().topLeft()))
mScreen->geome...().topLeft()))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
74 setDirty();
never executed: setDirty();
0
75}
never executed: end of block
0
76-
77QRect QFbCursor::drawCursor(QPainter & painter)-
78{-
79 if (!mVisible
!mVisibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
80 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
81-
82 mDirty = false;-
83 if (mCurrentRect.isNull()
mCurrentRect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
84 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
85-
86-
87 QPoint mScreenOffset = mScreen->geometry().topLeft();-
88-
89 if (!mCurrentRect.translated(mScreenOffset).intersects(mScreen->geometry())
!mCurrentRect....n->geometry())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
90 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
91-
92 mPrevRect = mCurrentRect;-
93 painter.drawImage(mPrevRect, *mGraphic->image());-
94 mOnScreen = true;-
95 return
never executed: return mPrevRect;
mPrevRect;
never executed: return mPrevRect;
0
96}-
97-
98QRect QFbCursor::dirtyRect()-
99{-
100 if (mOnScreen
mOnScreenDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
101 mOnScreen = false;-
102 return
never executed: return mPrevRect;
mPrevRect;
never executed: return mPrevRect;
0
103 }-
104 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
105}-
106-
107void QFbCursor::setCursor(Qt::CursorShape shape)-
108{-
109 mGraphic->set(shape);-
110}
never executed: end of block
0
111-
112void QFbCursor::setCursor(const QImage &image, int hotx, int hoty)-
113{-
114 mGraphic->set(image, hotx, hoty);-
115}
never executed: end of block
0
116-
117void QFbCursor::setCursor(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)-
118{-
119 mGraphic->set(data, mask, width, height, hotX, hotY);-
120}
never executed: end of block
0
121-
122-
123void QFbCursor::changeCursor(QCursor * widgetCursor, QWindow *window)-
124{-
125 (void)window;;-
126 const Qt::CursorShape shape = widgetCursor
widgetCursorDescription
TRUEnever evaluated
FALSEnever evaluated
? widgetCursor->shape() : Qt::ArrowCursor;
0
127-
128 if (shape == Qt::BitmapCursor
shape == Qt::BitmapCursorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
129-
130 QPoint spot = widgetCursor->hotSpot();-
131 setCursor(widgetCursor->pixmap().toImage(), spot.x(), spot.y());-
132 }
never executed: end of block
else {
0
133-
134 setCursor(shape);-
135 }
never executed: end of block
0
136 mCurrentRect = getCurrentRect();-
137 QPoint mScreenOffset = mScreen->geometry().topLeft();-
138 if (mOnScreen
mOnScreenDescription
TRUEnever evaluated
FALSEnever evaluated
|| mScreen->geometry().intersects(mCurrentRect.translated(mScreenOffset))
mScreen->geome...ScreenOffset))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
139 setDirty();
never executed: setDirty();
0
140}
never executed: end of block
0
141-
142-
143void QFbCursor::setDirty()-
144{-
145 if (!mVisible
!mVisibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
146 return;
never executed: return;
0
147-
148 if (!mDirty
!mDirtyDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
149 mDirty = true;-
150 mScreen->scheduleUpdate();-
151 }
never executed: end of block
0
152}
never executed: end of block
0
153-
154void QFbCursor::updateMouseStatus()-
155{-
156 mVisible = mDeviceListener->hasMouse();-
157 mScreen->setDirty(mVisible ? getCurrentRect() : lastPainted());-
158}
never executed: end of block
0
159-
160-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9