Qt 4.8
qwindowsystem_p.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 QWINDOWSYSTEM_QWS_P_H
43 #define QWINDOWSYSTEM_QWS_P_H
44 
45 
46 //
47 // W A R N I N G
48 // -------------
49 //
50 // This file is not part of the Qt API. It exists for the convenience
51 // of the QWSServer class. This header file may change from
52 // version to version without notice, or even be removed.
53 //
54 // We mean it.
55 //
56 
57 #include "private/qobject_p.h"
58 #include "qwindowsystem_qws.h"
59 #include "qbrush.h"
60 #include "qwsproperty_qws.h"
61 #include "qwscommand_qws_p.h"
62 #include "QtCore/qbasictimer.h"
63 
65 
67  friend class QCopChannel;
68  friend class QWSMouseHandler;
69  friend class QWSWindow;
70  friend class QWSDisplay;
71  friend class QWSInputMethod;
73 
74 public:
78  , saver(0), cursorClient(0), mouseState(0), nReserved(0)
79  , doClientIsActive(false)
80  {
81  }
83  {
84  closeDisplay();
85 
87  delete [] screensaverintervals;
88  delete saver;
89 
91  windows.clear();
92 
93  delete bgBrush;
94  bgBrush = 0;
95  }
101  bool screensaverblockevent( int index, int *screensaverinterval, bool isDown );
105 // bool prevWin;
108 
109  void update_regions();
110 //private functions moved from class
111 
112 private:
113  void initServer(int flags);
114 #ifndef QT_NO_COP
115  static void sendQCopEvent(QWSClient *c, const QString &ch,
116  const QString &msg, const QByteArray &data,
117  bool response = false);
118 #endif
119  void move_region(const QWSRegionMoveCommand *);
121  void set_opacity(const QWSSetOpacityCommand *);
123  QRegion reserve_region(QWSWindow *window, const QRegion &region);
124  void request_region(int winId, const QString &surfaceKey,
125  const QByteArray &surfaceData,
126  const QRegion &region);
127  void repaint_region(int winId, int windowFlags, bool opaque, const QRegion &);
129  void name_region(const QWSRegionNameCommand *);
130  void set_identity(const QWSIdentifyCommand *);
131 #ifndef QT_NO_QWS_PROPERTIES
132  bool get_property(int winId, int property, const char *&data, int &len);
133 #endif
134 #ifndef QT_NO_QWS_INPUTMETHODS
135  void im_response(const QWSIMResponseCommand *);
136 
137  void im_update(const QWSIMUpdateCommand *);
138 
139  void send_im_mouse(const QWSIMMouseCommand *);
140 #endif
141  // not in ifndef as this results in more readable functions.
142  static void sendKeyEventUnfiltered(int unicode, int keycode, Qt::KeyboardModifiers modifiers,
143  bool isPress, bool autoRepeat);
144  static void sendMouseEventUnfiltered(const QPoint &pos, int state, int wheel = 0);
145  static void emergency_cleanup();
146 
147  static QBrush *bgBrush;
148 
149  void sendMaxWindowRectEvents(const QRect &rect);
150 
151  void invokeIdentify(const QWSIdentifyCommand *cmd, QWSClient *client);
152  void invokeCreate(QWSCreateCommand *cmd, QWSClient *client);
153  void invokeRegionName(const QWSRegionNameCommand *cmd, QWSClient *client);
154  void invokeRegion(QWSRegionCommand *cmd, QWSClient *client);
155  void invokeRegionMove(const QWSRegionMoveCommand *cmd, QWSClient *client);
156  void invokeRegionDestroy(const QWSRegionDestroyCommand *cmd, QWSClient *client);
157  void invokeSetAltitude(const QWSChangeAltitudeCommand *cmd, QWSClient *client);
158  void invokeSetOpacity(const QWSSetOpacityCommand *cmd, QWSClient *client);
159 #ifndef QT_NO_QWS_PROPERTIES
164 #endif //QT_NO_QWS_PROPERTIES
167  void invokeSetFocus(const QWSRequestFocusCommand *cmd, QWSClient *client);
168 
169  void initIO();
170  void setFocus(QWSWindow*, bool gain);
171 #ifndef QT_NO_QWS_CURSOR
175 #endif
176  void invokeGrabMouse(QWSGrabMouseCommand *cmd, QWSClient *client);
178 #ifndef QT_NO_SOUND
179  void invokePlaySound(QWSPlaySoundCommand *cmd, QWSClient *client);
180 #endif
181 #ifndef QT_NO_COP
183  QWSClient *client);
184  void invokeQCopSend(QWSQCopSendCommand *cmd, QWSClient *client);
185 #endif
187  QWSClient *client);
188 #ifndef QT_NO_QWSEMBEDWIDGET
189  void invokeEmbed(QWSEmbedCommand *cmd, QWSClient *client);
190 #endif
191 #ifndef QT_NO_QWS_INPUTMETHODS
192  void invokeIMResponse(const QWSIMResponseCommand *cmd,
193  QWSClient *client);
194  void invokeIMUpdate(const QWSIMUpdateCommand *cmd,
195  QWSClient *client);
196 #endif
197  void invokeFont(const QWSFontCommand *cmd, QWSClient *client);
199  QWSClient *client);
200 
202  void openDisplay();
203  void closeDisplay();
204 
205  void showCursor();
206  void hideCursor();
207  void initializeCursor();
208 
209  void resetEngine();
210 
211 //private Q_SLOTS:
212 
213 #ifndef QT_NO_QWS_MULTIPROCESS
214  void _q_clientClosed();
215  void _q_doClient();
216  void _q_deleteWindowsLater();
217 #endif
218 
219  void _q_screenSaverWake();
220  void _q_screenSaverSleep();
221  void _q_screenSaverTimeout();
222 #ifndef QT_NO_QWS_MULTIPROCESS
223  void _q_newConnection();
224 #endif
225 
226 //other private moved from class
227 
228  void disconnectClient(QWSClient *);
229  void screenSave(int level);
230  void doClient(QWSClient *);
233  void handleWindowClose(QWSWindow *w);
234  void releaseMouse(QWSWindow* w);
235  void releaseKeyboard(QWSWindow* w);
236  void updateClientCursorPos();
237 
239  int ramlen;
240 
241  ClientMap clientMap;
242 #ifndef QT_NO_QWS_PROPERTIES
244 #endif
245  struct SelectionOwner {
246  int windowid;
247  struct Time {
248  void set(int h, int m, int s, int s2) {
249  hour = h; minute = m; sec = s; ms = s2;
250  }
251  int hour, minute, sec, ms;
252  } time;
253  } selectionOwner;
256 
262 #ifndef QT_NO_QWS_CURSOR
264  QWSCursor *cursor; // cursor currently shown
265  QWSCursor *nextCursor; // cursor to show once grabbing is off
266 #endif
267 
270 #ifndef QT_NO_QWS_KEYBOARD
272 #endif
273 
275 
276  // Window management
277  QList<QWSWindow*> windows; // first=topmost
279  QWSWindow* newWindow(int id, QWSClient* client);
280  QWSWindow* findWindow(int windowid, QWSClient* client = 0);
281  void moveWindowRegion(QWSWindow*, int dx, int dy);
282  void setWindowRegion(QWSWindow*, const QRegion &r);
283  void raiseWindow(QWSWindow *, int = 0);
284  void lowerWindow(QWSWindow *, int = -1);
285  void exposeRegion(const QRegion &, int index = 0);
286 
287  void setCursor(QWSCursor *curs);
288 
289  // multimedia
290 #ifndef QT_NO_SOUND
291  QWSSoundServer *soundserver;
292 #endif
293 #ifndef QT_NO_COP
295 #endif
296 
297 #ifndef QT_NO_QWS_MULTIPROCESS
299 #endif
300 
301  // filename -> refcount
304  void referenceFont(QWSClientPrivate *client, const QByteArray &font);
305  void dereferenceFont(QWSClientPrivate *client, const QByteArray &font);
306  void cleanupFonts(bool force = false);
307  void sendFontRemovedEvent(const QByteArray &font);
308 
311 };
312 
314 
315 #endif
void invokeIMUpdate(const QWSIMUpdateCommand *cmd, QWSClient *client)
void setWindowRegion(QWSWindow *, const QRegion &r)
Changes the requested region of window changingw to r If changingw is 0, the server&#39;s reserved region...
The QWSDisplay class provides a display for QWS; it is an internal class.
void set_altitude(const QWSChangeAltitudeCommand *)
QWSCursor * nextCursor
void invokeRegionMove(const QWSRegionMoveCommand *cmd, QWSClient *client)
void invokeGetProperty(QWSGetPropertyCommand *cmd, QWSClient *client)
unsigned char c[8]
Definition: qnumeric_p.h:62
void invokeAddProperty(QWSAddPropertyCommand *cmd)
QList< int > crashedClientIds
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
int keycode
static void sendQCopEvent(QWSClient *c, const QString &ch, const QString &msg, const QByteArray &data, bool response=false)
void invokeRemoveProperty(QWSRemovePropertyCommand *cmd)
void invokeIMResponse(const QWSIMResponseCommand *cmd, QWSClient *client)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
The QWSMouseHandler class is a base class for mouse drivers in Qt for Embedded Linux.
Definition: qmouse_qws.h:66
void invokeGrabMouse(QWSGrabMouseCommand *cmd, QWSClient *client)
QWSClient * cursorClient
QMap< QByteArray, int > fontReferenceCount
The QWSScreenSaver class is a base class for screensavers in Qt for Embedded Linux.
void referenceFont(QWSClientPrivate *client, const QByteArray &font)
void im_response(const QWSIMResponseCommand *)
void disconnectClient(QWSClient *)
QWSWindow * focusw
The QString class provides a Unicode character string.
Definition: qstring.h:83
static void sendMouseEventUnfiltered(const QPoint &pos, int state, int wheel=0)
void invokeDefineCursor(QWSDefineCursorCommand *cmd, QWSClient *client)
QBasicTimer fontCleanupTimer
void exposeRegion(const QRegion &, int index=0)
void im_update(const QWSIMUpdateCommand *)
void invokeEmbed(QWSEmbedCommand *cmd, QWSClient *client)
void invokeSetSelectionOwner(QWSSetSelectionOwnerCommand *cmd)
QMap< QString, QList< QWSClient * > > channels
bool screensaverblockevent(int index, int *screensaverinterval, bool isDown)
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
void cleanupFonts(bool force=false)
unsigned char uchar
Definition: qglobal.h:994
NSWindow * window
void moveWindowRegion(QWSWindow *, int dx, int dy)
QList< QWSMouseHandler * > mousehandlers
The QTime class provides clock time functions.
Definition: qdatetime.h:148
void invokeRegion(QWSRegionCommand *cmd, QWSClient *client)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
void invokeRegionDestroy(const QWSRegionDestroyCommand *cmd, QWSClient *client)
void invokeRegisterChannel(QWSQCopRegisterChannelCommand *cmd, QWSClient *client)
void invokeRegionName(const QWSRegionNameCommand *cmd, QWSClient *client)
QWSWindow * newWindow(int id, QWSClient *client)
QWSWindow * findWindow(int windowid, QWSClient *client=0)
static QBrush * bgBrush
void move_region(const QWSRegionMoveCommand *)
void invokeSetOpacity(const QWSSetOpacityCommand *cmd, QWSClient *client)
void sendMaxWindowRectEvents(const QRect &rect)
void handleWindowClose(QWSWindow *w)
void set_identity(const QWSIdentifyCommand *)
void lowerWindow(QWSWindow *, int=-1)
QWSSoundServer * soundserver
static const char * data(const QByteArray &arr)
QTimer * screensavertimer
void invokeConvertSelection(QWSConvertSelectionCommand *cmd)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void raiseWindow(QWSWindow *, int=0)
void clear()
Removes all items from the list.
Definition: qlist.h:764
void request_focus(const QWSRequestFocusCommand *)
QList< QWSCommandStruct * > commandQueue
void releaseMouse(QWSWindow *w)
void invokePositionCursor(QWSPositionCursorCommand *cmd, QWSClient *client)
void invokeCreate(QWSCreateCommand *cmd, QWSClient *client)
QList< QWSKeyboardHandler * > keyboardhandlers
void invokeGrabKeyboard(QWSGrabKeyboardCommand *cmd, QWSClient *client)
void invokeQCopSend(QWSQCopSendCommand *cmd, QWSClient *client)
QWSScreenSaver * saver
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
QRegion reserve_region(QWSWindow *window, const QRegion &region)
void invokeSelectCursor(QWSSelectCursorCommand *cmd, QWSClient *client)
void name_region(const QWSRegionNameCommand *)
void invokePlaySound(QWSPlaySoundCommand *cmd, QWSClient *client)
void dereferenceFont(QWSClientPrivate *client, const QByteArray &font)
QWSCursor * cursor
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
void invokeFont(const QWSFontCommand *cmd, QWSClient *client)
void releaseKeyboard(QWSWindow *w)
void doClient(QWSClient *)
void initServer(int flags)
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
void set_opacity(const QWSSetOpacityCommand *)
void invokeSetProperty(QWSSetPropertyCommand *cmd)
void invokeSetFocus(const QWSRequestFocusCommand *cmd, QWSClient *client)
QList< QWSWindow * > windows
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QWSServerSocket * ssocket
struct QWSServerPrivate::SelectionOwner::Time time
QList< QWSClient * > pendingDoClients
void invokeIdentify(const QWSIdentifyCommand *cmd, QWSClient *client)
const char * property
Definition: qwizard.cpp:138
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void sendFontRemovedEvent(const QByteArray &font)
QWSWindow * mouseGrabber
void destroy_region(const QWSRegionDestroyCommand *)
The QCopChannel class provides communication capabilities between clients in Qt for Embedded Linux...
quint16 index
void screenSave(int level)
void repaint_region(int winId, int windowFlags, bool opaque, const QRegion &)
void invokeSetAltitude(const QWSChangeAltitudeCommand *cmd, QWSClient *client)
bool get_property(int winId, int property, const char *&data, int &len)
The QBasicTimer class provides timer events for objects.
Definition: qbasictimer.h:55
struct QWSServerPrivate::SelectionOwner selectionOwner
QWSMouseHandler * newMouseHandler(const QString &spec)
static void emergency_cleanup()
QList< QWSWindow * > deletedWindows
The QTimer class provides repetitive and single-shot timers.
Definition: qtimer.h:56
QWSPropertyManager propertyManager
QMap< int, QWSClient * > ClientMap
void invokeRepaintRegion(QWSRepaintRegionCommand *cmd, QWSClient *client)
QMap< int, QWSClient * >::Iterator ClientIterator
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
Definition: qalgorithms.h:319
The QWSClient class encapsulates a client process in Qt for Embedded Linux.
static void sendKeyEventUnfiltered(int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat)
void setFocus(QWSWindow *, bool gain)
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67
void request_region(int winId, const QString &surfaceKey, const QByteArray &surfaceData, const QRegion &region)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
void send_im_mouse(const QWSIMMouseCommand *)
The QWSInputMethod class provides international input methods in Qt for Embedded Linux.
void setCursor(QWSCursor *curs)
void invokeScreenTransform(const QWSScreenTransformCommand *cmd, QWSClient *client)