Qt 4.8
qplatformcursor_qpa.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtOpenVG module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #include "qplatformcursor_qpa.h"
42 
43 #include <QWidget>
44 #include <QPainter>
45 #include <QBitmap>
46 #include <QApplication>
47 
48 #include <QDebug>
49 
51 
53 
107  : screen(scr)
108 {
110 }
111 
112 extern int qt_last_x;
113 extern int qt_last_y;
114 
116 {
117  // As a fallback return the last mouse position seen by QApplication.
118  return QPoint(qt_last_x, qt_last_y);
119 }
120 
122 {
123  Q_UNUSED(pos);
124  qWarning("This plugin does not support QCursor::setPos()");
125 }
126 
127 // End of display and pointer event handling code
128 // Beginning of built-in cursor graphics
129 // from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp
130 
145 static bool systemCursorTableInit = false;
146 
147 // 16 x 16
148 static const uchar cur_arrow_bits[] = {
149  0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08,
150  0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22,
151  0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 };
152 static const uchar mcur_arrow_bits[] = {
153  0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f,
154  0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e,
155  0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 };
156 
157 static const unsigned char cur_up_arrow_bits[] = {
158  0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04,
159  0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
160  0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01};
161 static const unsigned char mcur_up_arrow_bits[] = {
162  0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07,
163  0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
164  0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01};
165 
166 static const unsigned char cur_cross_bits[] = {
167  0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
168  0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
169  0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00};
170 static const unsigned char mcur_cross_bits[] = {
171  0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
172  0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
173  0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00};
174 
175 static const uchar cur_ibeam_bits[] = {
176  0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
177  0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
178  0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 };
179 static const uchar mcur_ibeam_bits[] = {
180  0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
181  0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
182  0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 };
183 
184 static const uchar cur_ver_bits[] = {
185  0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,
186  0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f,
187  0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 };
188 static const uchar mcur_ver_bits[] = {
189  0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f,
190  0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f,
191  0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 };
192 
193 static const uchar cur_hor_bits[] = {
194  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18,
195  0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08,
196  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
197 static const uchar mcur_hor_bits[] = {
198  0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c,
199  0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c,
200  0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 };
201 static const uchar cur_bdiag_bits[] = {
202  0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e,
203  0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00,
204  0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
205 static const uchar mcur_bdiag_bits[] = {
206  0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f,
207  0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01,
208  0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 };
209 static const uchar cur_fdiag_bits[] = {
210  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00,
211  0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c,
212  0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 };
213 static const uchar mcur_fdiag_bits[] = {
214  0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00,
215  0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e,
216  0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 };
217 
218 // 20 x 20
219 static const uchar forbidden_bits[] = {
220  0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01,
221  0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06,
222  0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03,
223  0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 };
224 
225 static const uchar forbiddenm_bits[] = {
226  0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03,
227  0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f,
228  0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07,
229  0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00};
230 
231 // 32 x 32
232 static const uchar wait_data_bits[] = {
233  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
234  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00,
235  0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00,
236  0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00,
237  0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00,
238  0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00,
239  0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00,
240  0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00,
241  0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
242  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
243  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
244 static const uchar wait_mask_bits[] = {
245  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
246  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00,
247  0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
248  0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
249  0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00,
250  0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00,
251  0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
252  0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00,
253  0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
254  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
255  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
256 
257 static const uchar hsplit_bits[] = {
258  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
259  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
260  0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
261  0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
262  0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03,
263  0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00,
264  0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
265  0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
266  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
267  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
268  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
269 static const uchar hsplitm_bits[] = {
270  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
271  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
272  0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
273  0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00,
274  0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07,
275  0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00,
276  0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
277  0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
278  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
279  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
280  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
281 static const uchar vsplit_bits[] = {
282  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
283  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
284  0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,
285  0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
286  0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
287  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
288  0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
289  0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,
290  0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
291  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
292  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
293 static const uchar vsplitm_bits[] = {
294  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
295  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
296  0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,
297  0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
298  0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
299  0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
300  0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
301  0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00,
302  0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00,
303  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
304  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
305 static const uchar phand_bits[] = {
306  0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
307  0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00,
308  0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00,
309  0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00,
310  0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
311  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
312  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
313  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
314  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
315  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
316  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
317 static const uchar phandm_bits[] = {
318  0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
319  0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00,
320  0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00,
321  0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00,
322  0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
323  0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
324  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
325  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
326  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
327  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
328  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
329 
330 static const uchar size_all_data_bits[] = {
331  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
332  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
333  0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,
334  0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
335  0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00,
336  0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00,
337  0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
338  0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00,
339  0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
342 static const uchar size_all_mask_bits[] = {
343  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
345  0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,
346  0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00,
347  0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01,
348  0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00,
349  0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00,
350  0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00,
351  0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
352  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
353  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
354 
355 static const uchar whatsthis_bits[] = {
356  0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00,
357  0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00,
358  0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00,
359  0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00,
360  0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00,
361  0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00,
362  0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
363  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
364  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
366  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
367 static const uchar whatsthism_bits[] = {
368  0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00,
369  0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00,
370  0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00,
371  0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00,
372  0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00,
373  0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00,
374  0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
375  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
376  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
377  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
378  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
379 
380 static const uchar busy_bits[] = {
381  0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
382  0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
383  0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00,
384  0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00,
385  0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00,
386  0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00,
387  0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00,
388  0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
389  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
390  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
391  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
392 static const uchar busym_bits[] = {
393  0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
394  0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
395  0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00,
396  0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00,
397  0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00,
398  0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00,
399  0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00,
400  0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
401  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
402  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
403  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
404 
405 // 16 x 16
406 static const uchar openhand_bits[] = {
407  0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92,
408  0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20,
409  0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00};
410 static const uchar openhandm_bits[] = {
411  0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff,
412  0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f,
413  0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00};
414 static const uchar closedhand_bits[] = {
415  0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50,
416  0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10,
417  0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00};
418 static const uchar closedhandm_bits[] = {
419  0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f,
420  0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f,
421  0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00};
422 
424 {
425  if (!systemCursorTableInit) {
426  for (int i = 0; i <= Qt::LastCursor; i++)
427  systemCursorTable[i] = 0;
428  systemCursorTableInit = true;
429  }
430  switch (id) {
431  // 16x16 cursors
432  case Qt::ArrowCursor:
433  systemCursorTable[Qt::ArrowCursor] =
435  break;
436 
437  case Qt::UpArrowCursor:
438  systemCursorTable[Qt::UpArrowCursor] =
440  break;
441 
442  case Qt::CrossCursor:
443  systemCursorTable[Qt::CrossCursor] =
445  break;
446 
447  case Qt::IBeamCursor:
448  systemCursorTable[Qt::IBeamCursor] =
450  break;
451 
452  case Qt::SizeVerCursor:
453  systemCursorTable[Qt::SizeVerCursor] =
454  new QPlatformCursorImage(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7);
455  break;
456 
457  case Qt::SizeHorCursor:
458  systemCursorTable[Qt::SizeHorCursor] =
459  new QPlatformCursorImage(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7);
460  break;
461 
462  case Qt::SizeBDiagCursor:
463  systemCursorTable[Qt::SizeBDiagCursor] =
465  break;
466 
467  case Qt::SizeFDiagCursor:
468  systemCursorTable[Qt::SizeFDiagCursor] =
470  break;
471 
472  case Qt::BlankCursor:
473  systemCursorTable[Qt::BlankCursor] =
474  new QPlatformCursorImage(0, 0, 0, 0, 0, 0);
475  break;
476 
477  // 20x20 cursors
478  case Qt::ForbiddenCursor:
479  systemCursorTable[Qt::ForbiddenCursor] =
481  break;
482 
483  // 32x32 cursors
484  case Qt::WaitCursor:
485  systemCursorTable[Qt::WaitCursor] =
486  new QPlatformCursorImage(wait_data_bits, wait_mask_bits, 32, 32, 15, 15);
487  break;
488 
489  case Qt::SplitVCursor:
490  systemCursorTable[Qt::SplitVCursor] =
491  new QPlatformCursorImage(vsplit_bits, vsplitm_bits, 32, 32, 15, 15);
492  break;
493 
494  case Qt::SplitHCursor:
495  systemCursorTable[Qt::SplitHCursor] =
496  new QPlatformCursorImage(hsplit_bits, hsplitm_bits, 32, 32, 15, 15);
497  break;
498 
499  case Qt::SizeAllCursor:
500  systemCursorTable[Qt::SizeAllCursor] =
502  break;
503 
505  systemCursorTable[Qt::PointingHandCursor] =
506  new QPlatformCursorImage(phand_bits, phandm_bits, 32, 32, 0, 0);
507  break;
508 
509  case Qt::WhatsThisCursor:
510  systemCursorTable[Qt::WhatsThisCursor] =
512  break;
513  case Qt::BusyCursor:
514  systemCursorTable[Qt::BusyCursor] =
515  new QPlatformCursorImage(busy_bits, busym_bits, 32, 32, 0, 0);
516  break;
517 
518  case Qt::OpenHandCursor:
519  systemCursorTable[Qt::OpenHandCursor] =
521  break;
523  systemCursorTable[Qt::ClosedHandCursor] =
525  break;
526  default:
527  qWarning("Unknown system cursor %d", id);
528  }
529 }
530 
546 {
547  QPlatformCursorImage *cursor = 0;
548  if (id >= 0 && id <= Qt::LastCursor) {
549  if (!systemCursorTable[id])
550  createSystemCursor(id);
551  cursor = systemCursorTable[id];
552  }
553 
554  if (cursor == 0) {
555  if (!systemCursorTable[Qt::ArrowCursor])
556  createSystemCursor(Qt::ArrowCursor);
557  cursor = systemCursorTable[Qt::ArrowCursor];
558  }
559  cursorImage = cursor->cursorImage;
560  hot = cursor->hot;
561 }
562 
568 void QPlatformCursorImage::set(const QImage &image, int hx, int hy)
569 {
570  hot.setX(hx);
571  hot.setY(hy);
572  cursorImage = image;
573 }
574 
590 void QPlatformCursorImage::set(const uchar *data, const uchar *mask,
591  int width, int height, int hx, int hy)
592 {
593  hot.setX(hx);
594  hot.setY(hy);
595 
596  cursorImage = QImage(width,height, QImage::Format_Indexed8);
597 
598  if (!width || !height || !data || !mask || cursorImage.isNull())
599  return;
600 
601  cursorImage.setNumColors(3);
602  cursorImage.setColor(0, 0xff000000);
603  cursorImage.setColor(1, 0xffffffff);
604  cursorImage.setColor(2, 0x00000000);
605 
606  int bytesPerLine = (width + 7) / 8;
607  int p = 0;
608  int d, m;
609 
610  int x = -1, w = 0;
611 
612  uchar *cursor_data = cursorImage.bits();
613  int bpl = cursorImage.bytesPerLine();
614  for (int i = 0; i < height; i++)
615  {
616  for (int j = 0; j < bytesPerLine; j++, data++, mask++)
617  {
618  for (int b = 0; b < 8 && j*8+b < width; b++)
619  {
620  d = *data & (1 << b);
621  m = *mask & (1 << b);
622  if (d && m) p = 0;
623  else if (!d && m) p = 1;
624  else p = 2;
625  cursor_data[j*8+b] = p;
626 
627  // calc region
628  if (x < 0 && m)
629  x = j*8+b;
630  else if (x >= 0 && !m) {
631  x = -1;
632  w = 0;
633  }
634  if (m)
635  w++;
636  }
637  }
638  if (x >= 0) {
639  x = -1;
640  w = 0;
641  }
642  cursor_data += bpl;
643  }
644 
645 }
646 
double d
Definition: qnumeric_p.h:62
static const uchar wait_mask_bits[]
static const uchar closedhandm_bits[]
static const unsigned char mcur_cross_bits[]
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
The QPlatformScreen class provides an abstraction for visual displays.
virtual QPoint pos() const
static const uchar vsplit_bits[]
static const uchar openhand_bits[]
static const uchar cur_hor_bits[]
static const uchar mcur_ibeam_bits[]
static const uchar mcur_fdiag_bits[]
static const uchar forbiddenm_bits[]
static const uchar mcur_ver_bits[]
static const uchar size_all_data_bits[]
static const uchar cur_bdiag_bits[]
static bool systemCursorTableInit
int qt_last_x
int qt_last_y
static const uchar whatsthis_bits[]
unsigned char uchar
Definition: qglobal.h:994
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
static const uchar mcur_bdiag_bits[]
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
static const uchar phandm_bits[]
static const uchar hsplitm_bits[]
static const unsigned char cur_up_arrow_bits[]
static const uchar hsplit_bits[]
static const uchar cur_fdiag_bits[]
static QList< QWeakPointer< QPlatformCursor > > instances
static void createSystemCursor(int id)
static const uchar whatsthism_bits[]
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static const char * data(const QByteArray &arr)
static const uchar cur_ibeam_bits[]
static const uchar cur_ver_bits[]
static const uchar openhandm_bits[]
static QPlatformCursorImage * systemCursorTable[Qt::LastCursor+1]
static const uchar forbidden_bits[]
QPlatformCursor(QPlatformScreen *)
Constructs a QPlatformCursor for the given screen.
The QPlatformCursorImage class provides a set of graphics intended to be used as cursors.
CursorShape
Definition: qnamespace.h:1262
void set(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY)
Sets the cursor image to the graphic represented by the combination of data and mask, with dimensions given by width and height and a hotspot at the point specified by (hx, hy).
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
static const uchar wait_data_bits[]
static const uchar cur_arrow_bits[]
static const uchar mcur_hor_bits[]
static const unsigned char mcur_up_arrow_bits[]
static const uchar busym_bits[]
static const uchar closedhand_bits[]
static const uchar vsplitm_bits[]
static const uchar size_all_mask_bits[]
static const unsigned char cur_cross_bits[]
static const uchar mcur_arrow_bits[]
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
virtual void setPos(const QPoint &pos)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
static const uchar busy_bits[]
static const uchar phand_bits[]