QtGui/qwsevent_qws.h Source File

qwsevent_qws.h
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 QtGui 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 
42 #ifndef QWSEVENT_QWS_H
43 #define QWSEVENT_QWS_H
44 
45 #include <QtGui/qwsutils_qws.h>
47 #include <QtCore/qrect.h>
48 #include <QtGui/qregion.h>
49 #include <QtCore/qvector.h>
50 
52 
54 
55 QT_MODULE(Gui)
56 
57 struct QWSMouseEvent;
58 
60 
61  QWSEvent(int t, int len, char *ptr) : QWSProtocolItem(t,len,ptr) {}
62 
63 
64 
65  enum Type {
70  Key,
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 
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;
115  } simpleData;
116 
117  char *display;
118 };
119 
122  : QWSEvent(MaxWindowRect, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) { }
123  struct SimpleData {
124  int window;
126  } simpleData;
127 };
128 
131  : QWSEvent(QWSEvent::Mouse, sizeof(simpleData),
132  reinterpret_cast<char*>(&simpleData)) {}
133  struct SimpleData {
134  int window;
136  int time; // milliseconds
137  } simpleData;
138 };
139 
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 
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;
161  } simpleData;
162 };
163 
164 
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
179  reinterpret_cast<char*>(&simpleData)) {}
180  enum State {
183  };
184  struct SimpleData {
185  int window;
186  int property;
187  int state;
188  } simpleData;
189 };
190 #endif
191 
195  reinterpret_cast<char*>(&simpleData)) {}
196  struct SimpleData {
197  int window;
198  } simpleData;
199 };
200 
204  reinterpret_cast<char*>(&simpleData)) {}
205  struct SimpleData {
206  int window;
207  int requestor; // window which wants the selection
208  int property; // property on requestor into which the selection should be stored, normally QWSProperty::PropSelection
209  int mimeTypes; // Value is stored in the property mimeType on the requestor window. This value may contain
210  // multiple mimeTypes separated by ;; where the order reflects the priority
211  } simpleData;
212 };
213 
217  reinterpret_cast<char*>(&simpleData)) {}
218  struct SimpleData {
219  int window;
220  int requestor; // the window which wanted the selection and to which this event is sent
221  int property; // property of requestor in which the data of the selection is stored
222  int mimeType; // a property on the requestor in which the mime type in which the selection is, is stored
223  } simpleData;
224 };
225 
226 //complex events:
227 
230  : QWSEvent(QWSEvent::Region, sizeof(simpleData),
231  reinterpret_cast<char*>(&simpleData))
232  { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
233 
234  void setData(const char *d, int len, bool allocateMem = true) {
235  QWSEvent::setData(d, len, allocateMem);
236  rectangles = reinterpret_cast<QRect*>(rawDataPtr);
237  }
238 
239  void setData(int winId, const QRegion &region, uint type) {
240  const QVector<QRect> rects = region.rects();
241  setData(reinterpret_cast<const char*>(rects.constData()),
242  rects.size() * sizeof(QRect));
243  simpleData.window = winId;
244  simpleData.nrectangles = rects.size();
245  simpleData.type = type;
246 #ifdef QT_QWS_CLIENTBLIT
247  simpleData.id = 0;
248 #endif
249  }
250 
252 #ifdef QT_QWS_CLIENTBLIT
253  , DirectPaint
254 #endif
255  };
256  struct SimpleData {
257  int window;
259 #ifdef QT_QWS_CLIENTBLIT
260  int id;
261 #endif
262  uint type:8;
263  } simpleData;
264 
266 };
267 
268 #ifndef QT_NO_QWSEMBEDWIDGET
270 {
272  reinterpret_cast<char*>(&simpleData))
273  {}
274 
275  enum Type { StartEmbed = 1, StopEmbed = 2, Region = 4 };
276 
277  void setData(const char *d, int len, bool allocateMem = true) {
278  QWSEvent::setData(d, len, allocateMem);
279  region.setRects(reinterpret_cast<const QRect *>(rawDataPtr),
281  }
282 
283  void setData(int winId, Type type, const QRegion &reg = QRegion()) {
284  simpleData.window = winId;
285  simpleData.nrectangles = reg.rects().size();
286  simpleData.type = type;
287  region = reg;
288  const QVector<QRect> rects = reg.rects();
289  QWSEvent::setData(reinterpret_cast<const char*>(rects.data()),
290  rects.size() * sizeof(QRect));
291  }
292 
293  struct SimpleData {
294  int window;
297  } simpleData;
298 
300 };
301 #endif // QT_NO_QWSEMBEDWIDGET
302 
303 #ifndef QT_NO_QWS_PROPERTIES
307  reinterpret_cast<char*>(&simpleData)) {}
308 
309  void setData(const char *d, int len, bool allocateMem = true) {
310  QWSEvent::setData(d, len, allocateMem);
311  data = reinterpret_cast<char*>(rawDataPtr);
312  }
313 
314  struct SimpleData {
315  int window;
316  int property;
317  int len;
318  } simpleData;
319  char *data;
320 };
321 #endif //QT_NO_QWS_PROPERTIES
322 
323 #ifndef QT_NO_COP
327  reinterpret_cast<char*>(&simpleData))
328  { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
329 
330  void setData(const char *d, int len, bool allocateMem = true) {
331  QWSEvent::setData(d, len, allocateMem);
332  char* p = rawDataPtr;
334  p += simpleData.lchannel;
336  p += simpleData.lmessage;
338  }
339 
340  void setDataDirect(const char *d, int len) {
341  QWSEvent::setData(d, len, false);
342  deleteRaw = true;
343  }
344 
345  struct SimpleData {
347  int lchannel;
348  int lmessage;
349  int ldata;
350  } simpleData;
351 
355 };
356 
357 #endif
358 
361  : QWSEvent(WindowOperation, sizeof(simpleData), reinterpret_cast<char*>(&simpleData)) { }
362 
364  struct SimpleData {
365  int window;
367  } simpleData;
368 };
369 
370 #ifndef QT_NO_QWS_INPUTMETHODS
371 
372 
375  : QWSEvent(IMEvent, sizeof(simpleData), reinterpret_cast<char*>(&simpleData))
376  { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
377 
378  struct SimpleData {
379  int window;
382  } simpleData;
383 
384  void setData(const char *d, int len, bool allocateMem = true) {
385  QWSEvent::setData(d, len, allocateMem);
387  }
389 };
390 
391 
394  : QWSEvent(IMInit, sizeof(simpleData), reinterpret_cast<char*>(&simpleData))
395  { memset(reinterpret_cast<char*>(&simpleData),0,sizeof(simpleData)); }
396 
397  struct SimpleData {
398  int window;
400  } simpleData;
401 
402  void setData(const char *d, int len, bool allocateMem = true) {
403  QWSEvent::setData(d, len, allocateMem);
405  }
407 };
408 
409 
412  : QWSEvent(QWSEvent::IMQuery, sizeof(simpleData),
413  reinterpret_cast<char*>(&simpleData)) {}
414 
415  struct SimpleData {
416  int window;
417  int property;
418  } simpleData;
419 
420 };
421 
422 #endif
423 
426  : QWSEvent(QWSEvent::Font, sizeof(simpleData),
427  reinterpret_cast<char*>(&simpleData)) {}
428 
429  enum EventType {
431  };
432 
433  void setData(const char *d, int len, bool allocateMem = true) {
434  QWSEvent::setData(d, len, allocateMem);
436  }
437 
438  struct SimpleData {
439  uchar type;
440  } simpleData;
442 };
443 
447  reinterpret_cast<char*>(&simpleData)) {}
448 
449  struct SimpleData {
450  int screen;
452  } simpleData;
453 };
454 
456 
458 
459 #endif // QWSEVENT_QWS_H
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:872
int window() const
Definition: qwsevent_qws.h:93
QRegion region
Definition: qwsevent_qws.h:299
struct QWSFocusEvent::SimpleData simpleData
static QByteArray fromRawData(const char *, int size)
T * data()
Definition: qvector.h:152
#define QT_END_NAMESPACE
Definition: qglobal.h:128
virtual void setData(const char *data, int len, bool allocateMem=true)
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
struct QWSQCopMessageEvent::SimpleData simpleData
struct QWSWindowOperationEvent::SimpleData simpleData
struct QWSPropertyReplyEvent::SimpleData simpleData
void setData(int winId, Type type, const QRegion &reg=QRegion())
Definition: qwsevent_qws.h:283
struct _XRegion * Region
Definition: qwindowdefs.h:118
struct QWSConnectedEvent::SimpleData simpleData
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:433
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:309
struct QWSPropertyNotifyEvent::SimpleData simpleData
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
struct QWSIMInitEvent::SimpleData simpleData
QWSMouseEvent * asMouse()
Definition: qwsevent_qws.h:90
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
QByteArray streamingData
Definition: qwsevent_qws.h:406
void setData(int winId, const QRegion &region, uint type)
Definition: qwsevent_qws.h:239
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:105
struct QWSCreationEvent::SimpleData simpleData
QVector< QRect > rects() const
struct QWSSelectionNotifyEvent::SimpleData simpleData
int window()
Definition: qwsevent_qws.h:92
struct QWSMaxWindowRectEvent::SimpleData simpleData
QRect * rectangles
Definition: qwsevent_qws.h:265
struct QWSEmbedEvent::SimpleData simpleData
struct QWSIMEvent::SimpleData simpleData
const T * constData() const
Definition: qvector.h:154
Definition: qrect.h:58
GLfloat GLfloat p
Definition: GLee.h:5416
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:234
QByteArray fontName
Definition: qwsevent_qws.h:441
int int channel
Definition: GLee.h:10533
struct QWSScreenTransformationEvent::SimpleData simpleData
struct QWSMouseEvent::SimpleData simpleData
struct QWSSelectionRequestEvent::SimpleData simpleData
struct QWSSelectionClearEvent::SimpleData simpleData
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:330
int size() const
Definition: qvector.h:137
struct QWSFontEvent::SimpleData simpleData
void setDataDirect(const char *d, int len)
Definition: qwsevent_qws.h:340
GLuint id
Definition: GLee.h:1552
QWSEvent(int t, int len, char *ptr)
Definition: qwsevent_qws.h:61
GLenum GLsizei len
Definition: GLee.h:2695
GLdouble GLdouble t
Definition: GLee.h:1181
struct QWSRegionEvent::SimpleData simpleData
QByteArray streamingData
Definition: qwsevent_qws.h:388
#define QT_END_HEADER
Definition: qglobal.h:142
void setRects(const QRect *rect, int num)
struct QWSKeyEvent::SimpleData simpleData
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:384
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:402
struct QWSIMQueryEvent::SimpleData simpleData
Qt::KeyboardModifiers modifiers
Definition: qwsevent_qws.h:157
void setData(const char *d, int len, bool allocateMem=true)
Definition: qwsevent_qws.h:277