1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
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 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #ifndef QWSEVENT_QWS_H
|
---|
43 | #define QWSEVENT_QWS_H
|
---|
44 |
|
---|
45 | #include <QtGui/qwsutils_qws.h>
|
---|
46 | #include <QtGui/qwsprotocolitem_qws.h>
|
---|
47 | #include <QtCore/qrect.h>
|
---|
48 | #include <QtGui/qregion.h>
|
---|
49 | #include <QtCore/qvector.h>
|
---|
50 |
|
---|
51 | QT_BEGIN_HEADER
|
---|
52 |
|
---|
53 | QT_BEGIN_NAMESPACE
|
---|
54 |
|
---|
55 | QT_MODULE(Gui)
|
---|
56 |
|
---|
57 | struct QWSMouseEvent;
|
---|
58 |
|
---|
59 | struct QWSEvent : QWSProtocolItem {
|
---|
60 |
|
---|
61 | QWSEvent(int t, int len, char *ptr) : QWSProtocolItem(t,len,ptr) {}
|
---|
62 |
|
---|
63 |
|
---|
64 |
|
---|
65 | enum Type {
|
---|
66 | NoEvent,
|
---|
67 | Connected,
|
---|
68 | Mouse,
|
---|
69 | Focus,
|
---|
70 | Key,
|
---|
71 | Region,
|
---|
72 | Creation,
|
---|
73 | PropertyNotify,
|
---|
74 | PropertyReply,
|
---|
75 | SelectionClear,
|
---|
76 | SelectionRequest,
|
---|
77 | SelectionNotify,
|
---|
78 | MaxWindowRect,
|
---|
79 | QCopMessage,
|
---|
80 | WindowOperation,
|
---|
81 | IMEvent,
|
---|
82 | IMQuery,
|
---|
83 | IMInit,
|
---|
84 | Embed,
|
---|
85 | Font,
|
---|
86 | ScreenTransformation,
|
---|
87 | NEvent
|
---|
88 | };
|
---|
89 |
|
---|
90 | QWSMouseEvent *asMouse()
|
---|
91 | { return type == Mouse ? reinterpret_cast<QWSMouseEvent*>(this) : 0; }
|
---|
92 | int window() { return *(reinterpret_cast<int*>(simpleDataPtr)); }
|
---|
93 | int window() const { return *(reinterpret_cast<int*>(simpleDataPtr)); }
|
---|
94 | static QWSEvent *factory(int type);
|
---|
95 | };
|
---|
96 |
|
---|
97 |
|
---|
98 | //All events must start with windowID
|
---|
99 |
|
---|
100 | struct QWSConnectedEvent : QWSEvent {
|
---|
101 | QWSConnectedEvent()
|
---|
102 | : QWSEvent(QWSEvent::Connected, sizeof(simpleData),
|
---|
103 | reinterpret_cast<char*>(&simpleData)) {}
|
---|
104 |
|
---|
105 | void setData(const char *d, int len, bool allocateMem = true) {
|
---|
106 | QWSEvent::setData(d, len, allocateMem);
|
---|
107 | display = reinterpret_cast<char*>(rawDataPtr);
|
---|
108 | }
|
---|
109 |
|
---|
110 | struct SimpleData {
|
---|
111 | int window;
|
---|
112 | int len;
|
---|
113 | int clientId;
|
---|
114 | int servershmid;
|
---|
115 | } simpleData;
|
---|
116 |
|
---|
117 | char *display;
|
---|
118 | };
|
---|
119 |
|
---|
120 | struct QWSMaxWindowRectEvent : QWSEvent {
|
---|
121 | QWSMaxWindowRectEvent()
|
---|
122 | : QWSEvent(MaxWindowRect, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) { }
|
---|
123 | struct SimpleData {
|
---|
124 | int window;
|
---|
125 | QRect rect;
|
---|
126 | } simpleData;
|
---|
127 | };
|
---|
128 |
|
---|
129 | struct QWSMouseEvent : QWSEvent {
|
---|
130 | QWSMouseEvent()
|
---|
131 | : QWSEvent(QWSEvent::Mouse, sizeof(simpleData),
|
---|
132 | reinterpret_cast<char*>(&simpleData)) {}
|
---|
133 | struct SimpleData {
|
---|
134 | int window;
|
---|
135 | int x_root, y_root, state, delta;
|
---|
136 | int time; // milliseconds
|
---|
137 | } simpleData;
|
---|
138 | };
|
---|
139 |
|
---|
140 | struct QWSFocusEvent : QWSEvent {
|
---|
141 | QWSFocusEvent()
|
---|
142 | : QWSEvent(QWSEvent::Focus, sizeof(simpleData), reinterpret_cast<char*>(&simpleData))
|
---|
143 | { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
|
---|
144 | struct SimpleData {
|
---|
145 | int window;
|
---|
146 | uint get_focus:1;
|
---|
147 | } simpleData;
|
---|
148 | };
|
---|
149 |
|
---|
150 | struct QWSKeyEvent: QWSEvent {
|
---|
151 | QWSKeyEvent()
|
---|
152 | : QWSEvent(QWSEvent::Key, sizeof(simpleData),
|
---|
153 | reinterpret_cast<char*>(&simpleData)) {}
|
---|
154 | struct SimpleData {
|
---|
155 | int window;
|
---|
156 | uint keycode;
|
---|
157 | Qt::KeyboardModifiers modifiers;
|
---|
158 | ushort unicode;
|
---|
159 | uint is_press:1;
|
---|
160 | uint is_auto_repeat:1;
|
---|
161 | } simpleData;
|
---|
162 | };
|
---|
163 |
|
---|
164 |
|
---|
165 | struct QWSCreationEvent : QWSEvent {
|
---|
166 | QWSCreationEvent()
|
---|
167 | : QWSEvent(QWSEvent::Creation, sizeof(simpleData),
|
---|
168 | reinterpret_cast<char*>(&simpleData)) {}
|
---|
169 | struct SimpleData {
|
---|
170 | int objectid;
|
---|
171 | int count;
|
---|
172 | } simpleData;
|
---|
173 | };
|
---|
174 |
|
---|
175 | #ifndef QT_NO_QWS_PROPERTIES
|
---|
176 | struct QWSPropertyNotifyEvent : QWSEvent {
|
---|
177 | QWSPropertyNotifyEvent()
|
---|
178 | : QWSEvent(QWSEvent::PropertyNotify, sizeof(simpleData),
|
---|
179 | reinterpret_cast<char*>(&simpleData)) {}
|
---|
180 | enum State {
|
---|
181 | PropertyNewValue,
|
---|
182 | PropertyDeleted
|
---|
183 | };
|
---|
184 | struct SimpleData {
|
---|
185 | int window;
|
---|
186 | int property;
|
---|
187 | int state;
|
---|
188 | } simpleData;
|
---|
189 | };
|
---|
190 | #endif
|
---|
191 |
|
---|
192 | struct QWSSelectionClearEvent : QWSEvent {
|
---|
193 | QWSSelectionClearEvent()
|
---|
194 | : QWSEvent(QWSEvent::SelectionClear, sizeof(simpleData),
|
---|
195 | reinterpret_cast<char*>(&simpleData)) {}
|
---|
196 | struct SimpleData {
|
---|
|
---|