| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qwindowsystem_qws.h:1 -->
|
|---|
| 3 | <html>
|
|---|
| 4 | <head>
|
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|---|
| 6 | <title>qwindowsystem_qws.h Include File</title>
|
|---|
| 7 | <style type="text/css"><!--
|
|---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
|---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
|---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
|---|
| 11 | body { background: #ffffff; color: black; }
|
|---|
| 12 | --></style>
|
|---|
| 13 | </head>
|
|---|
| 14 | <body>
|
|---|
| 15 |
|
|---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|---|
| 17 | <tr bgcolor="#E5E5E5">
|
|---|
| 18 | <td valign=center>
|
|---|
| 19 | <a href="index.html">
|
|---|
| 20 | <font color="#004faf">Home</font></a>
|
|---|
| 21 | | <a href="classes.html">
|
|---|
| 22 | <font color="#004faf">All Classes</font></a>
|
|---|
| 23 | | <a href="mainclasses.html">
|
|---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
|---|
| 25 | | <a href="annotated.html">
|
|---|
| 26 | <font color="#004faf">Annotated</font></a>
|
|---|
| 27 | | <a href="groups.html">
|
|---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
|---|
| 29 | | <a href="functions.html">
|
|---|
| 30 | <font color="#004faf">Functions</font></a>
|
|---|
| 31 | </td>
|
|---|
| 32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qwindowsystem_qws.h</h1>
|
|---|
| 33 |
|
|---|
| 34 | <p>This is the verbatim text of the qwindowsystem_qws.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
|---|
| 35 | <hr>
|
|---|
| 36 | <pre>
|
|---|
| 37 | /****************************************************************************
|
|---|
| 38 | ** $Id: qwindowsystem_qws-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
|---|
| 39 | **
|
|---|
| 40 | ** Definition of Qt/FB central server classes
|
|---|
| 41 | **
|
|---|
| 42 | ** Created : 991025
|
|---|
| 43 | **
|
|---|
| 44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
|---|
| 45 | **
|
|---|
| 46 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
|---|
| 47 | **
|
|---|
| 48 | ** This file may be distributed and/or modified under the terms of the
|
|---|
| 49 | ** GNU General Public License version 2 as published by the Free Software
|
|---|
| 50 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 51 | ** packaging of this file.
|
|---|
| 52 | **
|
|---|
| 53 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|---|
| 54 | ** licenses for Qt/Embedded may use this file in accordance with the
|
|---|
| 55 | ** Qt Embedded Commercial License Agreement provided with the Software.
|
|---|
| 56 | **
|
|---|
| 57 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|---|
| 58 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 59 | **
|
|---|
| 60 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|---|
| 61 | ** information about Qt Commercial License Agreements.
|
|---|
| 62 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|---|
| 63 | **
|
|---|
| 64 | ** Contact info@trolltech.com if any conditions of this licensing are
|
|---|
| 65 | ** not clear to you.
|
|---|
| 66 | **
|
|---|
| 67 | **********************************************************************/
|
|---|
| 68 |
|
|---|
| 69 | #ifndef QWINDOWSYSTEM_QWS_H
|
|---|
| 70 | #define QWINDOWSYSTEM_QWS_H
|
|---|
| 71 |
|
|---|
| 72 | #ifndef QT_H
|
|---|
| 73 | #include "qwssocket_qws.h"
|
|---|
| 74 | #include "qmap.h"
|
|---|
| 75 | #include "qdatetime.h"
|
|---|
| 76 | #include "qptrlist.h"
|
|---|
| 77 | #include "qimage.h"
|
|---|
| 78 |
|
|---|
| 79 | #include "qwsproperty_qws.h"
|
|---|
| 80 | #include "qwscommand_qws.h"
|
|---|
| 81 | #include "qwsevent_qws.h"
|
|---|
| 82 | #endif // QT_H
|
|---|
| 83 |
|
|---|
| 84 | #include "qkbd_qws.h"
|
|---|
| 85 |
|
|---|
| 86 | struct SWCursorData;
|
|---|
| 87 | class QWSCursor;
|
|---|
| 88 | class QWSClient;
|
|---|
| 89 | class QWSRegionManager;
|
|---|
| 90 | class QGfx;
|
|---|
| 91 | class QWSServerData;
|
|---|
| 92 |
|
|---|
| 93 | class QWSInternalWindowInfo
|
|---|
| 94 | {
|
|---|
| 95 |
|
|---|
| 96 | public:
|
|---|
| 97 |
|
|---|
| 98 | int winid;
|
|---|
| 99 | unsigned int clientid;
|
|---|
| 100 | QString name; // Corresponds to QObject name of top-level widget
|
|---|
| 101 |
|
|---|
| 102 | };
|
|---|
| 103 |
|
|---|
| 104 | struct QWSWindowData;
|
|---|
| 105 |
|
|---|
| 106 | class QWSScreenSaver
|
|---|
| 107 | {
|
|---|
| 108 | public:
|
|---|
| 109 | virtual ~QWSScreenSaver();
|
|---|
| 110 | virtual void restore()=0;
|
|---|
| 111 | virtual bool save(int level)=0;
|
|---|
| 112 | };
|
|---|
| 113 |
|
|---|
| 114 | class QWSWindow
|
|---|
| 115 | {
|
|---|
| 116 | friend class QWSServer;
|
|---|
| 117 | public:
|
|---|
| 118 | QWSWindow(int i, QWSClient* client);
|
|---|
| 119 | ~QWSWindow();
|
|---|
| 120 |
|
|---|
| 121 | int winId() const { return id; }
|
|---|
| 122 | const QString &name() const { return rgnName; }
|
|---|
| 123 | const QString &caption() const { return rgnCaption; }
|
|---|
| 124 | QWSClient* client() const { return c; }
|
|---|
| 125 | QRegion requested() const { return requested_region; }
|
|---|
| 126 | QRegion allocation() const { return allocated_region; }
|
|---|
| 127 | bool isVisible() const { return !requested_region.isEmpty(); }
|
|---|
| 128 | bool isPartiallyObscured() const { return requested_region!=allocated_region; }
|
|---|
| 129 | bool isFullyObscured() const { return allocated_region.isEmpty(); }
|
|---|
| 130 |
|
|---|
| 131 | void raise();
|
|---|
| 132 | void lower();
|
|---|
| 133 | void show();
|
|---|
| 134 | void hide();
|
|---|
| 135 | void setActiveWindow();
|
|---|
| 136 |
|
|---|
| 137 | private:
|
|---|
| 138 | bool hidden() const { return requested_region.isEmpty(); }
|
|---|
| 139 | bool forClient(const QWSClient* cl) const { return cl==c; }
|
|---|
| 140 |
|
|---|
| 141 | void setName( const QString &n );
|
|---|
| 142 | void setCaption( const QString &c );
|
|---|
| 143 |
|
|---|
| 144 | void addAllocation( QWSRegionManager *, const QRegion & );
|
|---|
| 145 | void removeAllocation( QWSRegionManager *, const QRegion & );
|
|---|
| 146 |
|
|---|
| 147 | int allocationIndex() const { return alloc_region_idx; }
|
|---|
| 148 | void setAllocationIndex( int i ) { alloc_region_idx = i; modified = TRUE; }
|
|---|
| 149 | void updateAllocation();
|
|---|
| 150 |
|
|---|
| 151 | void setNeedAck( bool n ) { needAck = n; }
|
|---|
| 152 |
|
|---|
| 153 | void focus(bool get);
|
|---|
| 154 | int focusPriority() const { return last_focus_time; }
|
|---|
| 155 | void operation( QWSWindowOperationEvent::Operation o );
|
|---|
| 156 | void shuttingDown() { last_focus_time=0; }
|
|---|
| 157 |
|
|---|
| 158 | private:
|
|---|
| 159 | int id;
|
|---|
| 160 | QString rgnName;
|
|---|
| 161 | QString rgnCaption;
|
|---|
| 162 | int alloc_region_idx;
|
|---|
| 163 | bool modified;
|
|---|
| 164 | bool needAck;
|
|---|
| 165 | bool onTop;
|
|---|
| 166 | QWSClient* c;
|
|---|
| 167 | QRegion requested_region;
|
|---|
| 168 | QRegion allocated_region;
|
|---|
| 169 | QRegion exposed;
|
|---|
| 170 | int last_focus_time;
|
|---|
| 171 | QWSWindowData *d;
|
|---|
| 172 | };
|
|---|
| 173 |
|
|---|
| 174 | #ifndef QT_NO_SOUND
|
|---|
| 175 | class QWSSoundServer;
|
|---|
| 176 | #ifdef QT_USE_OLD_QWS_SOUND
|
|---|
| 177 | class QWSSoundServerData;
|
|---|
| 178 |
|
|---|
| 179 | class QWSSoundServer : public QObject {
|
|---|
| 180 | Q_OBJECT
|
|---|
| 181 | public:
|
|---|
| 182 | QWSSoundServer(QObject* parent);
|
|---|
| 183 | ~QWSSoundServer();
|
|---|
| 184 | void playFile(const QString& filename);
|
|---|
| 185 | private slots:
|
|---|
| 186 | void feedDevice(int fd);
|
|---|
| 187 | private:
|
|---|
| 188 | QWSSoundServerData* d;
|
|---|
| 189 | };
|
|---|
| 190 | #endif
|
|---|
| 191 | #endif
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
|
|---|
| 199 | /*********************************************************************
|
|---|
| 200 | *
|
|---|
| 201 | * Class: QWSServer
|
|---|
| 202 | *
|
|---|
| 203 | *********************************************************************/
|
|---|
| 204 |
|
|---|
| 205 | class QWSMouseHandler;
|
|---|
| 206 | struct QWSCommandStruct;
|
|---|
| 207 |
|
|---|
| 208 | #ifndef QT_NO_QWS_MULTIPROCESS
|
|---|
| 209 | class QWSServer : public QWSServerSocket
|
|---|
| 210 | #else
|
|---|
| 211 | class QWSServer : public QObject
|
|---|
| 212 | #endif
|
|---|
| 213 | {
|
|---|
| 214 | friend class QCopChannel;
|
|---|
| 215 | friend class QWSMouseHandler;
|
|---|
| 216 | friend class QWSWindow;
|
|---|
| 217 | friend class QWSDisplay;
|
|---|
| 218 | friend class QWSInputMethod;
|
|---|
| 219 | Q_OBJECT
|
|---|
| 220 |
|
|---|
| 221 | public:
|
|---|
| 222 | QWSServer( int flags = 0, QObject *parent=0, const char *name=0 );
|
|---|
| 223 | ~QWSServer();
|
|---|
| 224 | enum ServerFlags { DisableKeyboard = 0x01,
|
|---|
| 225 | DisableMouse = 0x02 };
|
|---|
| 226 |
|
|---|
| 227 |
|
|---|
| 228 | enum GUIMode { NoGui = FALSE, NormalGUI = TRUE, Server };
|
|---|
| 229 |
|
|---|
| 230 | static void sendKeyEvent(int unicode, int keycode, int modifiers, bool isPress,
|
|---|
| 231 | bool autoRepeat);
|
|---|
| 232 | static void processKeyEvent(int unicode, int keycode, int modifiers, bool isPress,
|
|---|
| 233 | bool autoRepeat);
|
|---|
| 234 |
|
|---|
| 235 | #ifndef QT_NO_QWS_IM
|
|---|
| 236 | enum IMState { IMStart, IMCompose, IMEnd };
|
|---|
| 237 |
|
|---|
| 238 | void sendIMEvent( IMState state, const QString& txt, int cpos, int selLen );
|
|---|
| 239 | #endif
|
|---|
| 240 |
|
|---|
| 241 | #ifndef QT_NO_QWS_KEYBOARD
|
|---|
| 242 | typedef struct KeyMap {
|
|---|
| 243 | int key_code;
|
|---|
| 244 | ushort unicode;
|
|---|
| 245 | ushort shift_unicode;
|
|---|
| 246 | ushort ctrl_unicode;
|
|---|
| 247 | };
|
|---|
| 248 |
|
|---|
| 249 | typedef struct KeyOverride {
|
|---|
| 250 | ushort scan_code;
|
|---|
| 251 | KeyMap map;
|
|---|
| 252 | };
|
|---|
| 253 |
|
|---|
| 254 | static const KeyMap *keyMap();
|
|---|
| 255 |
|
|---|
| 256 | static void setOverrideKeys( const KeyOverride* );
|
|---|
| 257 |
|
|---|
| 258 | class KeyboardFilter
|
|---|
| 259 | {
|
|---|
| 260 | public:
|
|---|
| 261 | virtual bool filter(int unicode, int keycode, int modifiers,
|
|---|
| 262 | bool isPress, bool autoRepeat)=0;
|
|---|
| 263 | };
|
|---|
| 264 |
|
|---|
| 265 | static void setKeyboardFilter( KeyboardFilter *f );
|
|---|
| 266 | #endif
|
|---|
| 267 | #ifndef QT_NO_QWS_IM
|
|---|
| 268 | static void setCurrentInputMethod( QWSInputMethod *im );
|
|---|
| 269 | static void resetInputMethod();
|
|---|
| 270 | static void setMicroFocus( int x, int y );
|
|---|
| 271 | #endif
|
|---|
| 272 |
|
|---|
| 273 | static void setDefaultMouse( const char * );
|
|---|
| 274 | static void setDefaultKeyboard( const char * );
|
|---|
| 275 | static void setMaxWindowRect(const QRect&);
|
|---|
| 276 | static void sendMouseEvent(const QPoint& pos, int state);
|
|---|
| 277 |
|
|---|
| 278 | static void setDesktopBackground( const QImage &img );
|
|---|
| 279 | static void setDesktopBackground( const QColor & );
|
|---|
| 280 | static QWSMouseHandler *mouseHandler();
|
|---|
| 281 | static void setMouseHandler(QWSMouseHandler*);
|
|---|
| 282 | #ifndef QT_NO_QWS_KEYBOARD
|
|---|
| 283 | static QWSKeyboardHandler* keyboardHandler();
|
|---|
| 284 | static void setKeyboardHandler(QWSKeyboardHandler* kh);
|
|---|
| 285 | #endif
|
|---|
| 286 | QWSWindow *windowAt( const QPoint& pos );
|
|---|
| 287 |
|
|---|
| 288 | // For debugging only at this time
|
|---|
| 289 | const QPtrList<QWSWindow> &clientWindows() { return windows; }
|
|---|
| 290 |
|
|---|
| 291 | void openMouse();
|
|---|
| 292 | void closeMouse();
|
|---|
| 293 | #ifndef QT_NO_QWS_KEYBOARD
|
|---|
| 294 | void openKeyboard();
|
|---|
| 295 | void closeKeyboard();
|
|---|
| 296 | #endif
|
|---|
| 297 |
|
|---|
| 298 | static void setScreenSaver(QWSScreenSaver*);
|
|---|
| 299 | static void setScreenSaverIntervals(int* ms);
|
|---|
| 300 | static void setScreenSaverInterval(int);
|
|---|
| 301 | static bool screenSaverActive();
|
|---|
| 302 | static void screenSaverActivate(bool);
|
|---|
| 303 |
|
|---|
| 304 | // the following are internal.
|
|---|
| 305 | void refresh();
|
|---|
| 306 | void refresh(QRegion &);
|
|---|
| 307 |
|
|---|
| 308 | void enablePainting(bool);
|
|---|
| 309 | static void processEventQueue();
|
|---|
| 310 | static QPtrList<QWSInternalWindowInfo> * windowList();
|
|---|
| 311 |
|
|---|
| 312 | void sendPropertyNotifyEvent( int property, int state );
|
|---|
| 313 | #ifndef QT_NO_QWS_PROPERTIES
|
|---|
| 314 | QWSPropertyManager *manager() {
|
|---|
| 315 | return &propertyManager;
|
|---|
| 316 | }
|
|---|
| 317 | #endif
|
|---|
| 318 |
|
|---|
| 319 | static QPoint mousePosition;
|
|---|
| 320 |
|
|---|
| 321 | static void startup( int flags );
|
|---|
| 322 | static void closedown();
|
|---|
| 323 |
|
|---|
| 324 | static void beginDisplayReconfigure();
|
|---|
| 325 | static void endDisplayReconfigure();
|
|---|
| 326 |
|
|---|
| 327 | #ifndef QT_NO_QWS_CURSOR
|
|---|
| 328 | static void setCursorVisible( bool );
|
|---|
| 329 | static bool isCursorVisible();
|
|---|
| 330 | #endif
|
|---|
| 331 |
|
|---|
| 332 | enum WindowEvent { Create=0x0001, Destroy=0x0002, Hide=0x0004, Show=0x0008,
|
|---|
| 333 | Raise=0x0010, Lower=0x0020, Geometry=0x0040, Active = 0x0080,
|
|---|
| 334 | Name=0x0100 };
|
|---|
| 335 |
|
|---|
| 336 | signals:
|
|---|
| 337 | void windowEvent( QWSWindow *w, QWSServer::WindowEvent e );
|
|---|
| 338 |
|
|---|
| 339 | #ifndef QT_NO_COP
|
|---|
| 340 | void newChannel( const QString& channel);
|
|---|
| 341 | void removedChannel(const QString& channel);
|
|---|
| 342 |
|
|---|
| 343 | #endif
|
|---|
| 344 | private:
|
|---|
| 345 | #ifndef QT_NO_COP
|
|---|
| 346 | static void sendQCopEvent( QWSClient *c, const QCString &ch,
|
|---|
| 347 | const QCString &msg, const QByteArray &data,
|
|---|
| 348 | bool response = FALSE );
|
|---|
| 349 | #endif
|
|---|
| 350 | void move_region( const QWSRegionMoveCommand * );
|
|---|
| 351 | void set_altitude( const QWSChangeAltitudeCommand * );
|
|---|
| 352 | void request_focus( const QWSRequestFocusCommand * );
|
|---|
| 353 | void request_region( int, QRegion );
|
|---|
| 354 | void destroy_region( const QWSRegionDestroyCommand * );
|
|---|
| 355 | void name_region( const QWSRegionNameCommand * );
|
|---|
| 356 | void set_identity( const QWSIdentifyCommand * );
|
|---|
| 357 | #ifndef QT_NO_QWS_IM
|
|---|
| 358 | void set_micro_focus( const QWSSetMicroFocusCommand * );
|
|---|
| 359 | void reset_im( const QWSResetIMCommand * );
|
|---|
| 360 | static void sendKeyEventUnfiltered(int unicode, int keycode,
|
|---|
| 361 | int modifiers, bool isPress,
|
|---|
| 362 | bool autoRepeat);
|
|---|
| 363 |
|
|---|
| 364 | #endif
|
|---|
| 365 | static void emergency_cleanup();
|
|---|
| 366 |
|
|---|
| 367 | static QColor *bgColor;
|
|---|
| 368 | static QImage *bgImage;
|
|---|
| 369 |
|
|---|
| 370 | void sendMaxWindowRectEvents();
|
|---|
| 371 | #ifndef QT_NO_QWS_MULTIPROCESS
|
|---|
| 372 | void newConnection( int socket );
|
|---|
| 373 | #endif
|
|---|
| 374 | void invokeIdentify( const QWSIdentifyCommand *cmd, QWSClient *client );
|
|---|
| 375 | void invokeCreate( QWSCreateCommand *cmd, QWSClient *client );
|
|---|
| 376 | void invokeRegionName( const QWSRegionNameCommand *cmd, QWSClient *client );
|
|---|
| 377 | void invokeRegion( QWSRegionCommand *cmd, QWSClient *client );
|
|---|
| 378 | void invokeRegionMove( const QWSRegionMoveCommand *cmd, QWSClient *client );
|
|---|
| 379 | void invokeRegionDestroy( const QWSRegionDestroyCommand *cmd, QWSClient *client );
|
|---|
| 380 | void invokeSetAltitude( const QWSChangeAltitudeCommand *cmd, QWSClient *client );
|
|---|
| 381 | #ifndef QT_NO_QWS_PROPERTIES
|
|---|
| 382 | void invokeAddProperty( QWSAddPropertyCommand *cmd );
|
|---|
| 383 | void invokeSetProperty( QWSSetPropertyCommand *cmd );
|
|---|
| 384 | void invokeRemoveProperty( QWSRemovePropertyCommand *cmd );
|
|---|
| 385 | void invokeGetProperty( QWSGetPropertyCommand *cmd, QWSClient *client );
|
|---|
| 386 | #endif //QT_NO_QWS_PROPERTIES
|
|---|
| 387 | void invokeSetSelectionOwner( QWSSetSelectionOwnerCommand *cmd );
|
|---|
| 388 | void invokeConvertSelection( QWSConvertSelectionCommand *cmd );
|
|---|
| 389 | void invokeSetFocus( const QWSRequestFocusCommand *cmd, QWSClient *client );
|
|---|
| 390 |
|
|---|
| 391 | void initIO();
|
|---|
| 392 | void setFocus( QWSWindow*, bool gain );
|
|---|
| 393 | #ifndef QT_NO_QWS_CURSOR
|
|---|
| 394 | void invokeDefineCursor( QWSDefineCursorCommand *cmd, QWSClient *client );
|
|---|
| 395 | void invokeSelectCursor( QWSSelectCursorCommand *cmd, QWSClient *client );
|
|---|
| 396 | #endif
|
|---|
| 397 | void invokeGrabMouse( QWSGrabMouseCommand *cmd, QWSClient *client );
|
|---|
| 398 | void invokeGrabKeyboard( QWSGrabKeyboardCommand *cmd, QWSClient *client );
|
|---|
| 399 | #ifndef QT_NO_SOUND
|
|---|
| 400 | void invokePlaySound( QWSPlaySoundCommand *cmd, QWSClient *client );
|
|---|
| 401 | #endif
|
|---|
| 402 | #ifndef QT_NO_COP
|
|---|
| 403 | void invokeRegisterChannel( QWSQCopRegisterChannelCommand *cmd,
|
|---|
| 404 | QWSClient *client );
|
|---|
| 405 | void invokeQCopSend( QWSQCopSendCommand *cmd, QWSClient *client );
|
|---|
| 406 | #endif
|
|---|
| 407 | void invokeRepaintRegion( QWSRepaintRegionCommand *cmd,
|
|---|
| 408 | QWSClient *client );
|
|---|
| 409 | #ifndef QT_NO_QWS_IM
|
|---|
| 410 | void invokeSetMicroFocus( const QWSSetMicroFocusCommand *cmd,
|
|---|
| 411 | QWSClient *client );
|
|---|
| 412 | void invokeResetIM( const QWSResetIMCommand *cmd,
|
|---|
| 413 | QWSClient *client );
|
|---|
| 414 | #endif
|
|---|
| 415 |
|
|---|
| 416 | QWSMouseHandler* newMouseHandler(const QString& spec);
|
|---|
| 417 | void openDisplay();
|
|---|
| 418 | void closeDisplay();
|
|---|
| 419 |
|
|---|
| 420 | void showCursor();
|
|---|
| 421 | void hideCursor();
|
|---|
| 422 | void initializeCursor();
|
|---|
| 423 | void paintServerRegion();
|
|---|
| 424 | void paintBackground( const QRegion & );
|
|---|
| 425 | void clearRegion( const QRegion &r, const QColor &c );
|
|---|
| 426 | void refreshBackground();
|
|---|
| 427 | void resetGfx();
|
|---|
| 428 |
|
|---|
| 429 | private slots:
|
|---|
| 430 | #ifndef QT_NO_QWS_MULTIPROCESS
|
|---|
| 431 | void clientClosed();
|
|---|
| 432 | void doClient();
|
|---|
| 433 | void deleteWindowsLater();
|
|---|
| 434 | #endif
|
|---|
| 435 |
|
|---|
| 436 | void screenSaverWake();
|
|---|
| 437 | void screenSaverSleep();
|
|---|
| 438 | void screenSaverTimeout();
|
|---|
| 439 |
|
|---|
| 440 | private:
|
|---|
| 441 | void disconnectClient( QWSClient * );
|
|---|
| 442 | void screenSave(int level);
|
|---|
| 443 | void doClient( QWSClient * );
|
|---|
| 444 | typedef QMapIterator<int,QWSClient*> ClientIterator;
|
|---|
| 445 | typedef QMap<int,QWSClient*> ClientMap;
|
|---|
| 446 | void releaseMouse(QWSWindow* w);
|
|---|
| 447 | void releaseKeyboard(QWSWindow* w);
|
|---|
| 448 | void updateClientCursorPos();
|
|---|
| 449 |
|
|---|
| 450 | uchar* sharedram;
|
|---|
| 451 | int ramlen;
|
|---|
| 452 |
|
|---|
| 453 | QGfx *gfx;
|
|---|
| 454 |
|
|---|
| 455 | ClientMap client;
|
|---|
| 456 | #ifndef QT_NO_QWS_PROPERTIES
|
|---|
| 457 | QWSPropertyManager propertyManager;
|
|---|
| 458 | #endif
|
|---|
| 459 | struct SelectionOwner {
|
|---|
| 460 | int windowid;
|
|---|
| 461 | struct Time {
|
|---|
| 462 | void set( int h, int m, int s, int s2 ) {
|
|---|
| 463 | hour = h; minute = m; sec = s; ms = s2;
|
|---|
| 464 | }
|
|---|
| 465 | int hour, minute, sec, ms;
|
|---|
| 466 | } time;
|
|---|
| 467 | } selectionOwner;
|
|---|
| 468 | QTime timer;
|
|---|
| 469 | QWSServerData* d;
|
|---|
| 470 | int* screensaverinterval;
|
|---|
| 471 |
|
|---|
| 472 | QWSWindow *focusw;
|
|---|
| 473 | QWSWindow *mouseGrabber;
|
|---|
| 474 | bool mouseGrabbing;
|
|---|
| 475 | int swidth, sheight, sdepth;
|
|---|
| 476 | #ifndef QT_NO_QWS_CURSOR
|
|---|
| 477 | bool haveviscurs;
|
|---|
| 478 | QWSCursor *cursor; // cursor currently shown
|
|---|
| 479 | QWSCursor *nextCursor; // cursor to show once grabbing is off
|
|---|
| 480 | #endif
|
|---|
| 481 | QRegion screenRegion; // the entire display region
|
|---|
| 482 | QRegion serverRegion;
|
|---|
| 483 | QRegion dirtyBackground;
|
|---|
| 484 | bool disablePainting;
|
|---|
| 485 | QPtrList<QWSMouseHandler> mousehandlers;
|
|---|
| 486 | #ifndef QT_NO_QWS_KEYBOARD
|
|---|
| 487 | QPtrList<QWSKeyboardHandler> keyboardhandlers;
|
|---|
| 488 | #endif
|
|---|
| 489 |
|
|---|
| 490 | QPtrList<QWSCommandStruct> commandQueue;
|
|---|
| 491 | QWSRegionManager *rgnMan;
|
|---|
| 492 |
|
|---|
| 493 | // Window management
|
|---|
| 494 | QPtrList<QWSWindow> windows; // first=topmost
|
|---|
| 495 | QWSWindow* newWindow(int id, QWSClient* client);
|
|---|
| 496 | QWSWindow* findWindow(int windowid, QWSClient* client);
|
|---|
| 497 | void moveWindowRegion(QWSWindow*, int dx, int dy );
|
|---|
| 498 | QRegion setWindowRegion(QWSWindow*, QRegion r );
|
|---|
| 499 | void raiseWindow( QWSWindow *, int = 0);
|
|---|
| 500 | void lowerWindow( QWSWindow *, int = -1);
|
|---|
| 501 | void exposeRegion( QRegion , int index = 0 );
|
|---|
| 502 | void notifyModified( QWSWindow *active = 0 );
|
|---|
| 503 | void syncRegions( QWSWindow *active = 0 );
|
|---|
| 504 |
|
|---|
| 505 | void setCursor(QWSCursor *curs);
|
|---|
| 506 |
|
|---|
| 507 | // multimedia
|
|---|
| 508 | #ifndef QT_NO_SOUND
|
|---|
| 509 | QWSSoundServer *soundserver;
|
|---|
| 510 | #endif
|
|---|
| 511 | #ifndef QT_NO_COP
|
|---|
| 512 | QMap<QString, QPtrList<QWSClient> > channels;
|
|---|
| 513 | #endif
|
|---|
| 514 | #ifndef QT_NO_QWS_IM
|
|---|
| 515 | bool microF;
|
|---|
| 516 | int microX;
|
|---|
| 517 | int microY;
|
|---|
| 518 | #endif
|
|---|
| 519 | };
|
|---|
| 520 |
|
|---|
| 521 | extern QWSServer *qwsServer; //there can be only one
|
|---|
| 522 |
|
|---|
| 523 |
|
|---|
| 524 | #ifndef QT_NO_QWS_IM
|
|---|
| 525 | class QWSInputMethod
|
|---|
| 526 | {
|
|---|
| 527 | public:
|
|---|
| 528 | QWSInputMethod();
|
|---|
| 529 | virtual ~QWSInputMethod();
|
|---|
| 530 | virtual bool filter(int unicode, int keycode, int modifiers,
|
|---|
| 531 | bool isPress, bool autoRepeat)=0;
|
|---|
| 532 | virtual void reset();
|
|---|
| 533 | virtual void setMicroFocus( int x, int y );
|
|---|
| 534 | virtual void setFont( const QFont& );
|
|---|
| 535 | protected:
|
|---|
| 536 | void sendIMEvent( QWSServer::IMState, const QString& txt, int cpos, int selLen = 0 );
|
|---|
| 537 | //void sendKeyEvent( int unicode, int keycode, int modifiers,
|
|---|
| 538 | // bool isPress, bool autoRepeat);
|
|---|
| 539 | };
|
|---|
| 540 |
|
|---|
| 541 | inline void QWSInputMethod::sendIMEvent( QWSServer::IMState state, const QString &txt, int cpos, int selLen )
|
|---|
| 542 | {
|
|---|
| 543 | qwsServer->sendIMEvent( state, txt, cpos, selLen );
|
|---|
| 544 |
|
|---|
| 545 | }
|
|---|
| 546 |
|
|---|
| 547 |
|
|---|
| 548 | #endif
|
|---|
| 549 |
|
|---|
| 550 |
|
|---|
| 551 |
|
|---|
| 552 |
|
|---|
| 553 | /*********************************************************************
|
|---|
| 554 | *
|
|---|
| 555 | * Class: QWSClient
|
|---|
| 556 | *
|
|---|
| 557 | *********************************************************************/
|
|---|
| 558 |
|
|---|
| 559 | struct QWSMouseEvent;
|
|---|
| 560 |
|
|---|
| 561 | typedef QMap<int, QWSCursor*> QWSCursorMap;
|
|---|
| 562 |
|
|---|
| 563 | class QWSClient : public QObject
|
|---|
| 564 | {
|
|---|
| 565 | Q_OBJECT
|
|---|
| 566 | public:
|
|---|
| 567 | QWSClient( QObject* parent, int socket, int id );
|
|---|
| 568 | ~QWSClient();
|
|---|
| 569 |
|
|---|
| 570 | int socket() const;
|
|---|
| 571 |
|
|---|
| 572 | void setIdentity(const QString&);
|
|---|
| 573 | QString identity() const { return id; }
|
|---|
| 574 |
|
|---|
| 575 | void sendEvent( QWSEvent* event );
|
|---|
| 576 | void sendConnectedEvent( const char *display_spec );
|
|---|
| 577 | void sendMaxWindowRectEvent();
|
|---|
| 578 | void sendRegionModifyEvent( int winid, QRegion exposed, bool ack );
|
|---|
| 579 | void sendFocusEvent( int winid, bool get );
|
|---|
| 580 | void sendPropertyNotifyEvent( int property, int state );
|
|---|
| 581 | void sendPropertyReplyEvent( int property, int len, char *data );
|
|---|
| 582 | void sendSelectionClearEvent( int windowid );
|
|---|
| 583 | void sendSelectionRequestEvent( QWSConvertSelectionCommand *cmd, int windowid );
|
|---|
| 584 | QWSCommand* readMoreCommand();
|
|---|
| 585 |
|
|---|
| 586 | int clientId() const { return cid; }
|
|---|
| 587 |
|
|---|
| 588 | QWSCursorMap cursors; // cursors defined by this client
|
|---|
| 589 | signals:
|
|---|
| 590 | void connectionClosed();
|
|---|
| 591 | void readyRead();
|
|---|
| 592 | private slots:
|
|---|
| 593 | void closeHandler();
|
|---|
| 594 | void errorHandler( int );
|
|---|
| 595 | private:
|
|---|
| 596 | int s; // XXX csocket->d->socket->socket() is this value
|
|---|
| 597 | #ifndef QT_NO_QWS_MULTIPROCESS
|
|---|
| 598 | QWSSocket *csocket;
|
|---|
| 599 | #endif
|
|---|
| 600 | QWSCommand* command;
|
|---|
| 601 | uint isClosed : 1;
|
|---|
| 602 | QString id;
|
|---|
| 603 | int cid;
|
|---|
| 604 | };
|
|---|
| 605 |
|
|---|
| 606 | #endif // QWINDOWSYSTEM_QWS_H
|
|---|
| 607 | </pre>
|
|---|
| 608 | <!-- eof -->
|
|---|
| 609 | <p><address><hr><div align=center>
|
|---|
| 610 | <table width=100% cellspacing=0 border=0><tr>
|
|---|
| 611 | <td>Copyright © 2007
|
|---|
| 612 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|---|
| 613 | <td align=right><div align=right>Qt 3.3.8</div>
|
|---|
| 614 | </table></div></address></body>
|
|---|
| 615 | </html>
|
|---|