0
|
1 |
/****************************************************************************
|
|
2 |
**
|
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
4 |
** All rights reserved.
|
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
6 |
**
|
|
7 |
** This file is part of the QtGui module of the Qt Toolkit.
|
|
8 |
**
|
|
9 |
** $QT_BEGIN_LICENSE:LGPL$
|
|
10 |
** No Commercial Usage
|
|
11 |
** This file contains pre-release code and may not be distributed.
|
|
12 |
** You may use this file in accordance with the terms and conditions
|
|
13 |
** contained in the Technology Preview License Agreement accompanying
|
|
14 |
** this package.
|
|
15 |
**
|
|
16 |
** GNU Lesser General Public License Usage
|
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
18 |
** General Public License version 2.1 as published by the Free Software
|
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
20 |
** packaging of this file. Please review the following information to
|
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
23 |
**
|
|
24 |
** In addition, as a special exception, Nokia gives you certain additional
|
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
27 |
**
|
|
28 |
** If you have questions regarding the use of this file, please contact
|
|
29 |
** Nokia at qt-info@nokia.com.
|
|
30 |
**
|
|
31 |
**
|
|
32 |
**
|
|
33 |
**
|
|
34 |
**
|
|
35 |
**
|
|
36 |
**
|
|
37 |
**
|
|
38 |
** $QT_END_LICENSE$
|
|
39 |
**
|
|
40 |
****************************************************************************/
|
|
41 |
|
|
42 |
#include "qcursor.h"
|
|
43 |
#include "qbitmap.h"
|
|
44 |
#include "qscreen_qws.h"
|
|
45 |
#include "qapplication.h"
|
|
46 |
#include "qwindowsystem_qws.h"
|
|
47 |
#include "qwindowsystem_p.h"
|
|
48 |
#include "qwscursor_qws.h"
|
|
49 |
|
|
50 |
QT_BEGIN_NAMESPACE
|
|
51 |
|
|
52 |
#ifndef QT_NO_QWS_CURSOR
|
|
53 |
static QWSCursor *systemCursorTable[Qt::LastCursor+1];
|
|
54 |
static bool systemCursorTableInit = false;
|
|
55 |
|
|
56 |
// 16 x 16
|
|
57 |
static const uchar cur_arrow_bits[] = {
|
|
58 |
0x07, 0x00, 0x39, 0x00, 0xc1, 0x01, 0x02, 0x0e, 0x02, 0x10, 0x02, 0x08,
|
|
59 |
0x04, 0x04, 0x04, 0x02, 0x04, 0x04, 0x88, 0x08, 0x48, 0x11, 0x28, 0x22,
|
|
60 |
0x10, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00 };
|
|
61 |
static const uchar mcur_arrow_bits[] = {
|
|
62 |
0x07, 0x00, 0x3f, 0x00, 0xff, 0x01, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x0f,
|
|
63 |
0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x07, 0xf8, 0x0f, 0x78, 0x1f, 0x38, 0x3e,
|
|
64 |
0x10, 0x7c, 0x00, 0x38, 0x00, 0x10, 0x00, 0x00 };
|
|
65 |
|
|
66 |
static const unsigned char cur_up_arrow_bits[] = {
|
|
67 |
0x80, 0x00, 0x40, 0x01, 0x40, 0x01, 0x20, 0x02, 0x20, 0x02, 0x10, 0x04,
|
|
68 |
0x10, 0x04, 0x08, 0x08, 0x78, 0x0f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
|
|
69 |
0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0xc0, 0x01};
|
|
70 |
static const unsigned char mcur_up_arrow_bits[] = {
|
|
71 |
0x80, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07,
|
|
72 |
0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
|
|
73 |
0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01};
|
|
74 |
|
|
75 |
static const unsigned char cur_cross_bits[] = {
|
|
76 |
0xc0, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
|
|
77 |
0x7f, 0x7f, 0x01, 0x40, 0x7f, 0x7f, 0x40, 0x01, 0x40, 0x01, 0x40, 0x01,
|
|
78 |
0x40, 0x01, 0x40, 0x01, 0xc0, 0x01, 0x00, 0x00};
|
|
79 |
static const unsigned char mcur_cross_bits[] = {
|
|
80 |
0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
|
|
81 |
0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
|
|
82 |
0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00};
|
|
83 |
|
|
84 |
static const uchar cur_ibeam_bits[] = {
|
|
85 |
0x00, 0x00, 0xe0, 0x03, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
|
|
86 |
0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00,
|
|
87 |
0x80, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00 };
|
|
88 |
static const uchar mcur_ibeam_bits[] = {
|
|
89 |
0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
|
|
90 |
0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01,
|
|
91 |
0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0x00, 0x00 };
|
|
92 |
|
|
93 |
static const uchar cur_ver_bits[] = {
|
|
94 |
0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f,
|
|
95 |
0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0xf0, 0x0f,
|
|
96 |
0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00 };
|
|
97 |
static const uchar mcur_ver_bits[] = {
|
|
98 |
0x00, 0x00, 0x80, 0x03, 0xc0, 0x07, 0xe0, 0x0f, 0xf0, 0x1f, 0xf8, 0x3f,
|
|
99 |
0xfc, 0x7f, 0xc0, 0x07, 0xc0, 0x07, 0xc0, 0x07, 0xfc, 0x7f, 0xf8, 0x3f,
|
|
100 |
0xf0, 0x1f, 0xe0, 0x0f, 0xc0, 0x07, 0x80, 0x03 };
|
|
101 |
|
|
102 |
static const uchar cur_hor_bits[] = {
|
|
103 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x08, 0x30, 0x18,
|
|
104 |
0x38, 0x38, 0xfc, 0x7f, 0xfc, 0x7f, 0x38, 0x38, 0x30, 0x18, 0x20, 0x08,
|
|
105 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
106 |
static const uchar mcur_hor_bits[] = {
|
|
107 |
0x00, 0x00, 0x00, 0x00, 0x40, 0x04, 0x60, 0x0c, 0x70, 0x1c, 0x78, 0x3c,
|
|
108 |
0xfc, 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, 0x78, 0x3c,
|
|
109 |
0x70, 0x1c, 0x60, 0x0c, 0x40, 0x04, 0x00, 0x00 };
|
|
110 |
static const uchar cur_bdiag_bits[] = {
|
|
111 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3c, 0x00, 0x3e,
|
|
112 |
0x00, 0x37, 0x88, 0x23, 0xd8, 0x01, 0xf8, 0x00, 0x78, 0x00, 0xf8, 0x00,
|
|
113 |
0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
114 |
static const uchar mcur_bdiag_bits[] = {
|
|
115 |
0x00, 0x00, 0xc0, 0x7f, 0x80, 0x7f, 0x00, 0x7f, 0x00, 0x7e, 0x04, 0x7f,
|
|
116 |
0x8c, 0x7f, 0xdc, 0x77, 0xfc, 0x63, 0xfc, 0x41, 0xfc, 0x00, 0xfc, 0x01,
|
|
117 |
0xfc, 0x03, 0xfc, 0x07, 0x00, 0x00, 0x00, 0x00 };
|
|
118 |
static const uchar cur_fdiag_bits[] = {
|
|
119 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0xf8, 0x00, 0x78, 0x00,
|
|
120 |
0xf8, 0x00, 0xd8, 0x01, 0x88, 0x23, 0x00, 0x37, 0x00, 0x3e, 0x00, 0x3c,
|
|
121 |
0x00, 0x3e, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00 };
|
|
122 |
static const uchar mcur_fdiag_bits[] = {
|
|
123 |
0x00, 0x00, 0x00, 0x00, 0xfc, 0x07, 0xfc, 0x03, 0xfc, 0x01, 0xfc, 0x00,
|
|
124 |
0xfc, 0x41, 0xfc, 0x63, 0xdc, 0x77, 0x8c, 0x7f, 0x04, 0x7f, 0x00, 0x7e,
|
|
125 |
0x00, 0x7f, 0x80, 0x7f, 0xc0, 0x7f, 0x00, 0x00 };
|
|
126 |
static const uchar cur_blank_bits[] = {
|
|
127 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
128 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
129 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
130 |
|
|
131 |
// 20 x 20
|
|
132 |
static const uchar forbidden_bits[] = {
|
|
133 |
0x00,0x00,0x00,0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xf0,0x00,0x38,0xc0,0x01,
|
|
134 |
0x7c,0x80,0x03,0xec,0x00,0x03,0xce,0x01,0x07,0x86,0x03,0x06,0x06,0x07,0x06,
|
|
135 |
0x06,0x0e,0x06,0x06,0x1c,0x06,0x0e,0x38,0x07,0x0c,0x70,0x03,0x1c,0xe0,0x03,
|
|
136 |
0x38,0xc0,0x01,0xf0,0xe0,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00,0x00,0x00,0x00 };
|
|
137 |
|
|
138 |
static const uchar forbiddenm_bits[] = {
|
|
139 |
0x80,0x1f,0x00,0xe0,0x7f,0x00,0xf0,0xff,0x00,0xf8,0xff,0x01,0xfc,0xf0,0x03,
|
|
140 |
0xfe,0xc0,0x07,0xfe,0x81,0x07,0xff,0x83,0x0f,0xcf,0x07,0x0f,0x8f,0x0f,0x0f,
|
|
141 |
0x0f,0x1f,0x0f,0x0f,0x3e,0x0f,0x1f,0xfc,0x0f,0x1e,0xf8,0x07,0x3e,0xf0,0x07,
|
|
142 |
0xfc,0xe0,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0x80,0x1f,0x00};
|
|
143 |
|
|
144 |
// 32 x 32
|
|
145 |
static const uchar wait_data_bits[] = {
|
|
146 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
147 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00,
|
|
148 |
0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x08, 0x20, 0x00,
|
|
149 |
0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x08, 0x20, 0x00,
|
|
150 |
0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x40, 0x05, 0x00,
|
|
151 |
0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x04, 0x00, 0x00, 0x20, 0x08, 0x00,
|
|
152 |
0x00, 0x10, 0x10, 0x00, 0x00, 0x08, 0x21, 0x00, 0x00, 0x88, 0x22, 0x00,
|
|
153 |
0x00, 0x48, 0x25, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0xfc, 0x7f, 0x00,
|
|
154 |
0x00, 0x04, 0x40, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
155 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
156 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
157 |
static const uchar wait_mask_bits[] = {
|
|
158 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
159 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0x00,
|
|
160 |
0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
|
|
161 |
0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
|
|
162 |
0x00, 0xf0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xc0, 0x07, 0x00,
|
|
163 |
0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0x0f, 0x00,
|
|
164 |
0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00,
|
|
165 |
0x00, 0xf8, 0x3f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00,
|
|
166 |
0x00, 0xfc, 0x7f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
167 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
168 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
169 |
|
|
170 |
static const uchar hsplit_bits[] = {
|
|
171 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
172 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
173 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
|
|
174 |
0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
|
|
175 |
0x00, 0x41, 0x82, 0x00, 0x80, 0x41, 0x82, 0x01, 0xc0, 0x7f, 0xfe, 0x03,
|
|
176 |
0x80, 0x41, 0x82, 0x01, 0x00, 0x41, 0x82, 0x00, 0x00, 0x40, 0x02, 0x00,
|
|
177 |
0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00,
|
|
178 |
0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
179 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
180 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
181 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
182 |
static const uchar hsplitm_bits[] = {
|
|
183 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
184 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
185 |
0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
|
|
186 |
0x00, 0xe0, 0x07, 0x00, 0x00, 0xe2, 0x47, 0x00, 0x00, 0xe3, 0xc7, 0x00,
|
|
187 |
0x80, 0xe3, 0xc7, 0x01, 0xc0, 0xff, 0xff, 0x03, 0xe0, 0xff, 0xff, 0x07,
|
|
188 |
0xc0, 0xff, 0xff, 0x03, 0x80, 0xe3, 0xc7, 0x01, 0x00, 0xe3, 0xc7, 0x00,
|
|
189 |
0x00, 0xe2, 0x47, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00,
|
|
190 |
0x00, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
191 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
192 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
193 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
194 |
static const uchar vsplit_bits[] = {
|
|
195 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
196 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
197 |
0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,
|
|
198 |
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
|
199 |
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
|
|
200 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00,
|
|
201 |
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
|
202 |
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,
|
|
203 |
0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
204 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
205 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
206 |
static const uchar vsplitm_bits[] = {
|
|
207 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
208 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
|
209 |
0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,
|
|
210 |
0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
|
|
211 |
0x00, 0xc0, 0x01, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
|
|
212 |
0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0x00,
|
|
213 |
0x80, 0xff, 0xff, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00,
|
|
214 |
0x00, 0xc0, 0x01, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00,
|
|
215 |
0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00,
|
|
216 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
217 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
218 |
static const uchar phand_bits[] = {
|
|
219 |
0x00, 0x00, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
|
|
220 |
0x7e, 0x04, 0x00, 0x00, 0x08, 0x08, 0x00, 0x00, 0x70, 0x08, 0x00, 0x00,
|
|
221 |
0x08, 0x08, 0x00, 0x00, 0x70, 0x14, 0x00, 0x00, 0x08, 0x22, 0x00, 0x00,
|
|
222 |
0x30, 0x41, 0x00, 0x00, 0xc0, 0x20, 0x00, 0x00, 0x40, 0x12, 0x00, 0x00,
|
|
223 |
0x80, 0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
|
|
224 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
225 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
226 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
227 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
228 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
229 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
230 |
static const uchar phandm_bits[] = {
|
|
231 |
0xfe, 0x01, 0x00, 0x00, 0xff, 0x03, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00,
|
|
232 |
0xff, 0x0f, 0x00, 0x00, 0xfe, 0x1f, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00,
|
|
233 |
0xfc, 0x1f, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0xfc, 0x7f, 0x00, 0x00,
|
|
234 |
0xf8, 0xff, 0x00, 0x00, 0xf0, 0x7f, 0x00, 0x00, 0xe0, 0x3f, 0x00, 0x00,
|
|
235 |
0xc0, 0x1f, 0x00, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
|
|
236 |
0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
237 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
238 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
239 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
240 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
241 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
242 |
|
|
243 |
static const uchar size_all_data_bits[] = {
|
|
244 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
245 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
246 |
0x00, 0x80, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,
|
|
247 |
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
|
248 |
0x00, 0x80, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x80, 0x81, 0xc0, 0x00,
|
|
249 |
0xc0, 0xff, 0xff, 0x01, 0x80, 0x81, 0xc0, 0x00, 0x00, 0x81, 0x40, 0x00,
|
|
250 |
0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
|
251 |
0x00, 0x80, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00,
|
|
252 |
0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
253 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
254 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
255 |
static const uchar size_all_mask_bits[] = {
|
|
256 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
257 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
|
258 |
0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xf0, 0x07, 0x00,
|
|
259 |
0x00, 0xf8, 0x0f, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xc2, 0x21, 0x00,
|
|
260 |
0x00, 0xc3, 0x61, 0x00, 0x80, 0xc3, 0xe1, 0x00, 0xc0, 0xff, 0xff, 0x01,
|
|
261 |
0xe0, 0xff, 0xff, 0x03, 0xc0, 0xff, 0xff, 0x01, 0x80, 0xc3, 0xe1, 0x00,
|
|
262 |
0x00, 0xc3, 0x61, 0x00, 0x00, 0xc2, 0x21, 0x00, 0x00, 0xc0, 0x01, 0x00,
|
|
263 |
0x00, 0xf8, 0x0f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0xe0, 0x03, 0x00,
|
|
264 |
0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
265 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
266 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
267 |
|
|
268 |
static const uchar whatsthis_bits[] = {
|
|
269 |
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0xf0, 0x07, 0x00,
|
|
270 |
0x09, 0x18, 0x0e, 0x00, 0x11, 0x1c, 0x0e, 0x00, 0x21, 0x1c, 0x0e, 0x00,
|
|
271 |
0x41, 0x1c, 0x0e, 0x00, 0x81, 0x1c, 0x0e, 0x00, 0x01, 0x01, 0x07, 0x00,
|
|
272 |
0x01, 0x82, 0x03, 0x00, 0xc1, 0xc7, 0x01, 0x00, 0x49, 0xc0, 0x01, 0x00,
|
|
273 |
0x95, 0xc0, 0x01, 0x00, 0x93, 0xc0, 0x01, 0x00, 0x21, 0x01, 0x00, 0x00,
|
|
274 |
0x20, 0xc1, 0x01, 0x00, 0x40, 0xc2, 0x01, 0x00, 0x40, 0x02, 0x00, 0x00,
|
|
275 |
0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
276 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
277 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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, };
|
|
280 |
static const uchar whatsthism_bits[] = {
|
|
281 |
0x01, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x07, 0x00, 0x07, 0xf8, 0x0f, 0x00,
|
|
282 |
0x0f, 0xfc, 0x1f, 0x00, 0x1f, 0x3e, 0x1f, 0x00, 0x3f, 0x3e, 0x1f, 0x00,
|
|
283 |
0x7f, 0x3e, 0x1f, 0x00, 0xff, 0x3e, 0x1f, 0x00, 0xff, 0x9d, 0x0f, 0x00,
|
|
284 |
0xff, 0xc3, 0x07, 0x00, 0xff, 0xe7, 0x03, 0x00, 0x7f, 0xe0, 0x03, 0x00,
|
|
285 |
0xf7, 0xe0, 0x03, 0x00, 0xf3, 0xe0, 0x03, 0x00, 0xe1, 0xe1, 0x03, 0x00,
|
|
286 |
0xe0, 0xe1, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00, 0xc0, 0xe3, 0x03, 0x00,
|
|
287 |
0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
288 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
289 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
290 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
291 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
|
|
292 |
|
|
293 |
static const uchar busy_bits[] = {
|
|
294 |
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
|
|
295 |
0x09, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00,
|
|
296 |
0x41, 0xe0, 0xff, 0x00, 0x81, 0x20, 0x80, 0x00, 0x01, 0xe1, 0xff, 0x00,
|
|
297 |
0x01, 0x42, 0x40, 0x00, 0xc1, 0x47, 0x40, 0x00, 0x49, 0x40, 0x55, 0x00,
|
|
298 |
0x95, 0x80, 0x2a, 0x00, 0x93, 0x00, 0x15, 0x00, 0x21, 0x01, 0x0a, 0x00,
|
|
299 |
0x20, 0x01, 0x11, 0x00, 0x40, 0x82, 0x20, 0x00, 0x40, 0x42, 0x44, 0x00,
|
|
300 |
0x80, 0x41, 0x4a, 0x00, 0x00, 0x40, 0x55, 0x00, 0x00, 0xe0, 0xff, 0x00,
|
|
301 |
0x00, 0x20, 0x80, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
302 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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 busym_bits[] = {
|
|
306 |
0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
|
|
307 |
0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00,
|
|
308 |
0x7f, 0xe0, 0xff, 0x00, 0xff, 0xe0, 0xff, 0x00, 0xff, 0xe1, 0xff, 0x00,
|
|
309 |
0xff, 0xc3, 0x7f, 0x00, 0xff, 0xc7, 0x7f, 0x00, 0x7f, 0xc0, 0x7f, 0x00,
|
|
310 |
0xf7, 0x80, 0x3f, 0x00, 0xf3, 0x00, 0x1f, 0x00, 0xe1, 0x01, 0x0e, 0x00,
|
|
311 |
0xe0, 0x01, 0x1f, 0x00, 0xc0, 0x83, 0x3f, 0x00, 0xc0, 0xc3, 0x7f, 0x00,
|
|
312 |
0x80, 0xc1, 0x7f, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00,
|
|
313 |
0x00, 0xe0, 0xff, 0x00, 0x00, 0xe0, 0xff, 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 |
|
|
318 |
// 16 x 16
|
|
319 |
static const uchar openhand_bits[] = {
|
|
320 |
0x80,0x01,0x58,0x0e,0x64,0x12,0x64,0x52,0x48,0xb2,0x48,0x92,
|
|
321 |
0x16,0x90,0x19,0x80,0x11,0x40,0x02,0x40,0x04,0x40,0x04,0x20,
|
|
322 |
0x08,0x20,0x10,0x10,0x20,0x10,0x00,0x00};
|
|
323 |
static const uchar openhandm_bits[] = {
|
|
324 |
0x80,0x01,0xd8,0x0f,0xfc,0x1f,0xfc,0x5f,0xf8,0xff,0xf8,0xff,
|
|
325 |
0xfe,0xff,0xff,0xff,0xff,0x7f,0xfe,0x7f,0xfc,0x7f,0xfc,0x3f,
|
|
326 |
0xf8,0x3f,0xf0,0x1f,0xe0,0x1f,0x00,0x00};
|
|
327 |
static const uchar closedhand_bits[] = {
|
|
328 |
0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0x48,0x32,0x08,0x50,
|
|
329 |
0x10,0x40,0x18,0x40,0x04,0x40,0x04,0x20,0x08,0x20,0x10,0x10,
|
|
330 |
0x20,0x10,0x20,0x10,0x00,0x00,0x00,0x00};
|
|
331 |
static const uchar closedhandm_bits[] = {
|
|
332 |
0x00,0x00,0x00,0x00,0x00,0x00,0xb0,0x0d,0xf8,0x3f,0xf8,0x7f,
|
|
333 |
0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f,
|
|
334 |
0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00};
|
|
335 |
|
|
336 |
#endif
|
|
337 |
|
|
338 |
void QWSServerPrivate::initializeCursor()
|
|
339 |
{
|
|
340 |
Q_Q(QWSServer);
|
|
341 |
// setup system cursors
|
|
342 |
#ifndef QT_NO_QWS_CURSOR
|
|
343 |
// qt_screen->initCursor(sharedram + ramlen,true);
|
|
344 |
|
|
345 |
// default cursor
|
|
346 |
cursor = 0;
|
|
347 |
setCursor(QWSCursor::systemCursor(Qt::ArrowCursor));
|
|
348 |
#endif
|
|
349 |
q->sendMouseEvent(QPoint(swidth/2, sheight/2), 0);
|
|
350 |
}
|
|
351 |
|
|
352 |
void QWSServerPrivate::setCursor(QWSCursor *curs)
|
|
353 |
{
|
|
354 |
#ifdef QT_NO_QWS_CURSOR
|
|
355 |
Q_UNUSED(curs);
|
|
356 |
#else
|
|
357 |
if (cursor == curs)
|
|
358 |
return;
|
|
359 |
|
|
360 |
cursor = curs;
|
|
361 |
|
|
362 |
if (!haveviscurs || !curs)
|
|
363 |
curs = QWSCursor::systemCursor(Qt::BlankCursor);
|
|
364 |
|
|
365 |
if (qt_screencursor) {
|
|
366 |
qt_screencursor->set(curs->image(),
|
|
367 |
curs->hotSpot().x(),
|
|
368 |
curs->hotSpot().y());
|
|
369 |
}
|
|
370 |
#endif
|
|
371 |
}
|
|
372 |
|
|
373 |
#ifndef QT_NO_QWS_CURSOR
|
|
374 |
static void cleanupSystemCursorTable()
|
|
375 |
{
|
|
376 |
for (int i = 0; i <= Qt::LastCursor; i++)
|
|
377 |
if (systemCursorTable[i]) {
|
|
378 |
delete systemCursorTable[i];
|
|
379 |
systemCursorTable[i] = 0;
|
|
380 |
}
|
|
381 |
}
|
|
382 |
#endif
|
|
383 |
|
|
384 |
void QWSCursor::createSystemCursor(int id)
|
|
385 |
{
|
|
386 |
#ifdef QT_NO_QWS_CURSOR
|
|
387 |
Q_UNUSED(id);
|
|
388 |
#else
|
|
389 |
if (!systemCursorTableInit) {
|
|
390 |
for (int i = 0; i <= Qt::LastCursor; i++)
|
|
391 |
systemCursorTable[i] = 0;
|
|
392 |
qAddPostRoutine(cleanupSystemCursorTable);
|
|
393 |
systemCursorTableInit = true;
|
|
394 |
}
|
|
395 |
switch (id) {
|
|
396 |
// 16x16 cursors
|
|
397 |
case Qt::ArrowCursor:
|
|
398 |
systemCursorTable[Qt::ArrowCursor] =
|
|
399 |
new QWSCursor(cur_arrow_bits, mcur_arrow_bits, 16, 16, 0, 0);
|
|
400 |
break;
|
|
401 |
|
|
402 |
case Qt::UpArrowCursor:
|
|
403 |
systemCursorTable[Qt::UpArrowCursor] =
|
|
404 |
new QWSCursor(cur_up_arrow_bits, mcur_up_arrow_bits, 16, 16, 7, 0);
|
|
405 |
break;
|
|
406 |
|
|
407 |
case Qt::CrossCursor:
|
|
408 |
systemCursorTable[Qt::CrossCursor] =
|
|
409 |
new QWSCursor(cur_cross_bits, mcur_cross_bits, 16, 16, 7, 7);
|
|
410 |
break;
|
|
411 |
|
|
412 |
case Qt::IBeamCursor:
|
|
413 |
systemCursorTable[Qt::IBeamCursor] =
|
|
414 |
new QWSCursor(cur_ibeam_bits, mcur_ibeam_bits, 16, 16, 7, 7);
|
|
415 |
break;
|
|
416 |
|
|
417 |
case Qt::SizeVerCursor:
|
|
418 |
systemCursorTable[Qt::SizeVerCursor] =
|
|
419 |
new QWSCursor(cur_ver_bits, mcur_ver_bits, 16, 16, 7, 7);
|
|
420 |
break;
|
|
421 |
|
|
422 |
case Qt::SizeHorCursor:
|
|
423 |
systemCursorTable[Qt::SizeHorCursor] =
|
|
424 |
new QWSCursor(cur_hor_bits, mcur_hor_bits, 16, 16, 7, 7);
|
|
425 |
break;
|
|
426 |
|
|
427 |
case Qt::SizeBDiagCursor:
|
|
428 |
systemCursorTable[Qt::SizeBDiagCursor] =
|
|
429 |
new QWSCursor(cur_bdiag_bits, mcur_bdiag_bits, 16, 16, 7, 7);
|
|
430 |
break;
|
|
431 |
|
|
432 |
case Qt::SizeFDiagCursor:
|
|
433 |
systemCursorTable[Qt::SizeFDiagCursor] =
|
|
434 |
new QWSCursor(cur_fdiag_bits, mcur_fdiag_bits, 16, 16, 7, 7);
|
|
435 |
break;
|
|
436 |
|
|
437 |
case Qt::BlankCursor:
|
|
438 |
systemCursorTable[Qt::BlankCursor] =
|
|
439 |
new QWSCursor(0, 0, 0, 0, 0, 0);
|
|
440 |
break;
|
|
441 |
|
|
442 |
// 20x20 cursors
|
|
443 |
case Qt::ForbiddenCursor:
|
|
444 |
systemCursorTable[Qt::ForbiddenCursor] =
|
|
445 |
new QWSCursor(forbidden_bits, forbiddenm_bits, 20, 20, 10, 10);
|
|
446 |
break;
|
|
447 |
|
|
448 |
// 32x32 cursors
|
|
449 |
case Qt::WaitCursor:
|
|
450 |
systemCursorTable[Qt::WaitCursor] =
|
|
451 |
new QWSCursor(wait_data_bits, wait_mask_bits, 32, 32, 15, 15);
|
|
452 |
break;
|
|
453 |
|
|
454 |
case Qt::SplitVCursor:
|
|
455 |
systemCursorTable[Qt::SplitVCursor] =
|
|
456 |
new QWSCursor(vsplit_bits, vsplitm_bits, 32, 32, 15, 15);
|
|
457 |
break;
|
|
458 |
|
|
459 |
case Qt::SplitHCursor:
|
|
460 |
systemCursorTable[Qt::SplitHCursor] =
|
|
461 |
new QWSCursor(hsplit_bits, hsplitm_bits, 32, 32, 15, 15);
|
|
462 |
break;
|
|
463 |
|
|
464 |
case Qt::SizeAllCursor:
|
|
465 |
systemCursorTable[Qt::SizeAllCursor] =
|
|
466 |
new QWSCursor(size_all_data_bits, size_all_mask_bits, 32, 32, 15, 15);
|
|
467 |
break;
|
|
468 |
|
|
469 |
case Qt::PointingHandCursor:
|
|
470 |
systemCursorTable[Qt::PointingHandCursor] =
|
|
471 |
new QWSCursor(phand_bits, phandm_bits, 32, 32, 0, 0);
|
|
472 |
break;
|
|
473 |
|
|
474 |
case Qt::WhatsThisCursor:
|
|
475 |
systemCursorTable[Qt::WhatsThisCursor] =
|
|
476 |
new QWSCursor(whatsthis_bits, whatsthism_bits, 32, 32, 0, 0);
|
|
477 |
break;
|
|
478 |
case Qt::BusyCursor:
|
|
479 |
systemCursorTable[Qt::BusyCursor] =
|
|
480 |
new QWSCursor(busy_bits, busym_bits, 32, 32, 0, 0);
|
|
481 |
break;
|
|
482 |
|
|
483 |
case Qt::OpenHandCursor:
|
|
484 |
systemCursorTable[Qt::OpenHandCursor] =
|
|
485 |
new QWSCursor(openhand_bits, openhandm_bits, 16, 16, 8, 8);
|
|
486 |
break;
|
|
487 |
case Qt::ClosedHandCursor:
|
|
488 |
systemCursorTable[Qt::ClosedHandCursor] =
|
|
489 |
new QWSCursor(closedhand_bits, closedhandm_bits, 16, 16, 8, 8);
|
|
490 |
break;
|
|
491 |
default:
|
|
492 |
qWarning("Unknown system cursor %d", id);
|
|
493 |
}
|
|
494 |
#endif
|
|
495 |
}
|
|
496 |
|
|
497 |
QWSCursor *QWSCursor::systemCursor(int id)
|
|
498 |
{
|
|
499 |
QWSCursor *cursor = 0;
|
|
500 |
#ifdef QT_NO_QWS_CURSOR
|
|
501 |
Q_UNUSED(id);
|
|
502 |
#else
|
|
503 |
if (id >= 0 && id <= Qt::LastCursor) {
|
|
504 |
if (!systemCursorTable[id])
|
|
505 |
createSystemCursor(id);
|
|
506 |
cursor = systemCursorTable[id];
|
|
507 |
}
|
|
508 |
|
|
509 |
if (cursor == 0) {
|
|
510 |
if (!systemCursorTable[Qt::ArrowCursor])
|
|
511 |
createSystemCursor(Qt::ArrowCursor);
|
|
512 |
cursor = systemCursorTable[Qt::ArrowCursor];
|
|
513 |
}
|
|
514 |
#endif
|
|
515 |
return cursor;
|
|
516 |
}
|
|
517 |
|
|
518 |
void QWSCursor::set(const uchar *data, const uchar *mask,
|
|
519 |
int width, int height, int hx, int hy)
|
|
520 |
{
|
|
521 |
#ifdef QT_NO_QWS_CURSOR
|
|
522 |
Q_UNUSED(data);
|
|
523 |
Q_UNUSED(mask);
|
|
524 |
Q_UNUSED(width);
|
|
525 |
Q_UNUSED(height);
|
|
526 |
Q_UNUSED(hx);
|
|
527 |
Q_UNUSED(hy);
|
|
528 |
#else
|
|
529 |
hot.setX(hx);
|
|
530 |
hot.setY(hy);
|
|
531 |
|
|
532 |
cursor = QImage(width,height, QImage::Format_Indexed8);
|
|
533 |
|
|
534 |
if (!width || !height || !data || !mask || cursor.isNull())
|
|
535 |
return;
|
|
536 |
|
|
537 |
cursor.setNumColors(3);
|
|
538 |
cursor.setColor(0, 0xff000000);
|
|
539 |
cursor.setColor(1, 0xffffffff);
|
|
540 |
cursor.setColor(2, 0x00000000);
|
|
541 |
|
|
542 |
int bytesPerLine = (width + 7) / 8;
|
|
543 |
int p = 0;
|
|
544 |
int d, m;
|
|
545 |
|
|
546 |
int x = -1, w = 0;
|
|
547 |
|
|
548 |
uchar *cursor_data = cursor.bits();
|
|
549 |
int bpl = cursor.bytesPerLine();
|
|
550 |
for (int i = 0; i < height; i++)
|
|
551 |
{
|
|
552 |
for (int j = 0; j < bytesPerLine; j++, data++, mask++)
|
|
553 |
{
|
|
554 |
for (int b = 0; b < 8 && j*8+b < width; b++)
|
|
555 |
{
|
|
556 |
d = *data & (1 << b);
|
|
557 |
m = *mask & (1 << b);
|
|
558 |
if (d && m) p = 0;
|
|
559 |
else if (!d && m) p = 1;
|
|
560 |
else p = 2;
|
|
561 |
cursor_data[j*8+b] = p;
|
|
562 |
|
|
563 |
// calc region
|
|
564 |
if (x < 0 && m)
|
|
565 |
x = j*8+b;
|
|
566 |
else if (x >= 0 && !m) {
|
|
567 |
x = -1;
|
|
568 |
w = 0;
|
|
569 |
}
|
|
570 |
if (m)
|
|
571 |
w++;
|
|
572 |
}
|
|
573 |
}
|
|
574 |
if (x >= 0) {
|
|
575 |
x = -1;
|
|
576 |
w = 0;
|
|
577 |
}
|
|
578 |
cursor_data += bpl;
|
|
579 |
}
|
|
580 |
|
|
581 |
if (qt_screencursor && qt_screencursor->supportsAlphaCursor())
|
|
582 |
createDropShadow(5, 2);
|
|
583 |
#endif
|
|
584 |
}
|
|
585 |
|
|
586 |
// now we're really silly
|
|
587 |
void QWSCursor::createDropShadow(int dropx, int dropy)
|
|
588 |
{
|
|
589 |
//####
|
|
590 |
#if 1 || defined(QT_NO_QWS_CURSOR) || defined(QT_NO_QWS_ALHPA_CURSOR)
|
|
591 |
Q_UNUSED(dropx);
|
|
592 |
Q_UNUSED(dropy);
|
|
593 |
#else
|
|
594 |
if (cursor.width() + dropx > 64 || cursor.height() + dropy > 64)
|
|
595 |
return;
|
|
596 |
|
|
597 |
if (!cursor.hasAlphaBuffer()) {
|
|
598 |
cursor.setAlphaBuffer(true);
|
|
599 |
|
|
600 |
const int nblur=4;
|
|
601 |
const int darkness=140;
|
|
602 |
|
|
603 |
QImage drop(cursor.width()+dropx+nblur, cursor.height()+dropy+nblur, 8, 18);
|
|
604 |
drop.setColor(0, 0xff000000); // bg (black)
|
|
605 |
drop.setColor(1, 0xffffffff); // fg (white)
|
|
606 |
for (int i=0; i<16; i++) {
|
|
607 |
drop.setColor(2+i, (darkness*i/16)<<24);
|
|
608 |
}
|
|
609 |
drop.fill(2); // all trans
|
|
610 |
QImage drop2 = drop.copy();
|
|
611 |
|
|
612 |
int cp;
|
|
613 |
|
|
614 |
// made solid shadow
|
|
615 |
for (int row = 0; row < cursor.height(); row++) {
|
|
616 |
for (int col = 0; col < cursor.width(); col++) {
|
|
617 |
cp = cursor.pixelIndex(col, row);
|
|
618 |
if (cp != 2)
|
|
619 |
drop.setPixel(col+dropx, row+dropy, 17);
|
|
620 |
}
|
|
621 |
}
|
|
622 |
|
|
623 |
// blur shadow
|
|
624 |
for (int blur=0; blur<nblur; blur++) {
|
|
625 |
QImage& to((blur&1)?drop:drop2);
|
|
626 |
QImage& from((blur&1)?drop2:drop);
|
|
627 |
for (int row = 1; row < drop.height()-1; row++) {
|
|
628 |
for (int col = 1; col < drop.width()-1; col++) {
|
|
629 |
int t=0;
|
|
630 |
for (int dx=-1; dx<=1; dx++) {
|
|
631 |
for (int dy=-1; dy<=1; dy++) {
|
|
632 |
t += from.pixelIndex(col+dx,row+dy)-2;
|
|
633 |
}
|
|
634 |
}
|
|
635 |
to.setPixel(col,row,2+t/9);
|
|
636 |
}
|
|
637 |
}
|
|
638 |
}
|
|
639 |
|
|
640 |
// copy cursor
|
|
641 |
for (int row = 0; row < cursor.height(); row++) {
|
|
642 |
for (int col = 0; col < cursor.width(); col++) {
|
|
643 |
cp = cursor.pixelIndex(col, row);
|
|
644 |
if (cp != 2)
|
|
645 |
drop.setPixel(col, row, cp);
|
|
646 |
}
|
|
647 |
}
|
|
648 |
|
|
649 |
cursor = drop;
|
|
650 |
}
|
|
651 |
#endif
|
|
652 |
}
|
|
653 |
|
|
654 |
QT_END_NAMESPACE
|