Qt 4.8
Classes | Public Functions | Public Variables | Private Types | Private Functions | Static Private Functions | Properties | Static Private Attributes | Friends | List of all members
QWSServerPrivate Class Reference

#include <qwindowsystem_p.h>

Inheritance diagram for QWSServerPrivate:
QObjectPrivate QObjectData

Classes

struct  SelectionOwner
 

Public Functions

 QWSServerPrivate ()
 
bool screensaverblockevent (int index, int *screensaverinterval, bool isDown)
 
void update_regions ()
 
 ~QWSServerPrivate ()
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

QList< int > crashedClientIds
 
QWSClientcursorClient
 
QList< QWSWindow * > deletedWindows
 
int mouseState
 
QWSScreenSaversaver
 
bool screensaverblockevents
 
int screensavereventblocklevel
 
int * screensaverintervals
 
QTime screensavertime
 
QTimerscreensavertimer
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Private Types

typedef QMap< int, QWSClient * >::Iterator ClientIterator
 
typedef QMap< int, QWSClient * > ClientMap
 

Private Functions

void _q_clientClosed ()
 
void _q_deleteWindowsLater ()
 
void _q_doClient ()
 
void _q_newConnection ()
 
void _q_screenSaverSleep ()
 
void _q_screenSaverTimeout ()
 
void _q_screenSaverWake ()
 
void cleanupFonts (bool force=false)
 
void closeDisplay ()
 
void dereferenceFont (QWSClientPrivate *client, const QByteArray &font)
 
void destroy_region (const QWSRegionDestroyCommand *)
 
void disconnectClient (QWSClient *)
 
void doClient (QWSClient *)
 
void exposeRegion (const QRegion &, int index=0)
 
QWSWindowfindWindow (int windowid, QWSClient *client=0)
 
bool get_property (int winId, int property, const char *&data, int &len)
 
void handleWindowClose (QWSWindow *w)
 
void hideCursor ()
 
void im_response (const QWSIMResponseCommand *)
 
void im_update (const QWSIMUpdateCommand *)
 
void initializeCursor ()
 
void initIO ()
 
void initServer (int flags)
 
void invokeAddProperty (QWSAddPropertyCommand *cmd)
 
void invokeConvertSelection (QWSConvertSelectionCommand *cmd)
 
void invokeCreate (QWSCreateCommand *cmd, QWSClient *client)
 
void invokeDefineCursor (QWSDefineCursorCommand *cmd, QWSClient *client)
 
void invokeEmbed (QWSEmbedCommand *cmd, QWSClient *client)
 
void invokeFont (const QWSFontCommand *cmd, QWSClient *client)
 
void invokeGetProperty (QWSGetPropertyCommand *cmd, QWSClient *client)
 
void invokeGrabKeyboard (QWSGrabKeyboardCommand *cmd, QWSClient *client)
 
void invokeGrabMouse (QWSGrabMouseCommand *cmd, QWSClient *client)
 
void invokeIdentify (const QWSIdentifyCommand *cmd, QWSClient *client)
 
void invokeIMResponse (const QWSIMResponseCommand *cmd, QWSClient *client)
 
void invokeIMUpdate (const QWSIMUpdateCommand *cmd, QWSClient *client)
 
void invokePlaySound (QWSPlaySoundCommand *cmd, QWSClient *client)
 
void invokePositionCursor (QWSPositionCursorCommand *cmd, QWSClient *client)
 
void invokeQCopSend (QWSQCopSendCommand *cmd, QWSClient *client)
 
void invokeRegion (QWSRegionCommand *cmd, QWSClient *client)
 
void invokeRegionDestroy (const QWSRegionDestroyCommand *cmd, QWSClient *client)
 
void invokeRegionMove (const QWSRegionMoveCommand *cmd, QWSClient *client)
 
void invokeRegionName (const QWSRegionNameCommand *cmd, QWSClient *client)
 
void invokeRegisterChannel (QWSQCopRegisterChannelCommand *cmd, QWSClient *client)
 
void invokeRemoveProperty (QWSRemovePropertyCommand *cmd)
 
void invokeRepaintRegion (QWSRepaintRegionCommand *cmd, QWSClient *client)
 
void invokeScreenTransform (const QWSScreenTransformCommand *cmd, QWSClient *client)
 
void invokeSelectCursor (QWSSelectCursorCommand *cmd, QWSClient *client)
 
void invokeSetAltitude (const QWSChangeAltitudeCommand *cmd, QWSClient *client)
 
void invokeSetFocus (const QWSRequestFocusCommand *cmd, QWSClient *client)
 
void invokeSetOpacity (const QWSSetOpacityCommand *cmd, QWSClient *client)
 
void invokeSetProperty (QWSSetPropertyCommand *cmd)
 
void invokeSetSelectionOwner (QWSSetSelectionOwnerCommand *cmd)
 
void lowerWindow (QWSWindow *, int=-1)
 
void move_region (const QWSRegionMoveCommand *)
 
void moveWindowRegion (QWSWindow *, int dx, int dy)
 
void name_region (const QWSRegionNameCommand *)
 
QWSMouseHandlernewMouseHandler (const QString &spec)
 
QWSWindownewWindow (int id, QWSClient *client)
 
void openDisplay ()
 
void raiseWindow (QWSWindow *, int=0)
 
void referenceFont (QWSClientPrivate *client, const QByteArray &font)
 
void releaseKeyboard (QWSWindow *w)
 
void releaseMouse (QWSWindow *w)
 
void repaint_region (int winId, int windowFlags, bool opaque, const QRegion &)
 
void request_focus (const QWSRequestFocusCommand *)
 
void request_region (int winId, const QString &surfaceKey, const QByteArray &surfaceData, const QRegion &region)
 
QRegion reserve_region (QWSWindow *window, const QRegion &region)
 
void resetEngine ()
 
void screenSave (int level)
 
void send_im_mouse (const QWSIMMouseCommand *)
 
void sendFontRemovedEvent (const QByteArray &font)
 
void sendMaxWindowRectEvents (const QRect &rect)
 
void set_altitude (const QWSChangeAltitudeCommand *)
 
void set_identity (const QWSIdentifyCommand *)
 
void set_opacity (const QWSSetOpacityCommand *)
 
void setCursor (QWSCursor *curs)
 
void setFocus (QWSWindow *, bool gain)
 
void setWindowRegion (QWSWindow *, const QRegion &r)
 Changes the requested region of window changingw to r If changingw is 0, the server's reserved region is changed. More...
 
void showCursor ()
 
void updateClientCursorPos ()
 

Static Private Functions

static void emergency_cleanup ()
 
static void sendKeyEventUnfiltered (int unicode, int keycode, Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat)
 
static void sendMouseEventUnfiltered (const QPoint &pos, int state, int wheel=0)
 
static void sendQCopEvent (QWSClient *c, const QString &ch, const QString &msg, const QByteArray &data, bool response=false)
 

Properties

QMap< QString, QList< QWSClient * > > channels
 
ClientMap clientMap
 
QList< QWSCommandStruct * > commandQueue
 
QWSCursorcursor
 
bool disablePainting
 
bool doClientIsActive
 
QWSWindowfocusw
 
QBasicTimer fontCleanupTimer
 
QMap< QByteArray, int > fontReferenceCount
 
bool haveviscurs
 
bool inputMethodMouseGrabbed
 
QList< QWSKeyboardHandler * > keyboardhandlers
 
QWSWindowmouseGrabber
 
bool mouseGrabbing
 
QList< QWSMouseHandler * > mousehandlers
 
QWSCursornextCursor
 
int nReserved
 
QList< QWSClient * > pendingDoClients
 
QWSPropertyManager propertyManager
 
int ramlen
 
int * screensaverinterval
 
int sdepth
 
struct QWSServerPrivate::SelectionOwner selectionOwner
 
ucharsharedram
 
int sheight
 
QWSSoundServer * soundserver
 
QWSServerSocketssocket
 
int swidth
 
QTime timer
 
QList< QWSWindow * > windows
 

Static Private Attributes

static QBrushbgBrush = 0
 

Friends

class QCopChannel
 
class QWSDisplay
 
class QWSInputMethod
 
class QWSMouseHandler
 
class QWSWindow
 

Additional Inherited Members

- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Detailed Description

Definition at line 66 of file qwindowsystem_p.h.

Typedefs

◆ ClientIterator

typedef QMap<int,QWSClient*>::Iterator QWSServerPrivate::ClientIterator
private

Definition at line 231 of file qwindowsystem_p.h.

◆ ClientMap

Definition at line 232 of file qwindowsystem_p.h.

Constructors and Destructors

◆ QWSServerPrivate()

QWSServerPrivate::QWSServerPrivate ( )
inline

Definition at line 75 of file qwindowsystem_p.h.

78  , saver(0), cursorClient(0), mouseState(0), nReserved(0)
79  , doClientIsActive(false)
80  {
81  }
QWSClient * cursorClient
QWSScreenSaver * saver

◆ ~QWSServerPrivate()

QWSServerPrivate::~QWSServerPrivate ( )
inline

Definition at line 82 of file qwindowsystem_p.h.

83  {
84  closeDisplay();
85 
87  delete [] screensaverintervals;
88  delete saver;
89 
91  windows.clear();
92 
93  delete bgBrush;
94  bgBrush = 0;
95  }
static QBrush * bgBrush
void clear()
Removes all items from the list.
Definition: qlist.h:764
QWSScreenSaver * saver
QList< QWSWindow * > windows
QList< QWSWindow * > deletedWindows
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
Definition: qalgorithms.h:319

Functions

◆ _q_clientClosed()

void QWSServerPrivate::_q_clientClosed ( )
private
Warning
This function is not part of the public interface.

Definition at line 1703 of file qwindowsystem_qws.cpp.

1704 {
1705  Q_Q(QWSServer);
1706  QWSClient* cl = (QWSClient*)q->sender();
1707 
1708  // Remove any queued commands for this client
1709  int i = 0;
1710  while (i < commandQueue.size()) {
1711  QWSCommandStruct *cs = commandQueue.at(i);
1712  if (cs->client == cl) {
1714  delete cs;
1715  } else {
1716  ++i;
1717  }
1718  }
1719 
1720 #ifndef QT_NO_COP
1721  // Enfore unsubscription from all channels.
1722  QCopChannel::detach(cl);
1723 #endif
1724 
1725  // Shut down all windows for this client
1726  for (int i = 0; i < windows.size(); ++i) {
1727  QWSWindow* w = windows.at(i);
1728  if (w->forClient(cl))
1729  w->shuttingDown();
1730  }
1731 
1732  // Delete all windows for this client
1733  QRegion exposed;
1734  i = 0;
1735  while (i < windows.size()) {
1736  QWSWindow* w = windows.at(i);
1737  if (w->forClient(cl)) {
1738  windows.takeAt(i);
1739  w->c = 0; //so we don't send events to it anymore
1740  releaseMouse(w);
1741  releaseKeyboard(w);
1742  exposed += w->allocatedRegion();
1743 // rgnMan->remove(w->allocationIndex());
1744  if (focusw == w)
1745  setFocus(focusw,0);
1746  if (mouseGrabber == w)
1747  releaseMouse(w);
1748  if (i < nReserved)
1749  --nReserved;
1750 #ifndef QT_NO_QWS_PROPERTIES
1752 #endif
1753  emit q->windowEvent(w, QWSServer::Destroy);
1754  w->d->state = QWSWindow::Destroyed; //???
1756  } else {
1757  ++i;
1758  }
1759  }
1760  if (deletedWindows.count())
1762 
1763  QWSClientPrivate *clientPrivate = cl->d_func();
1764  if (!clientPrivate->shutdown) {
1765 #if defined(QWS_DEBUG_FONTCLEANUP)
1766  qDebug() << "client" << cl->clientId() << "crashed";
1767 #endif
1768  // this would be the place to emit a signal to notify about the
1769  // crash of a client
1771  fontCleanupTimer.start(10, q_func());
1772  }
1773  clientPrivate->shutdown = true;
1774 
1775  while (!clientPrivate->usedFonts.isEmpty()) {
1776  const QByteArray font = *clientPrivate->usedFonts.begin();
1777 #if defined(QWS_DEBUG_FONTCLEANUP)
1778  qDebug() << "dereferencing font" << font << "from disconnected client";
1779 #endif
1780  dereferenceFont(clientPrivate, font);
1781  }
1782  clientPrivate->usedFonts.clear();
1783 
1784  //qDebug("removing client %d with socket %d", cl->clientId(), cl->socket());
1785  clientMap.remove(cl->socket());
1786  if (cl == cursorClient)
1787  cursorClient = 0;
1789  (qt_screen->clearCacheFunc)(qt_screen, cl->clientId()); // remove any remaining cache entries.
1790  cl->deleteLater();
1791 
1792  update_regions();
1793  exposeRegion(exposed);
1794 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
QList< int > crashedClientIds
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
bool isEmpty() const
Definition: qset.h:77
#define SLOT(a)
Definition: qobjectdefs.h:226
QSet< QByteArray > usedFonts
bool removeProperties(int winId)
QWSClient * cursorClient
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
static ClearCacheFunc clearCacheFunc
Definition: qscreen_qws.h:344
QWSWindow * focusw
QBasicTimer fontCleanupTimer
void exposeRegion(const QRegion &, int index=0)
iterator begin()
Definition: qset.h:166
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
Definition: qobject.cpp:2327
#define Q_Q(Class)
Definition: qglobal.h:2483
Q_CORE_EXPORT void qDebug(const char *,...)
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
int socket() const
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
void clear()
Definition: qset.h:87
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QList< QWSCommandStruct * > commandQueue
void releaseMouse(QWSWindow *w)
static void detach(QWSClient *cl)
Server side: unsubscribe cl from all channels.
QWSWindowPrivate * d
int remove(const Key &key)
Removes all the items that have the key key from the map.
Definition: qmap.h:662
void dereferenceFont(QWSClientPrivate *client, const QByteArray &font)
int winId() const
Returns the window&#39;s ID.
void releaseKeyboard(QWSWindow *w)
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
int clientId() const
Returns an integer uniquely identfying this client.
QList< QWSWindow * > windows
QWSClient * c
bool singleShot
This static function calls a slot after a given time interval.
Definition: qtimer.h:59
void shuttingDown()
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QWSWindow * mouseGrabber
T takeAt(int i)
Removes the item at index position i and returns it.
Definition: qlist.h:484
QWSWindow::State state
QList< QWSWindow * > deletedWindows
bool forClient(const QWSClient *cl) const
QWSPropertyManager propertyManager
The QWSClient class encapsulates a client process in Qt for Embedded Linux.
void deleteLater()
Schedules this object for deletion.
Definition: qobject.cpp:2145
void setFocus(QWSWindow *, bool gain)
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ _q_deleteWindowsLater()

void QWSServerPrivate::_q_deleteWindowsLater ( )
private

Definition at line 1796 of file qwindowsystem_qws.cpp.

1797 {
1800 }
void clear()
Removes all items from the list.
Definition: qlist.h:764
QList< QWSWindow * > deletedWindows
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
Definition: qalgorithms.h:319

◆ _q_doClient()

void QWSServerPrivate::_q_doClient ( )
private

Definition at line 1971 of file qwindowsystem_qws.cpp.

1972 {
1973  Q_Q(QWSServer);
1974 
1975  QWSClient* client;
1976 #ifndef QT_NO_SXE
1977  QAuthDevice *ad = qobject_cast<QAuthDevice*>(q->sender());
1978  if (ad)
1979  client = (QWSClient*)ad->client();
1980  else
1981 #endif
1982  client = (QWSClient*)q->sender();
1983 
1984  if (doClientIsActive) {
1985  pendingDoClients.append(client);
1986  return;
1987  }
1988  doClientIsActive = true;
1989 
1990  doClient(client);
1991 
1992  while (!pendingDoClients.isEmpty()) {
1994  }
1995 
1996  doClientIsActive = false;
1997 }
T qobject_cast(QObject *object)
Definition: qobject.h:375
QObject * client() const
Pass-through QIODevice sub-class for authentication.
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
Definition: qobject.cpp:2327
#define Q_Q(Class)
Definition: qglobal.h:2483
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
T takeFirst()
Removes the first item in the list and returns it.
Definition: qlist.h:489
void doClient(QWSClient *)
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QList< QWSClient * > pendingDoClients
The QWSClient class encapsulates a client process in Qt for Embedded Linux.

◆ _q_newConnection()

void QWSServerPrivate::_q_newConnection ( )
private
Warning
This function is not part of the public interface.

Definition at line 1637 of file qwindowsystem_qws.cpp.

1638 {
1639  Q_Q(QWSServer);
1640  while (QWS_SOCK_BASE *sock = ssocket->nextPendingConnection()) {
1641  int socket = sock->socketDescriptor();
1642  sock->setParent(0);
1643 
1644  QWSClient *client = new QWSClient(q,sock, get_object_id());
1645  clientMap[socket] = client;
1646 
1647 #ifndef QT_NO_SXE
1648 #ifdef QTRANSPORTAUTH_DEBUG
1649  qDebug( "Transport auth connected: unix stream socket %d", socket );
1650 #endif
1651  // get a handle to the per-process authentication service
1653 
1654  // assert that this transport is trusted
1657  QTransportAuth::Trusted, socket );
1658 
1659  QAuthDevice *ad = a->recvBuf( d, sock );
1660  ad->setClient(client);
1661 
1662  QObject::connect(ad, SIGNAL(readyRead()),
1663  q, SLOT(_q_doClient()));
1664 
1665  QObject::connect(client, SIGNAL(connectionClosed()),
1666  q, SLOT(_q_clientClosed()));
1667 #else
1668  QObject::connect(client, SIGNAL(readyRead()),
1669  q, SLOT(_q_doClient()));
1670  QObject::connect(client, SIGNAL(connectionClosed()),
1671  q, SLOT(_q_clientClosed()));
1672 #endif // QT_NO_SXE
1673 
1675 
1676  if (clientMap.contains(socket)) {
1677  QList<QScreen*> screens = qt_screen->subScreens();
1678  if (screens.isEmpty())
1679  screens.append(qt_screen);
1680  for (int i = 0; i < screens.size(); ++i) {
1682  QScreen *screen = screens.at(i);
1683  const QRect rect = ap->maxWindowRect(screen);
1684  if (!rect.isEmpty())
1685  client->sendMaxWindowRectEvent(rect);
1686  if (screen->isTransformed()) {
1688  event.simpleData.screen = i;
1689  event.simpleData.transformation = screen->transformOrientation();
1690  client->sendEvent(&event);
1691  }
1692  }
1693  }
1694 
1695  // pre-provide some object id's
1696  QWSCreateCommand cmd(30);
1697  invokeCreate(&cmd, client);
1698  }
1699 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
void sendEvent(QWSEvent *event)
double d
Definition: qnumeric_p.h:62
QRect maxWindowRect(const QScreen *screen) const
EventRef event
QTransportAuth::Data * connectTransport(unsigned char, int)
Record a new transport connection with properties and descriptor.
#define SLOT(a)
Definition: qobjectdefs.h:226
Pass-through QIODevice sub-class for authentication.
static QApplicationPrivate * instance()
long ASN1_INTEGER_get ASN1_INTEGER * a
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
#define Q_Q(Class)
Definition: qglobal.h:2483
Q_CORE_EXPORT void qDebug(const char *,...)
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void sendMaxWindowRectEvent(const QRect &rect)
QAuthDevice * recvBuf(QTransportAuth::Data *, QIODevice *)
Return a QIODevice pointer (to an internal QBuffer) which can be used to receive data after authoriza...
void invokeCreate(QWSCreateCommand *cmd, QWSClient *client)
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
QByteArray qws_display_spec
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
#define QWS_SOCK_BASE
Definition: qwsutils_qws.h:54
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
virtual bool isTransformed() const
Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false...
QWSServerSocket * ssocket
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
void setClient(QObject *)
bool contains(const Key &key) const
Returns true if the map contains an item with key key; otherwise returns false.
Definition: qmap.h:553
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
virtual int transformOrientation() const
Returns the current rotation as an integer value.
void sendConnectedEvent(const char *display_spec)
Authenticate a message transport.
static int get_object_id(int count=1)
The QWSClient class encapsulates a client process in Qt for Embedded Linux.
static QTransportAuth * getInstance()
Return a pointer to the instance of this process&#39;s QTransportAuth object.
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QWSSocket * nextPendingConnection()

◆ _q_screenSaverSleep()

void QWSServerPrivate::_q_screenSaverSleep ( )
private

Definition at line 4448 of file qwindowsystem_qws.cpp.

Referenced by QWSServer::screenSaverActivate().

4449 {
4450  qt_screen->blank(true);
4451 #if !defined(QT_QWS_IPAQ) && !defined(QT_QWS_EBX)
4453 #else
4454  if (screensaverinterval) {
4457  } else {
4459  }
4460 #endif
4462 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
void start()
Sets this time to the current time.
Definition: qdatetime.cpp:2070
bool qt_disable_lowpriority_timers
QTimer * screensavertimer
virtual void blank(bool on)
Prevents the screen driver form displaying any content on the screen.
void stop()
Stops the timer.
Definition: qtimer.cpp:284
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
Definition: qtimer.cpp:249

◆ _q_screenSaverTimeout()

void QWSServerPrivate::_q_screenSaverTimeout ( )
private

Definition at line 4523 of file qwindowsystem_qws.cpp.

4524 {
4525  if (screensaverinterval) {
4527  // bogus (eg. unsuspend, system time changed)
4528  _q_screenSaverWake(); // try again
4529  return;
4530  }
4532  }
4533 }
int elapsed() const
Returns the number of milliseconds that have elapsed since the last time start() or restart() was cal...
Definition: qdatetime.cpp:2123
void screenSave(int level)

◆ _q_screenSaverWake()

void QWSServerPrivate::_q_screenSaverWake ( )
private

Definition at line 4429 of file qwindowsystem_qws.cpp.

Referenced by QWSServer::processKeyEvent(), QWSServer::screenSaverActivate(), QWSServer::sendKeyEvent(), QWSServer::sendMouseEvent(), and QWSServer::setScreenSaverIntervals().

4430 {
4431  if (screensaverintervals) {
4433  if (saver) saver->restore();
4435  screensaverblockevents = false;
4436  } else {
4437  if (!screensavertimer->isActive()) {
4438  qt_screen->blank(false);
4439  if (saver) saver->restore();
4440  }
4441  }
4444  }
4446 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
void start()
Sets this time to the current time.
Definition: qdatetime.cpp:2070
bool qt_disable_lowpriority_timers
virtual void restore()=0
Implement this function to deactivate the screensaver, restoring the previously saved screen...
QTimer * screensavertimer
bool isActive() const
Returns true if the timer is running (pending); otherwise returns false.
Definition: qtimer.h:69
QWSScreenSaver * saver
virtual void blank(bool on)
Prevents the screen driver form displaying any content on the screen.
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
Definition: qtimer.cpp:249

◆ cleanupFonts()

void QWSServerPrivate::cleanupFonts ( bool  force = false)
private

Definition at line 1849 of file qwindowsystem_qws.cpp.

1850 {
1851  static bool dontDelete = !qgetenv("QWS_KEEP_FONTS").isEmpty();
1852  if (dontDelete)
1853  return;
1854 
1855 #if defined(QWS_DEBUG_FONTCLEANUP)
1856  qDebug() << "cleanupFonts()";
1857 #endif
1858  if (!fontReferenceCount.isEmpty()) {
1860  while (it != fontReferenceCount.end()) {
1861  if (it.value() && !force) {
1862  ++it;
1863  continue;
1864  }
1865 
1866  const QByteArray &fontName = it.key();
1867 #if defined(QWS_DEBUG_FONTCLEANUP)
1868  qDebug() << "removing unused font file" << fontName;
1869 #endif
1870  QT_TRY {
1871  QFile::remove(QFile::decodeName(fontName));
1872  sendFontRemovedEvent(fontName);
1873 
1874  it = fontReferenceCount.erase(it);
1875  } QT_CATCH(...) {
1876  // so we were not able to remove the font.
1877  // don't be angry and just continue with the next ones.
1878  ++it;
1879  }
1880  }
1881  }
1882 
1883  if (crashedClientIds.isEmpty())
1884  return;
1885 
1886  QList<QByteArray> removedFonts;
1887 #if !defined(QT_NO_QWS_QPF2) && !defined(QT_FONTS_ARE_RESOURCES)
1889 #endif
1891 
1892  for (int i = 0; i < removedFonts.count(); ++i)
1893  sendFontRemovedEvent(removedFonts.at(i));
1894 }
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QList< int > crashedClientIds
const Key key(const T &value) const
Returns the first key with value value.
Definition: qmap.h:844
#define it(className, varName)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QMap< QByteArray, int > fontReferenceCount
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
static QString decodeName(const QByteArray &localFileName)
This does the reverse of QFile::encodeName() using localFileName.
Definition: qfile.cpp:552
Q_CORE_EXPORT void qDebug(const char *,...)
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static QList< QByteArray > cleanUpAfterClientCrash(const QList< int > &crashedClientIds)
void clear()
Removes all items from the list.
Definition: qlist.h:764
#define QT_CATCH(A)
Definition: qglobal.h:1537
iterator begin()
Returns an STL-style iterator pointing to the first item in the map.
Definition: qmap.h:372
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:375
bool isEmpty() const
Returns true if the map contains no items; otherwise returns false.
Definition: qmap.h:203
void sendFontRemovedEvent(const QByteArray &font)
bool remove()
Removes the file specified by fileName().
Definition: qfile.cpp:715
iterator erase(iterator it)
Removes the (key, value) pair pointed to by the iterator pos from the map, and returns an iterator to...
Definition: qmap.h:717
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
Definition: qbytearray.h:421
#define QT_TRY
Definition: qglobal.h:1536
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67

◆ closeDisplay()

void QWSServerPrivate::closeDisplay ( )
private

Definition at line 4101 of file qwindowsystem_qws.cpp.

Referenced by ~QWSServerPrivate().

4102 {
4103  if (qt_screen)
4105 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
virtual void shutdownDevice()
This function is called by the Qt for Embedded Linux server before it calls the disconnect() function...

◆ dereferenceFont()

void QWSServerPrivate::dereferenceFont ( QWSClientPrivate client,
const QByteArray font 
)
private

Definition at line 1817 of file qwindowsystem_qws.cpp.

1818 {
1819  if (client->usedFonts.contains(font)) {
1820  client->usedFonts.remove(font);
1821 
1823  if (!--fontReferenceCount[font] && !fontCleanupTimer.isActive())
1824  fontCleanupTimer.start(FontCleanupInterval, q_func());
1825 
1826 #if defined(QWS_DEBUG_FONTCLEANUP)
1827  qDebug() << "Client" << client->q_func()->clientId() << "removed font" << font;
1828  qDebug() << "Refcount is" << fontReferenceCount[font];
1829 #endif
1830  }
1831 }
bool remove(const T &value)
Definition: qset.h:89
QSet< QByteArray > usedFonts
bool isActive() const
Returns true if the timer is running and has not been stopped; otherwise returns false.
Definition: qbasictimer.h:62
QMap< QByteArray, int > fontReferenceCount
QBasicTimer fontCleanupTimer
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Q_CORE_EXPORT void qDebug(const char *,...)
bool contains(const T &value) const
Definition: qset.h:91
void start(int msec, QObject *obj)
Starts (or restarts) the timer with a msec milliseconds timeout.

◆ destroy_region()

void QWSServerPrivate::destroy_region ( const QWSRegionDestroyCommand cmd)
private

Definition at line 4064 of file qwindowsystem_qws.cpp.

4065 {
4067 }
void invokeRegionDestroy(const QWSRegionDestroyCommand *cmd, QWSClient *client)
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499

◆ disconnectClient()

void QWSServerPrivate::disconnectClient ( QWSClient c)
private

Definition at line 4573 of file qwindowsystem_qws.cpp.

4574 {
4575  QTimer::singleShot(0, c, SLOT(closeHandler()));
4576 }
#define SLOT(a)
Definition: qobjectdefs.h:226
bool singleShot
This static function calls a slot after a given time interval.
Definition: qtimer.h:59

◆ doClient()

void QWSServerPrivate::doClient ( QWSClient client)
private

Definition at line 2000 of file qwindowsystem_qws.cpp.

Referenced by QWSServer::processEventQueue().

2001 {
2002  QWSCommand* command=client->readMoreCommand();
2003 
2004  while (command) {
2005  QWSCommandStruct *cs = new QWSCommandStruct(command, client);
2006  commandQueue.append(cs);
2007  // Try for some more...
2008  command=client->readMoreCommand();
2009  }
2010 
2011  while (!commandQueue.isEmpty()) {
2013  switch (cs->command->type) {
2014  case QWSCommand::Identify:
2016  break;
2017  case QWSCommand::Create:
2019  break;
2020 #ifndef QT_NO_QWS_MULTIPROCESS
2021  case QWSCommand::Shutdown:
2022  cs->client->d_func()->shutdown = true;
2023  break;
2024 #endif
2027  break;
2028  case QWSCommand::Region:
2030  cs->client->d_func()->unlockCommunication();
2031  break;
2034  cs->client->d_func()->unlockCommunication();
2035  break;
2038  break;
2039 #ifndef QT_NO_QWS_PROPERTIES
2042  break;
2045  break;
2048  break;
2051  break;
2052 #endif
2055  break;
2058  break;
2061  cs->client);
2062  cs->client->d_func()->unlockCommunication();
2063  break;
2066  cs->client);
2067  break;
2068 
2069 #ifndef QT_NO_QWS_CURSOR
2072  break;
2075  break;
2078  break;
2079 #endif
2080  case QWSCommand::GrabMouse:
2082  break;
2085  break;
2086 #if !defined(QT_NO_SOUND) && !defined(Q_OS_DARWIN)
2087  case QWSCommand::PlaySound:
2089  break;
2090 #endif
2091 #ifndef QT_NO_COP
2094  cs->client);
2095  break;
2096  case QWSCommand::QCopSend:
2098  break;
2099 #endif
2100 #ifndef QT_NO_QWS_INPUTMETHODS
2101  case QWSCommand::IMUpdate:
2103  break;
2106  break;
2107  case QWSCommand::IMMouse:
2108  {
2109  if (current_IM) {
2112  cmd->simpleData.state);
2113  }
2114  }
2115  break;
2116 #endif
2117  case QWSCommand::Font:
2118  invokeFont((QWSFontCommand *)cs->command, cs->client);
2119  break;
2122  cs->client);
2123  cs->client->d_func()->unlockCommunication();
2124  break;
2125 #ifndef QT_NO_QWSEMBEDWIDGET
2126  case QWSCommand::Embed:
2127  invokeEmbed(static_cast<QWSEmbedCommand*>(cs->command),
2128  cs->client);
2129  break;
2130 #endif
2132  invokeScreenTransform(static_cast<QWSScreenTransformCommand*>(cs->command),
2133  cs->client);
2134  break;
2135  }
2136  delete cs;
2137  }
2138 }
void invokeIMUpdate(const QWSIMUpdateCommand *cmd, QWSClient *client)
void invokeRegionMove(const QWSRegionMoveCommand *cmd, QWSClient *client)
void invokeGetProperty(QWSGetPropertyCommand *cmd, QWSClient *client)
void invokeAddProperty(QWSAddPropertyCommand *cmd)
void invokeRemoveProperty(QWSRemovePropertyCommand *cmd)
void invokeIMResponse(const QWSIMResponseCommand *cmd, QWSClient *client)
void invokeGrabMouse(QWSGrabMouseCommand *cmd, QWSClient *client)
struct QWSIMMouseCommand::SimpleData simpleData
void invokeDefineCursor(QWSDefineCursorCommand *cmd, QWSClient *client)
QWSCommand * readMoreCommand()
void invokeEmbed(QWSEmbedCommand *cmd, QWSClient *client)
static QWSInputMethod * current_IM
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
void invokeSetSelectionOwner(QWSSetSelectionOwnerCommand *cmd)
virtual void mouseHandler(int pos, int state)
Handles mouse events within the preedit text.
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void invokeRegion(QWSRegionCommand *cmd, QWSClient *client)
void invokeRegionDestroy(const QWSRegionDestroyCommand *cmd, QWSClient *client)
void invokeRegisterChannel(QWSQCopRegisterChannelCommand *cmd, QWSClient *client)
void invokeRegionName(const QWSRegionNameCommand *cmd, QWSClient *client)
void invokeSetOpacity(const QWSSetOpacityCommand *cmd, QWSClient *client)
QList< QWSCommandStruct * > commandQueue
void invokePositionCursor(QWSPositionCursorCommand *cmd, QWSClient *client)
void invokeCreate(QWSCreateCommand *cmd, QWSClient *client)
void invokeGrabKeyboard(QWSGrabKeyboardCommand *cmd, QWSClient *client)
void invokeQCopSend(QWSQCopSendCommand *cmd, QWSClient *client)
void invokeSelectCursor(QWSSelectCursorCommand *cmd, QWSClient *client)
void invokePlaySound(QWSPlaySoundCommand *cmd, QWSClient *client)
void invokeFont(const QWSFontCommand *cmd, QWSClient *client)
void invokeSetProperty(QWSSetPropertyCommand *cmd)
void invokeSetFocus(const QWSRequestFocusCommand *cmd, QWSClient *client)
void invokeIdentify(const QWSIdentifyCommand *cmd, QWSClient *client)
T takeAt(int i)
Removes the item at index position i and returns it.
Definition: qlist.h:484
void invokeSetAltitude(const QWSChangeAltitudeCommand *cmd, QWSClient *client)
void invokeRepaintRegion(QWSRepaintRegionCommand *cmd, QWSClient *client)
void invokeScreenTransform(const QWSScreenTransformCommand *cmd, QWSClient *client)

◆ emergency_cleanup()

void QWSServerPrivate::emergency_cleanup ( )
staticprivate

Definition at line 4219 of file qwindowsystem_qws.cpp.

4220 {
4221 #ifndef QT_NO_QWS_KEYBOARD
4222  if (qwsServer)
4224 #endif
4225 }
void closeKeyboard()
Closes all the keyboard devices (specified by the QWS_KEYBOARD environment variable) by deleting the ...
QWSServer Q_GUI_EXPORT * qwsServer

◆ exposeRegion()

void QWSServerPrivate::exposeRegion ( const QRegion r,
int  index = 0 
)
private

Definition at line 3701 of file qwindowsystem_qws.cpp.

3702 {
3703  if (disablePainting)
3704  return;
3705 
3706  if (r.isEmpty())
3707  return;
3708 
3709  static bool initial = true;
3710  if (initial) {
3711  changing = 0;
3712  initial = false;
3713  qt_screen->exposeRegion(qt_screen->region(), changing);
3714  } else {
3715  qt_screen->exposeRegion(r, changing);
3716  }
3717 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
virtual QRegion region() const
Returns the region covered by this screen driver.
Definition: qscreen_qws.h:284
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
virtual void exposeRegion(QRegion r, int changing)
This function is called by the Qt for Embedded Linux server whenever a screen update is required...

◆ findWindow()

QWSWindow * QWSServerPrivate::findWindow ( int  windowid,
QWSClient client = 0 
)
private

Definition at line 3471 of file qwindowsystem_qws.cpp.

3472 {
3473  for (int i=0; i<windows.size(); ++i) {
3474  QWSWindow* w = windows.at(i);
3475  if (w->winId() == windowid)
3476  return w;
3477  }
3478  if (client)
3479  return newWindow(windowid,client);
3480  else
3481  return 0;
3482 }
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * newWindow(int id, QWSClient *client)
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int winId() const
Returns the window&#39;s ID.
QList< QWSWindow * > windows
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ get_property()

bool QWSServerPrivate::get_property ( int  winId,
int  property,
const char *&  data,
int &  len 
)
private

Definition at line 3173 of file qwindowsystem_qws.cpp.

3174 {
3175  return propertyManager.getProperty(winId, property, data, len);
3176 }
static const char * data(const QByteArray &arr)
const char * property
Definition: qwizard.cpp:138
bool getProperty(int winId, int property, const char *&data, int &len)
QWSPropertyManager propertyManager

◆ handleWindowClose()

void QWSServerPrivate::handleWindowClose ( QWSWindow w)
private

Definition at line 1621 of file qwindowsystem_qws.cpp.

1622 {
1623  w->shuttingDown();
1624  if (focusw == w)
1625  setFocus(w,false);
1626  if (mouseGrabber == w)
1627  releaseMouse(w);
1628  if (keyboardGrabber == w)
1629  releaseKeyboard(w);
1630 }
QWSWindow * focusw
void releaseMouse(QWSWindow *w)
void releaseKeyboard(QWSWindow *w)
void shuttingDown()
QWSWindow * mouseGrabber
static QWSWindow * keyboardGrabber
void setFocus(QWSWindow *, bool gain)

◆ hideCursor()

void QWSServerPrivate::hideCursor ( )
private

Definition at line 2149 of file qwindowsystem_qws.cpp.

2150 {
2151 #ifndef QT_NO_QWS_CURSOR
2152  if (qt_screencursor)
2153  qt_screencursor->hide();
2154 #endif
2155 }
virtual void hide()
Hides the cursor from the screen.
Q_GUI_EXPORT QScreenCursor * qt_screencursor
Definition: qscreen_qws.cpp:67

◆ im_response()

void QWSServerPrivate::im_response ( const QWSIMResponseCommand cmd)
private

Definition at line 4075 of file qwindowsystem_qws.cpp.

4076  {
4077  invokeIMResponse(cmd, clientMap.value(-1));
4078 }
void invokeIMResponse(const QWSIMResponseCommand *cmd, QWSClient *client)
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499

◆ im_update()

void QWSServerPrivate::im_update ( const QWSIMUpdateCommand cmd)
private

Definition at line 4080 of file qwindowsystem_qws.cpp.

4081 {
4082  invokeIMUpdate(cmd, clientMap.value(-1));
4083 }
void invokeIMUpdate(const QWSIMUpdateCommand *cmd, QWSClient *client)
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499

◆ initializeCursor()

void QWSServerPrivate::initializeCursor ( )
private

Definition at line 338 of file qwscursor_qws.cpp.

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;
348 #endif
349  q->sendMouseEvent(QPoint(swidth/2, sheight/2), 0);
350 }
static QWSCursor * systemCursor(int id)
#define Q_Q(Class)
Definition: qglobal.h:2483
QWSCursor * cursor
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
void setCursor(QWSCursor *curs)

◆ initIO()

void QWSServerPrivate::initIO ( )
private

◆ initServer()

void QWSServerPrivate::initServer ( int  flags)
private

Definition at line 1466 of file qwindowsystem_qws.cpp.

1467 {
1468  Q_Q(QWSServer);
1469  Q_ASSERT(!qwsServer);
1470  qwsServer = q;
1471  qwsServerPrivate = this;
1472  disablePainting = false;
1473 #ifndef QT_NO_QWS_MULTIPROCESS
1475  QObject::connect(ssocket, SIGNAL(newConnection()), q, SLOT(_q_newConnection()));
1476 
1477  if ( !ssocket->isListening()) {
1478  perror("QWSServerPrivate::initServer: server socket not listening");
1479  qFatal("Failed to bind to %s", qws_qtePipeFilename().toLatin1().constData());
1480  }
1481 
1482  struct linger tmp;
1483  tmp.l_onoff=1;
1484  tmp.l_linger=0;
1485  setsockopt(ssocket->socketDescriptor(),SOL_SOCKET,SO_LINGER,(char *)&tmp,sizeof(tmp));
1486 
1487 
1488  signal(SIGPIPE, ignoreSignal); //we get it when we read
1489 #endif
1490  focusw = 0;
1491  mouseGrabber = 0;
1492  mouseGrabbing = false;
1493  inputMethodMouseGrabbed = false;
1494  keyboardGrabber = 0;
1495  keyboardGrabbing = false;
1496 #ifndef QT_NO_QWS_CURSOR
1497  haveviscurs = false;
1498  cursor = 0;
1499  nextCursor = 0;
1500 #endif
1501 
1502 #ifndef QT_NO_QWS_MULTIPROCESS
1503 
1504  if (!geteuid()) {
1505 #if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
1506  if(mount(0,"/var/shm", "shm", 0, 0)) {
1507  /* This just confuses people with 2.2 kernels
1508  if (errno != EBUSY)
1509  qDebug("Failed mounting shm fs on /var/shm: %s",strerror(errno));
1510  */
1511  }
1512 #endif
1513  }
1514 #endif
1515 
1516  // no selection yet
1517  selectionOwner.windowid = -1;
1518  selectionOwner.time.set(-1, -1, -1, -1);
1519 
1520  cleanupFontsDir();
1521 
1522  // initialize the font database
1523  // from qfontdatabase_qws.cpp
1524  extern void qt_qws_init_fontdb();
1526 
1527  openDisplay();
1528 
1529  screensavertimer = new QTimer(q);
1533 
1534  clientMap[-1] = new QWSClient(q, 0, 0);
1535 
1536  if (!bgBrush)
1537  bgBrush = new QBrush(QColor(0x20, 0xb0, 0x50));
1538 
1539  initializeCursor();
1540 
1541  // input devices
1542  if (!(flags&QWSServer::DisableMouse)) {
1543  q->openMouse();
1544  }
1545 #ifndef QT_NO_QWS_KEYBOARD
1546  if (!(flags&QWSServer::DisableKeyboard)) {
1547  q->openKeyboard();
1548  }
1549 #endif
1550 
1551 #if !defined(QT_NO_SOUND) && !defined(QT_EXTERNAL_SOUND_SERVER) && !defined(Q_OS_DARWIN)
1552  soundserver = new QWSSoundServer(q);
1553 #endif
1554 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void setSingleShot(bool singleShot)
Definition: qtimer.h:108
QWSCursor * nextCursor
#define SLOT(a)
Definition: qobjectdefs.h:226
QWSWindow * focusw
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_Q(Class)
Definition: qglobal.h:2483
void set(int h, int m, int s, int s2)
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool keyboardGrabbing
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
static QBrush * bgBrush
void qt_qws_init_fontdb()
QWSSoundServer * soundserver
QString qws_qtePipeFilename()
QTimer * screensavertimer
static void cleanupFontsDir()
static QWSServerPrivate * qwsServerPrivate
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
Q_CORE_EXPORT void qFatal(const char *,...)
QWSCursor * cursor
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
static void ignoreSignal(int)
QWSServerSocket * ssocket
struct QWSServerPrivate::SelectionOwner::Time time
QWSWindow * mouseGrabber
static QWSWindow * keyboardGrabber
struct QWSServerPrivate::SelectionOwner selectionOwner
The QTimer class provides repetitive and single-shot timers.
Definition: qtimer.h:56
The QWSClient class encapsulates a client process in Qt for Embedded Linux.
QWSServer Q_GUI_EXPORT * qwsServer

◆ invokeAddProperty()

void QWSServerPrivate::invokeAddProperty ( QWSAddPropertyCommand cmd)
private

Definition at line 3138 of file qwindowsystem_qws.cpp.

3139 {
3141 }
struct QWSAddPropertyCommand::SimpleData simpleData
bool addProperty(int winId, int property)
QWSPropertyManager propertyManager

◆ invokeConvertSelection()

void QWSServerPrivate::invokeConvertSelection ( QWSConvertSelectionCommand cmd)
private

Definition at line 3214 of file qwindowsystem_qws.cpp.

3215 {
3216  qDebug("QWSServer::invokeConvertSelection");
3217 
3218  if (selectionOwner.windowid != -1) {
3220  if (win)
3222  else
3223  qDebug("couldn't find window %d", selectionOwner.windowid);
3224  }
3225 }
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
void sendSelectionRequestEvent(QWSConvertSelectionCommand *cmd, int windowid)
Q_CORE_EXPORT void qDebug(const char *,...)
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * findWindow(int windowid, QWSClient *client=0)
struct QWSServerPrivate::SelectionOwner selectionOwner

◆ invokeCreate()

void QWSServerPrivate::invokeCreate ( QWSCreateCommand cmd,
QWSClient client 
)
private

Definition at line 2917 of file qwindowsystem_qws.cpp.

2918 {
2920  event.simpleData.objectid = get_object_id(cmd->count);
2921  event.simpleData.count = cmd->count;
2922  client->sendEvent(&event);
2923 }
void sendEvent(QWSEvent *event)
EventRef event
static int get_object_id(int count=1)

◆ invokeDefineCursor()

void QWSServerPrivate::invokeDefineCursor ( QWSDefineCursorCommand cmd,
QWSClient client 
)
private

Definition at line 3228 of file qwindowsystem_qws.cpp.

3229 {
3230  if (cmd->simpleData.height > 64 || cmd->simpleData.width > 64) {
3231  qDebug("Cannot define cursor size > 64x64");
3232  return;
3233  }
3234 
3235  delete client->cursors.take(cmd->simpleData.id);
3236 
3237  int dataLen = cmd->simpleData.height * ((cmd->simpleData.width+7) / 8);
3238 
3239  if (dataLen > 0 && cmd->data) {
3240  QWSCursor *curs = new QWSCursor(cmd->data, cmd->data + dataLen,
3241  cmd->simpleData.width, cmd->simpleData.height,
3242  cmd->simpleData.hotX, cmd->simpleData.hotY);
3243  client->cursors.insert(cmd->simpleData.id, curs);
3244  }
3245 }
Q_CORE_EXPORT void qDebug(const char *,...)
QWSCursorMap cursors
iterator insert(const Key &key, const T &value)
Inserts a new item with the key key and a value of value.
Definition: qmap.h:559
struct QWSDefineCursorCommand::SimpleData simpleData
T take(const Key &key)
Removes the item with the key key from the map and returns the value associated with it...
Definition: qmap.h:692

◆ invokeEmbed()

void QWSServerPrivate::invokeEmbed ( QWSEmbedCommand cmd,
QWSClient client 
)
private

Definition at line 3395 of file qwindowsystem_qws.cpp.

3396 {
3397  // Should find these two windows in a single loop
3398  QWSWindow *embedder = findWindow(cmd->simpleData.embedder, client);
3399  QWSWindow *embedded = findWindow(cmd->simpleData.embedded);
3400 
3401  if (!embedder) {
3402  qWarning("QWSServer: Embed command from window %i failed: No such id.",
3403  static_cast<int>(cmd->simpleData.embedder));
3404  return;
3405  }
3406 
3407  if (!embedded) {
3408  qWarning("QWSServer: Embed command on window %i failed: No such id.",
3409  static_cast<int>(cmd->simpleData.embedded));
3410  return;
3411  }
3412 
3413  switch (cmd->simpleData.type) {
3415  embedder->startEmbed(embedded);
3416  windows.removeAll(embedded);
3417  windows.insert(windows.indexOf(embedder), embedded);
3418  break;
3420  embedder->stopEmbed(embedded);
3421  break;
3422  case QWSEmbedEvent::Region:
3423  break;
3424  }
3425 
3426  embedded->client()->sendEmbedEvent(embedded->winId(),
3427  cmd->simpleData.type, cmd->region);
3428  const QRegion oldAllocated = embedded->allocatedRegion();
3429  update_regions();
3430  exposeRegion(oldAllocated - embedded->allocatedRegion(),
3431  windows.indexOf(embedded));
3432 }
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
QWSEmbedEvent::Type type
void exposeRegion(const QRegion &, int index=0)
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * findWindow(int windowid, QWSClient *client=0)
void sendEmbedEvent(int winid, QWSEmbedEvent::Type type, const QRegion &region=QRegion())
Q_CORE_EXPORT void qWarning(const char *,...)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
struct QWSEmbedCommand::@168 simpleData
void startEmbed(QWSWindow *window)
int winId() const
Returns the window&#39;s ID.
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
QList< QWSWindow * > windows
void stopEmbed(QWSWindow *window)
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770

◆ invokeFont()

void QWSServerPrivate::invokeFont ( const QWSFontCommand cmd,
QWSClient client 
)
private

Definition at line 3376 of file qwindowsystem_qws.cpp.

3377 {
3378  QWSClientPrivate *priv = client->d_func();
3380  referenceFont(priv, cmd->fontName);
3381  } else if (cmd->simpleData.type == QWSFontCommand::StoppedUsingFont) {
3382  dereferenceFont(priv, cmd->fontName);
3383  }
3384 }
void referenceFont(QWSClientPrivate *client, const QByteArray &font)
void dereferenceFont(QWSClientPrivate *client, const QByteArray &font)
static const QMetaObjectPrivate * priv(const uint *data)
QByteArray fontName
struct QWSFontCommand::SimpleData simpleData

◆ invokeGetProperty()

void QWSServerPrivate::invokeGetProperty ( QWSGetPropertyCommand cmd,
QWSClient client 
)
private

Definition at line 3179 of file qwindowsystem_qws.cpp.

3180 {
3181  const char *data;
3182  int len;
3183 
3185  cmd->simpleData.property,
3186  data, len)) {
3187  client->sendPropertyReplyEvent(cmd->simpleData.property, len, data);
3188  } else {
3189  client->sendPropertyReplyEvent(cmd->simpleData.property, -1, 0);
3190  }
3191 }
void sendPropertyReplyEvent(int property, int len, const char *data)
static const char * data(const QByteArray &arr)
bool getProperty(int winId, int property, const char *&data, int &len)
QWSPropertyManager propertyManager
struct QWSGetPropertyCommand::SimpleData simpleData

◆ invokeGrabKeyboard()

void QWSServerPrivate::invokeGrabKeyboard ( QWSGrabKeyboardCommand cmd,
QWSClient client 
)
private

Definition at line 3306 of file qwindowsystem_qws.cpp.

3307 {
3308  QWSWindow* win = findWindow(cmd->simpleData.windowid, 0);
3309  if (!win)
3310  return;
3311 
3312  if (cmd->simpleData.grab) {
3313  if (!keyboardGrabber || (keyboardGrabber->client() == client)) {
3314  keyboardGrabbing = true;
3315  keyboardGrabber = win;
3316  }
3317  } else {
3319  }
3320 }
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
static bool keyboardGrabbing
QWSWindow * findWindow(int windowid, QWSClient *client=0)
void releaseKeyboard(QWSWindow *w)
static QWSWindow * keyboardGrabber
struct QWSGrabKeyboardCommand::SimpleData simpleData

◆ invokeGrabMouse()

void QWSServerPrivate::invokeGrabMouse ( QWSGrabMouseCommand cmd,
QWSClient client 
)
private

Definition at line 3290 of file qwindowsystem_qws.cpp.

3291 {
3292  QWSWindow* win = findWindow(cmd->simpleData.windowid, 0);
3293  if (!win)
3294  return;
3295 
3296  if (cmd->simpleData.grab) {
3297  if (!mouseGrabber || mouseGrabber->client() == client) {
3298  mouseGrabbing = true;
3299  mouseGrabber = win;
3300  }
3301  } else {
3303  }
3304 }
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * findWindow(int windowid, QWSClient *client=0)
void releaseMouse(QWSWindow *w)
QWSWindow * mouseGrabber
struct QWSGrabMouseCommand::SimpleData simpleData

◆ invokeIdentify()

void QWSServerPrivate::invokeIdentify ( const QWSIdentifyCommand cmd,
QWSClient client 
)
private

Definition at line 2908 of file qwindowsystem_qws.cpp.

2909 {
2910  client->setIdentity(cmd->id);
2911 #ifndef QT_NO_QWS_MULTIPROCESS
2912  if (client->clientId() > 0)
2913  client->d_func()->setLockId(cmd->simpleData.idLock);
2914 #endif
2915 }
void setIdentity(const QString &)
int clientId() const
Returns an integer uniquely identfying this client.
struct QWSIdentifyCommand::SimpleData simpleData

◆ invokeIMResponse()

void QWSServerPrivate::invokeIMResponse ( const QWSIMResponseCommand cmd,
QWSClient client 
)
private

Definition at line 3357 of file qwindowsystem_qws.cpp.

3359 {
3360  if (current_IM)
3362 }
struct QWSIMResponseCommand::SimpleData simpleData
virtual void queryResponse(int property, const QVariant &)
Receive replies to an input method query.
static QWSInputMethod * current_IM

◆ invokeIMUpdate()

void QWSServerPrivate::invokeIMUpdate ( const QWSIMUpdateCommand cmd,
QWSClient client 
)
private

Definition at line 3364 of file qwindowsystem_qws.cpp.

3366 {
3369 
3370  if (current_IM && (current_IM_winId == cmd->simpleData.windowid || cmd->simpleData.windowid == -1))
3372 }
static int current_IM_winId
static QWSInputMethod * current_IM
virtual void updateHandler(int type)
Handles update events including resets and focus changes.
struct QWSIMUpdateCommand::SimpleData simpleData

◆ invokePlaySound()

void QWSServerPrivate::invokePlaySound ( QWSPlaySoundCommand cmd,
QWSClient client 
)
private

Definition at line 3323 of file qwindowsystem_qws.cpp.

3324 {
3325 #if !defined(QT_EXTERNAL_SOUND_SERVER) && !defined(Q_OS_DARWIN)
3326  soundserver->playFile( 1, cmd->filename );
3327 #else
3328  Q_UNUSED(cmd);
3329 #endif
3330 }
QWSSoundServer * soundserver
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ invokePositionCursor()

void QWSServerPrivate::invokePositionCursor ( QWSPositionCursorCommand cmd,
QWSClient client 
)
private

Definition at line 3281 of file qwindowsystem_qws.cpp.

3282 {
3283  Q_Q(QWSServer);
3284  QPoint newPos(cmd->simpleData.newX, cmd->simpleData.newY);
3285  if (newPos != QWSServer::mousePosition)
3286  q->sendMouseEvent(newPos, qwsServer->d_func()->mouseState);
3287 }
struct QWSPositionCursorCommand::SimpleData simpleData
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
static QPoint mousePosition
QWSServer Q_GUI_EXPORT * qwsServer

◆ invokeQCopSend()

void QWSServerPrivate::invokeQCopSend ( QWSQCopSendCommand cmd,
QWSClient client 
)
private

Definition at line 3342 of file qwindowsystem_qws.cpp.

3343 {
3344  QCopChannel::answer(client, cmd->channel, cmd->message, cmd->data);
3345 }
static void answer(QWSClient *cl, const QString &ch, const QString &msg, const QByteArray &data)
Server side: transmit the message to all clients registered to the specified channel.

◆ invokeRegion()

void QWSServerPrivate::invokeRegion ( QWSRegionCommand cmd,
QWSClient client 
)
private

Definition at line 2936 of file qwindowsystem_qws.cpp.

2937 {
2938 #ifdef QWS_REGION_DEBUG
2939  qDebug("QWSServer::invokeRegion %d rects (%d)",
2941 #endif
2942 
2943  QWSWindow* changingw = findWindow(cmd->simpleData.windowid, 0);
2944  if (!changingw) {
2945  qWarning("Invalid window handle %08x",cmd->simpleData.windowid);
2946  return;
2947  }
2948  if (!changingw->forClient(client)) {
2949  qWarning("Disabled: clients changing other client's window region");
2950  return;
2951  }
2952 
2954  cmd->region);
2955 }
QByteArray surfaceData
Q_CORE_EXPORT void qDebug(const char *,...)
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * findWindow(int windowid, QWSClient *client=0)
Q_CORE_EXPORT void qWarning(const char *,...)
bool forClient(const QWSClient *cl) const
struct QWSRegionCommand::SimpleData simpleData
void request_region(int winId, const QString &surfaceKey, const QByteArray &surfaceData, const QRegion &region)

◆ invokeRegionDestroy()

void QWSServerPrivate::invokeRegionDestroy ( const QWSRegionDestroyCommand cmd,
QWSClient client 
)
private

Definition at line 2975 of file qwindowsystem_qws.cpp.

2976 {
2977  Q_Q(QWSServer);
2978  QWSWindow* changingw = findWindow(cmd->simpleData.windowid, 0);
2979  if (!changingw) {
2980  qWarning("invokeRegionDestroy: Invalid window handle %d",cmd->simpleData.windowid);
2981  return;
2982  }
2983  if (!changingw->forClient(client)) {
2984  qWarning("Disabled: clients changing other client's window region");
2985  return;
2986  }
2987 
2988  setWindowRegion(changingw, QRegion());
2989 // rgnMan->remove(changingw->allocationIndex());
2990  for (int i = 0; i < windows.size(); ++i) {
2991  if (windows.at(i) == changingw) {
2992  windows.takeAt(i);
2993  if (i < nReserved)
2994  --nReserved;
2995  break;
2996  }
2997  }
2998 
2999  handleWindowClose(changingw);
3000 #ifndef QT_NO_QWS_PROPERTIES
3001  propertyManager.removeProperties(changingw->winId());
3002 #endif
3003  emit q->windowEvent(changingw, QWSServer::Destroy);
3004  delete changingw;
3005 }
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...
bool removeProperties(int winId)
#define Q_Q(Class)
Definition: qglobal.h:2483
struct QWSRegionDestroyCommand::SimpleData simpleData
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * findWindow(int windowid, QWSClient *client=0)
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
void handleWindowClose(QWSWindow *w)
Q_CORE_EXPORT void qWarning(const char *,...)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
int winId() const
Returns the window&#39;s ID.
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QList< QWSWindow * > windows
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
T takeAt(int i)
Removes the item at index position i and returns it.
Definition: qlist.h:484
bool forClient(const QWSClient *cl) const
QWSPropertyManager propertyManager

◆ invokeRegionMove()

void QWSServerPrivate::invokeRegionMove ( const QWSRegionMoveCommand cmd,
QWSClient client 
)
private

Definition at line 2957 of file qwindowsystem_qws.cpp.

2958 {
2959  Q_Q(QWSServer);
2960  QWSWindow* changingw = findWindow(cmd->simpleData.windowid, 0);
2961  if (!changingw) {
2962  qWarning("invokeRegionMove: Invalid window handle %d",cmd->simpleData.windowid);
2963  return;
2964  }
2965  if (!changingw->forClient(client)) {
2966  qWarning("Disabled: clients changing other client's window region");
2967  return;
2968  }
2969 
2970 // changingw->setNeedAck(true);
2971  moveWindowRegion(changingw, cmd->simpleData.dx, cmd->simpleData.dy);
2972  emit q->windowEvent(changingw, QWSServer::Geometry);
2973 }
struct QWSRegionMoveCommand::SimpleData simpleData
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
void moveWindowRegion(QWSWindow *, int dx, int dy)
QWSWindow * findWindow(int windowid, QWSClient *client=0)
#define emit
Definition: qobjectdefs.h:76
Q_CORE_EXPORT void qWarning(const char *,...)
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
bool forClient(const QWSClient *cl) const

◆ invokeRegionName()

void QWSServerPrivate::invokeRegionName ( const QWSRegionNameCommand cmd,
QWSClient client 
)
private

Definition at line 2925 of file qwindowsystem_qws.cpp.

2926 {
2927  Q_Q(QWSServer);
2928  QWSWindow* changingw = findWindow(cmd->simpleData.windowid, client);
2929  if (changingw && (changingw->name() != cmd->name || changingw->caption() !=cmd->caption)) {
2930  changingw->setName(cmd->name);
2931  changingw->setCaption(cmd->caption);
2932  emit q->windowEvent(changingw, QWSServer::Name);
2933  }
2934 }
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
void setName(const QString &n)
QWSWindow * findWindow(int windowid, QWSClient *client=0)
#define emit
Definition: qobjectdefs.h:76
struct QWSRegionNameCommand::SimpleData simpleData
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
const QString & caption() const
Returns the window&#39;s caption.
const QString & name() const
Returns the window&#39;s name, which is taken from the QWidget::objectName() at the time of QWidget::show...
void setCaption(const QString &c)
Sets the window&#39;s caption to c.

◆ invokeRegisterChannel()

void QWSServerPrivate::invokeRegisterChannel ( QWSQCopRegisterChannelCommand cmd,
QWSClient client 
)
private

Definition at line 3334 of file qwindowsystem_qws.cpp.

3336 {
3337  // QCopChannel will force us to emit the newChannel signal if this channel
3338  // didn't already exist.
3339  QCopChannel::registerChannel(cmd->channel, client);
3340 }
static void registerChannel(const QString &ch, QWSClient *cl)
Server side: subscribe client cl on channel ch.

◆ invokeRemoveProperty()

void QWSServerPrivate::invokeRemoveProperty ( QWSRemovePropertyCommand cmd)
private

Definition at line 3162 of file qwindowsystem_qws.cpp.

3163 {
3164  Q_Q(QWSServer);
3166  cmd->simpleData.property)) {
3167  q->sendPropertyNotifyEvent(cmd->simpleData.property,
3169  }
3170 }
bool removeProperty(int winId, int property)
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
struct QWSRemovePropertyCommand::SimpleData simpleData
QWSPropertyManager propertyManager

◆ invokeRepaintRegion()

void QWSServerPrivate::invokeRepaintRegion ( QWSRepaintRegionCommand cmd,
QWSClient client 
)
private

Definition at line 3386 of file qwindowsystem_qws.cpp.

3388 {
3389  QRegion r;
3392 }
struct QWSRepaintRegionCommand::SimpleData simpleData
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void setRects(const QRect *rect, int num)
Sets the region using the array of rectangles specified by rects and number.
Definition: qregion.cpp:4424
void repaint_region(int winId, int windowFlags, bool opaque, const QRegion &)

◆ invokeScreenTransform()

void QWSServerPrivate::invokeScreenTransform ( const QWSScreenTransformCommand cmd,
QWSClient client 
)
private

Definition at line 3435 of file qwindowsystem_qws.cpp.

3437 {
3438  Q_UNUSED(client);
3439 
3441  event.simpleData.screen = cmd->simpleData.screen;
3442  event.simpleData.transformation = cmd->simpleData.transformation;
3443 
3445  for (; it != clientMap.constEnd(); ++it)
3446  (*it)->sendEvent(&event);
3447 }
EventRef event
#define it(className, varName)
struct QWSScreenTransformCommand::SimpleData simpleData
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:380
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67

◆ invokeSelectCursor()

void QWSServerPrivate::invokeSelectCursor ( QWSSelectCursorCommand cmd,
QWSClient client 
)
private

Definition at line 3247 of file qwindowsystem_qws.cpp.

3248 {
3249  int id = cmd->simpleData.id;
3250  QWSCursor *curs = 0;
3251  if (id <= Qt::LastCursor) {
3252  curs = QWSCursor::systemCursor(id);
3253  }
3254  else {
3255  QWSCursorMap cursMap = client->cursors;
3256  QWSCursorMap::Iterator it = cursMap.find(id);
3257  if (it != cursMap.end()) {
3258  curs = it.value();
3259  }
3260  }
3261  if (curs == 0) {
3263  }
3264 
3265  QWSWindow* win = findWindow(cmd->simpleData.windowid, 0);
3266  if (mouseGrabber) {
3267  // If the mouse is being grabbed, we don't want just anyone to
3268  // be able to change the cursor. We do want the cursor to be set
3269  // correctly once mouse grabbing is stopped though.
3270  if (win != mouseGrabber)
3271  nextCursor = curs;
3272  else
3273  setCursor(curs);
3274  } else if (win && win->allocatedRegion().contains(QWSServer::mousePosition)) { //##################### cursor
3275  // A non-grabbing window can only set the cursor shape if the
3276  // cursor is within its allocated region.
3277  setCursor(curs);
3278  }
3279 }
QWSCursor * nextCursor
#define it(className, varName)
static QWSCursor * systemCursor(int id)
iterator find(const Key &key)
Returns an iterator pointing to the item with key key in the map.
Definition: qmap.h:618
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
T & value() const
Returns a modifiable reference to the current item&#39;s value.
Definition: qmap.h:251
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * findWindow(int windowid, QWSClient *client=0)
QWSCursorMap cursors
bool contains(const QPoint &p) const
Returns true if the region contains the point p; otherwise returns false.
Definition: qregion.cpp:4104
struct QWSSelectCursorCommand::SimpleData simpleData
The QMap::iterator class provides an STL-style non-const iterator for QMap and QMultiMap.
Definition: qmap.h:233
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:375
QWSWindow * mouseGrabber
static QPoint mousePosition
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67
void setCursor(QWSCursor *curs)

◆ invokeSetAltitude()

void QWSServerPrivate::invokeSetAltitude ( const QWSChangeAltitudeCommand cmd,
QWSClient client 
)
private

Definition at line 3101 of file qwindowsystem_qws.cpp.

3103 {
3104  Q_UNUSED(client);
3105 
3106  int winId = cmd->simpleData.windowid;
3107  int alt = cmd->simpleData.altitude;
3108  bool fixed = cmd->simpleData.fixed;
3109 #if 0
3110  qDebug("QWSServer::invokeSetAltitude winId %d alt %d)", winId, alt);
3111 #endif
3112 
3113  if (alt < -1 || alt > 1) {
3114  qWarning("QWSServer::invokeSetAltitude Only lower, raise and stays-on-top supported");
3115  return;
3116  }
3117 
3118  QWSWindow* changingw = findWindow(winId, 0);
3119  if (!changingw) {
3120  qWarning("invokeSetAltitude: Invalid window handle %d", winId);
3121  return;
3122  }
3123 
3124  if (fixed && alt >= 1) {
3125  changingw->onTop = true;
3126  }
3128  changingw->lower();
3129  else
3130  changingw->raise();
3131 
3132 // if (!changingw->forClient(client)) {
3133 // refresh();
3134 // }
3135 }
void raise()
Raises the window above all other windows except "Stay on top" windows.
Q_CORE_EXPORT QTextStream & fixed(QTextStream &s)
Q_CORE_EXPORT void qDebug(const char *,...)
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
struct QWSChangeAltitudeCommand::SimpleData simpleData
QWSWindow * findWindow(int windowid, QWSClient *client=0)
Q_CORE_EXPORT void qWarning(const char *,...)
void lower()
Lowers the window below other windows.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ invokeSetFocus()

void QWSServerPrivate::invokeSetFocus ( const QWSRequestFocusCommand cmd,
QWSClient client 
)
private

Definition at line 3007 of file qwindowsystem_qws.cpp.

3008 {
3009  int winId = cmd->simpleData.windowid;
3010  int gain = cmd->simpleData.flag;
3011 
3012  if (gain != 0 && gain != 1) {
3013  qWarning("Only 0(lose) and 1(gain) supported");
3014  return;
3015  }
3016 
3017  QWSWindow* changingw = findWindow(winId, 0);
3018  if (!changingw)
3019  return;
3020 
3021  if (!changingw->forClient(client)) {
3022  qWarning("Disabled: clients changing other client's focus");
3023  return;
3024  }
3025 
3026  setFocus(changingw, gain);
3027 }
struct QWSRequestFocusCommand::SimpleData simpleData
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * findWindow(int windowid, QWSClient *client=0)
Q_CORE_EXPORT void qWarning(const char *,...)
bool forClient(const QWSClient *cl) const
void setFocus(QWSWindow *, bool gain)

◆ invokeSetOpacity()

void QWSServerPrivate::invokeSetOpacity ( const QWSSetOpacityCommand cmd,
QWSClient client 
)
private

Definition at line 3080 of file qwindowsystem_qws.cpp.

3081 {
3082  Q_UNUSED( client );
3083  int winId = cmd->simpleData.windowid;
3084  int opacity = cmd->simpleData.opacity;
3085 
3086  QWSWindow* changingw = findWindow(winId, 0);
3087 
3088  if (!changingw) {
3089  qWarning("invokeSetOpacity: Invalid window handle %d", winId);
3090  return;
3091  }
3092 
3093  int altitude = windows.indexOf(changingw);
3094  const bool wasOpaque = changingw->isOpaque();
3095  changingw->_opacity = opacity;
3096  if (wasOpaque != changingw->isOpaque())
3097  update_regions();
3098  exposeRegion(changingw->allocatedRegion(), altitude);
3099 }
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
void exposeRegion(const QRegion &, int index=0)
struct QWSSetOpacityCommand::SimpleData simpleData
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * findWindow(int windowid, QWSClient *client=0)
Q_CORE_EXPORT void qWarning(const char *,...)
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
QList< QWSWindow * > windows
bool isOpaque() const
Returns true if the window is opaque, i.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ invokeSetProperty()

void QWSServerPrivate::invokeSetProperty ( QWSSetPropertyCommand cmd)
private

Definition at line 3143 of file qwindowsystem_qws.cpp.

3144 {
3145  Q_Q(QWSServer);
3147  cmd->simpleData.property,
3148  cmd->simpleData.mode,
3149  cmd->data,
3150  cmd->rawLen)) {
3151  q->sendPropertyNotifyEvent(cmd->simpleData.property,
3153 #ifndef QT_NO_QWS_INPUTMETHODS
3155  QString s((const QChar*)cmd->data, cmd->rawLen/2);
3156  emit q->markedText(s);
3157  }
3158 #endif
3159  }
3160 }
#define QT_QWS_PROPERTY_MARKEDTEXT
The QString class provides a Unicode character string.
Definition: qstring.h:83
struct QWSSetPropertyCommand::SimpleData simpleData
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QWSPropertyManager propertyManager
bool setProperty(int winId, int property, int mode, const char *data, int len)

◆ invokeSetSelectionOwner()

void QWSServerPrivate::invokeSetSelectionOwner ( QWSSetSelectionOwnerCommand cmd)
private

Definition at line 3194 of file qwindowsystem_qws.cpp.

3195 {
3196  qDebug("QWSServer::invokeSetSelectionOwner");
3197 
3198  SelectionOwner so;
3199  so.windowid = cmd->simpleData.windowid;
3200  so.time.set(cmd->simpleData.hour, cmd->simpleData.minute,
3201  cmd->simpleData.sec, cmd->simpleData.ms);
3202 
3203  if (selectionOwner.windowid != -1) {
3205  if (win)
3207  else
3208  qDebug("couldn't find window %d", selectionOwner.windowid);
3209  }
3210 
3211  selectionOwner = so;
3212 }
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
void sendSelectionClearEvent(int windowid)
struct QWSSetSelectionOwnerCommand::SimpleData simpleData
Q_CORE_EXPORT void qDebug(const char *,...)
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * findWindow(int windowid, QWSClient *client=0)
struct QWSServerPrivate::SelectionOwner selectionOwner

◆ lowerWindow()

void QWSServerPrivate::lowerWindow ( QWSWindow changingw,
int  = -1 
)
private

Definition at line 3550 of file qwindowsystem_qws.cpp.

Referenced by QWSWindow::lower().

3551 {
3552  Q_Q(QWSServer);
3553  if (changingw == windows.last())
3554  return;
3555  QWSWindow::State oldstate = changingw->d->state;
3556  changingw->d->state = QWSWindow::Lowering;
3557 
3558  int i = windows.indexOf(changingw);
3559  int newIdx = windows.size()-1;
3560  windows.move(i, newIdx);
3561 
3562  const QRegion bound = changingw->allocatedRegion();
3563 
3564  update_regions();
3565 
3566  // Expose regions previously overlapped by transparent window
3567  if (!changingw->isOpaque()) {
3568  QRegion expose;
3569  for (int j = i; j < windows.size() - 1; ++j)
3570  expose += (windows.at(j)->allocatedRegion() & bound);
3571  if (!expose.isEmpty())
3572  exposeRegion(expose, newIdx);
3573  }
3574 
3575  changingw->d->state = oldstate;
3576  emit q->windowEvent(changingw, QWSServer::Lower);
3577 }
State
This enum describes the state of a window.
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
void exposeRegion(const QRegion &, int index=0)
#define Q_Q(Class)
Definition: qglobal.h:2483
void move(int from, int to)
Moves the item at index position from to index position to.
Definition: qlist.h:628
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QWSWindowPrivate * d
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QList< QWSWindow * > windows
T & last()
Returns a reference to the last item in the list.
Definition: qlist.h:284
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QWSWindow::State state
bool isOpaque() const
Returns true if the window is opaque, i.
static Qt::KeyboardModifiers oldstate
Definition: qdnd_qws.cpp:87

◆ move_region()

void QWSServerPrivate::move_region ( const QWSRegionMoveCommand cmd)
private

Definition at line 3925 of file qwindowsystem_qws.cpp.

3926 {
3927  QWSClient *serverClient = clientMap.value(-1);
3928  invokeRegionMove(cmd, serverClient);
3929 }
void invokeRegionMove(const QWSRegionMoveCommand *cmd, QWSClient *client)
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
The QWSClient class encapsulates a client process in Qt for Embedded Linux.

◆ moveWindowRegion()

void QWSServerPrivate::moveWindowRegion ( QWSWindow changingw,
int  dx,
int  dy 
)
private

Definition at line 3645 of file qwindowsystem_qws.cpp.

3646 {
3647  if (!changingw)
3648  return;
3649 
3650  QWSWindow::State oldState = changingw->d->state;
3651  changingw->d->state = QWSWindow::Moving;
3652  const QRegion oldRegion(changingw->allocatedRegion());
3653  changingw->requested_region.translate(dx, dy);
3654 
3655  // hw: Even if the allocated region doesn't change, the requested region
3656  // region has changed and we need to send region events.
3657  // Resetting the allocated region to force update_regions to send events.
3658  changingw->setAllocatedRegion(QRegion());
3659  update_regions();
3660  const QRegion newRegion(changingw->allocatedRegion());
3661 
3662  QWSWindowSurface *surface = changingw->windowSurface();
3663  QRegion expose;
3664  if (surface)
3665  expose = surface->move(QPoint(dx, dy), changingw->allocatedRegion());
3666  else
3667  expose = oldRegion + newRegion;
3668 
3669  if (!changingw->d->painted && !expose.isEmpty())
3670  expose = oldRegion - newRegion;
3671 
3672  int idx = windows.indexOf(changingw);
3673  exposeRegion(expose, idx);
3674  changingw->d->state = oldState;
3675 }
void setAllocatedRegion(const QRegion &region)
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
State
This enum describes the state of a window.
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
QRegion requested_region
void exposeRegion(const QRegion &, int index=0)
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QWSWindowPrivate * d
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
QList< QWSWindow * > windows
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QWSWindowSurface * windowSurface() const
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
Definition: qregion.cpp:4116
QWSWindow::State state

◆ name_region()

void QWSServerPrivate::name_region ( const QWSRegionNameCommand cmd)
private

Definition at line 4069 of file qwindowsystem_qws.cpp.

4070 {
4071  invokeRegionName(cmd, clientMap.value(-1));
4072 }
void invokeRegionName(const QWSRegionNameCommand *cmd, QWSClient *client)
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499

◆ newMouseHandler()

QWSMouseHandler * QWSServerPrivate::newMouseHandler ( const QString spec)
private

Definition at line 3799 of file qwindowsystem_qws.cpp.

3800 {
3801  int c = spec.indexOf(QLatin1Char(':'));
3802  QString mouseProto;
3803  QString mouseDev;
3804  if (c >= 0) {
3805  mouseProto = spec.left(c);
3806  mouseDev = spec.mid(c+1);
3807  } else {
3808  mouseProto = spec;
3809  }
3810 
3811  int screen = -1;
3812  const QList<QRegExp> regexps = QList<QRegExp>()
3813  << QRegExp(QLatin1String(":screen=(\\d+)\\b"))
3814  << QRegExp(QLatin1String("\\bscreen=(\\d+):"));
3815  for (int i = 0; i < regexps.size(); ++i) {
3816  QRegExp regexp = regexps.at(i);
3817  if (regexp.indexIn(mouseDev) == -1)
3818  continue;
3819  screen = regexp.cap(1).toInt();
3820  mouseDev.remove(regexp.pos(0), regexp.matchedLength());
3821  break;
3822  }
3823 
3824  QWSMouseHandler *handler = 0;
3825  handler = QMouseDriverFactory::create(mouseProto, mouseDev);
3826  if (screen != -1)
3827  handler->setScreen(qt_screen->subScreens().at(screen));
3828 
3829  return handler;
3830 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
unsigned char c[8]
Definition: qnumeric_p.h:62
QString cap(int nth=0) const
Returns the text captured by the nth subexpression.
Definition: qregexp.cpp:4310
The QRegExp class provides pattern matching using regular expressions.
Definition: qregexp.h:61
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
The QWSMouseHandler class is a base class for mouse drivers in Qt for Embedded Linux.
Definition: qmouse_qws.h:66
int pos(int nth=0) const
Returns the position of the nth captured text in the searched string.
Definition: qregexp.cpp:4337
int matchedLength() const
Returns the length of the last matched string, or -1 if there was no match.
Definition: qregexp.cpp:4193
The QString class provides a Unicode character string.
Definition: qstring.h:83
QLatin1String("TTY"))) static const int FontCleanupInterval
int indexIn(const QString &str, int offset=0, CaretMode caretMode=CaretAtZero) const
Attempts to find a match in str from position offset (0 by default).
Definition: qregexp.cpp:4136
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
static QWSMouseHandler * create(const QString &, const QString &)
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
virtual QList< QScreen * > subScreens() const
Definition: qscreen_qws.h:283
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867
QImageIOHandler * handler
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
void setScreen(const QScreen *screen)
Sets the screen for this mouse driver to be the given screen.
Definition: qmouse_qws.cpp:264

◆ newWindow()

QWSWindow * QWSServerPrivate::newWindow ( int  id,
QWSClient client 
)
private

Definition at line 3449 of file qwindowsystem_qws.cpp.

3450 {
3451  Q_Q(QWSServer);
3452  // Make a new window, put it on top.
3453  QWSWindow* w = new QWSWindow(id,client);
3454 
3455  // insert after "stays on top" windows
3456  bool added = false;
3457  for (int i = nReserved; i < windows.size(); ++i) {
3458  QWSWindow *win = windows.at(i);
3459  if (!win->onTop) {
3460  windows.insert(i, w);
3461  added = true;
3462  break;
3463  }
3464  }
3465  if (!added)
3466  windows.append(w);
3467  emit q->windowEvent(w, QWSServer::Create);
3468  return w;
3469 }
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
friend class QWSWindow
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QList< QWSWindow * > windows
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ openDisplay()

void QWSServerPrivate::openDisplay ( )
private

Definition at line 4092 of file qwindowsystem_qws.cpp.

4093 {
4094  qt_init_display();
4095 
4096 // rgnMan = qt_fbdpy->regionManager();
4099 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
Definition: qscreen_qws.h:233
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
Definition: qscreen_qws.h:234
void qt_init_display()

◆ raiseWindow()

void QWSServerPrivate::raiseWindow ( QWSWindow changingw,
int  = 0 
)
private

Definition at line 3484 of file qwindowsystem_qws.cpp.

Referenced by QWSWindow::raise().

3485 {
3486  Q_Q(QWSServer);
3487  if (changingw == windows.first())
3488  return;
3489  QWSWindow::State oldstate = changingw->d->state;
3490  changingw->d->state = QWSWindow::Raising;
3491  // Expose regions previously overlapped by transparent windows
3492  const QRegion bound = changingw->allocatedRegion();
3493  QRegion expose;
3494  int windowPos = 0;
3495 
3496  //change position in list:
3497  for (int i = 0; i < windows.size(); ++i) {
3498  QWSWindow *w = windows.at(i);
3499  if (w == changingw) {
3500  windowPos = i;
3501  windows.takeAt(i);
3502  break;
3503  }
3504  if (!w->isOpaque())
3505  expose += (w->allocatedRegion() & bound);
3506  }
3507 
3508  bool onTop = changingw->onTop;
3509 
3510 #ifndef QT_NO_QWSEMBEDWIDGET
3511  // an embedded window is on top if the embedder is on top
3512  QWSWindow *embedder = changingw->d->embedder;
3513  while (!onTop && embedder) {
3514  onTop = embedder->onTop;
3515  embedder = embedder->d->embedder;
3516  }
3517 #endif
3518 
3519  int newPos = -1;
3520  if (onTop) {
3521  windows.insert(nReserved, changingw);
3522  newPos = nReserved;
3523  } else {
3524  // insert after "stays on top" windows
3525  bool in = false;
3526  for (int i = nReserved; i < windows.size(); ++i) {
3527  QWSWindow *w = windows.at(i);
3528  if (!w->onTop) {
3529  windows.insert(i, changingw);
3530  in = true;
3531  newPos = i;
3532  break;
3533  }
3534  }
3535  if (!in) {
3536  windows.append(changingw);
3537  newPos = windows.size()-1;
3538  }
3539  }
3540 
3541  if (windowPos != newPos) {
3542  update_regions();
3543  if (!expose.isEmpty())
3544  exposeRegion(expose, newPos);
3545  }
3546  changingw->d->state = oldstate;
3547  emit q->windowEvent(changingw, QWSServer::Raise);
3548 }
State
This enum describes the state of a window.
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
void exposeRegion(const QRegion &, int index=0)
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QWSWindowPrivate * d
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QList< QWSWindow * > windows
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
T takeAt(int i)
Removes the item at index position i and returns it.
Definition: qlist.h:484
QWSWindow::State state
bool isOpaque() const
Returns true if the window is opaque, i.
static Qt::KeyboardModifiers oldstate
Definition: qdnd_qws.cpp:87

◆ referenceFont()

void QWSServerPrivate::referenceFont ( QWSClientPrivate client,
const QByteArray font 
)
private

Definition at line 1804 of file qwindowsystem_qws.cpp.

1805 {
1806  if (!client->usedFonts.contains(font)) {
1807  client->usedFonts.insert(font);
1808 
1809  ++fontReferenceCount[font];
1810 #if defined(QWS_DEBUG_FONTCLEANUP)
1811  qDebug() << "Client" << client->q_func()->clientId() << "added font" << font;
1812  qDebug() << "Refcount is" << fontReferenceCount[font];
1813 #endif
1814  }
1815 }
QSet< QByteArray > usedFonts
QMap< QByteArray, int > fontReferenceCount
Q_CORE_EXPORT void qDebug(const char *,...)
bool contains(const T &value) const
Definition: qset.h:91
const_iterator insert(const T &value)
Definition: qset.h:179

◆ releaseKeyboard()

void QWSServerPrivate::releaseKeyboard ( QWSWindow w)
private
Warning
This function is not part of the public interface.

Definition at line 1613 of file qwindowsystem_qws.cpp.

1614 {
1615  if (keyboardGrabber == w) {
1616  keyboardGrabber = 0;
1617  keyboardGrabbing = false;
1618  }
1619 }
static bool keyboardGrabbing
static QWSWindow * keyboardGrabber

◆ releaseMouse()

void QWSServerPrivate::releaseMouse ( QWSWindow w)
private
Warning
This function is not part of the public interface.

Definition at line 1595 of file qwindowsystem_qws.cpp.

Referenced by sendMouseEventUnfiltered().

1596 {
1597  if (w && mouseGrabber == w) {
1598  mouseGrabber = 0;
1599  mouseGrabbing = false;
1600 #ifndef QT_NO_QWS_CURSOR
1601  if (nextCursor) {
1602  // Not grabbing -> set the correct cursor
1604  nextCursor = 0;
1605  }
1606 #endif
1607  }
1608 }
QWSCursor * nextCursor
QWSWindow * mouseGrabber
void setCursor(QWSCursor *curs)

◆ repaint_region()

void QWSServerPrivate::repaint_region ( int  winId,
int  windowFlags,
bool  opaque,
const QRegion region 
)
private

Definition at line 3954 of file qwindowsystem_qws.cpp.

3956 {
3957  QWSWindow* changingw = findWindow(wid, 0);
3958  if (!changingw) {
3959  return;
3960  }
3961 
3962  const bool isOpaque = changingw->opaque;
3963  const bool wasPainted = changingw->d->painted;
3964  changingw->opaque = opaque;
3965  changingw->d->windowFlags = QFlag(windowFlags);
3966  changingw->d->dirtyOnScreen |= region;
3967  changingw->d->painted = true;
3968  if (isOpaque != opaque || !wasPainted)
3969  update_regions();
3970 
3971  int level = windows.indexOf(changingw);
3972  exposeRegion(region, level);
3973  changingw->d->dirtyOnScreen = QRegion();
3974 }
The QFlag class is a helper data type for QFlags.
Definition: qglobal.h:2289
void exposeRegion(const QRegion &, int index=0)
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
Qt::WindowFlags windowFlags
QWSWindow * findWindow(int windowid, QWSClient *client=0)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QWSWindowPrivate * d
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
QList< QWSWindow * > windows

◆ request_focus()

void QWSServerPrivate::request_focus ( const QWSRequestFocusCommand cmd)
private

Definition at line 3944 of file qwindowsystem_qws.cpp.

3945 {
3946  invokeSetFocus(cmd, clientMap.value(-1));
3947 }
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
void invokeSetFocus(const QWSRequestFocusCommand *cmd, QWSClient *client)

◆ request_region()

void QWSServerPrivate::request_region ( int  winId,
const QString surfaceKey,
const QByteArray surfaceData,
const QRegion region 
)
private

Definition at line 3994 of file qwindowsystem_qws.cpp.

3997 {
3998  QWSWindow *changingw = findWindow(wid, 0);
3999  if (!changingw)
4000  return;
4001 
4002  Q_Q(QWSServer);
4003  QWSWindow::State windowState = QWSWindow::NoState;
4004 
4005  if (region.isEmpty()) {
4006  windowState = QWSWindow::Hiding;
4007  emit q->windowEvent(changingw, QWSServer::Hide);
4008  }
4009 
4010  const bool wasOpaque = changingw->opaque;
4011 
4012  QWSWindowSurface *surface = changingw->windowSurface();
4013  if (!surface) {
4014  changingw->createSurface(surfaceKey, surfaceData);
4015  surface = changingw->windowSurface();
4016  } else {
4017  surface->setPermanentState(surfaceData);
4018  }
4019 
4020  changingw->opaque = surface->isOpaque();
4021 
4022  QRegion r;
4023  if (surface->isRegionReserved())
4024  r = reserve_region(changingw, region);
4025  else
4026  r = region;
4027 
4028  if (!region.isEmpty()) {
4029  if (changingw->isVisible())
4030  windowState = QWSWindow::ChangingGeometry;
4031  else
4032  windowState = QWSWindow::Showing;
4033  }
4034  changingw->d->state = windowState;
4035 
4036  if (!r.isEmpty() && wasOpaque != changingw->opaque && surface->isBuffered())
4037  changingw->requested_region = QRegion(); // XXX: force update_regions
4038 
4039  const QRegion oldAllocated = changingw->allocatedRegion();
4040  setWindowRegion(changingw, r);
4041  if (oldAllocated == changingw->allocatedRegion()) {
4042  // Always send region event to the requesting window even if the
4043  // region didn't change. This is necessary as the client will reset
4044  // the clip region until an event is received.
4045  changingw->client()->sendRegionEvent(wid, changingw->allocatedRegion(),
4047  }
4048 
4049  surface->QWindowSurface::setGeometry(r.boundingRect());
4050 
4051  if (windowState == QWSWindow::Showing)
4052  emit q->windowEvent(changingw, QWSServer::Show);
4053  else if (windowState == QWSWindow::ChangingGeometry)
4054  emit q->windowEvent(changingw, QWSServer::Geometry);
4055  if (windowState == QWSWindow::Hiding) {
4056  handleWindowClose(changingw);
4057  changingw->d->state = QWSWindow::Hidden;
4058  changingw->d->painted = false;
4059  } else {
4060  changingw->d->state = QWSWindow::Visible;
4061  }
4062 }
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 QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
State
This enum describes the state of a window.
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
QRegion requested_region
void createSurface(const QString &key, const QByteArray &data)
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
QWSWindow * findWindow(int windowid, QWSClient *client=0)
#define emit
Definition: qobjectdefs.h:76
void handleWindowClose(QWSWindow *w)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
QWSWindowPrivate * d
void sendRegionEvent(int winid, QRegion rgn, int type)
bool isVisible() const
Returns true if the window is visible; otherwise returns false.
QRegion reserve_region(QWSWindow *window, const QRegion &region)
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
bool isOpaque() const
Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false.
bool isRegionReserved() const
Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false.
QWSWindowSurface * windowSurface() const
QWSWindow::State state
virtual void setPermanentState(const QByteArray &state)
Implement this function to attach a server-side surface instance to the corresponding client side ins...

◆ reserve_region()

QRegion QWSServerPrivate::reserve_region ( QWSWindow window,
const QRegion region 
)
private

Definition at line 3976 of file qwindowsystem_qws.cpp.

3977 {
3978  QRegion r = region;
3979 
3980  int oldPos = windows.indexOf(win);
3981  int newPos = oldPos < nReserved ? nReserved - 1 : nReserved;
3982  for (int i = 0; i < nReserved; ++i) {
3983  if (i != oldPos) {
3984  QWSWindow *w = windows.at(i);
3985  r -= w->requested_region;
3986  }
3987  }
3988  windows.move(oldPos, newPos);
3989  nReserved = newPos + 1;
3990 
3991  return r;
3992 }
QRegion requested_region
void move(int from, int to)
Moves the item at index position from to index position to.
Definition: qlist.h:628
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
QList< QWSWindow * > windows

◆ resetEngine()

void QWSServerPrivate::resetEngine ( )
private

Definition at line 2736 of file qwindowsystem_qws.cpp.

2737 {
2738 #ifndef QT_NO_QWS_CURSOR
2739  if (!qt_screencursor)
2740  return;
2741  qt_screencursor->hide();
2742  qt_screencursor->show();
2743 #endif
2744 }
virtual void hide()
Hides the cursor from the screen.
Q_GUI_EXPORT QScreenCursor * qt_screencursor
Definition: qscreen_qws.cpp:67
virtual void show()
Shows the mouse cursor.

◆ screenSave()

void QWSServerPrivate::screenSave ( int  level)
private

Definition at line 4481 of file qwindowsystem_qws.cpp.

4482 {
4483  if (saver) {
4484  // saver->save() may call QCoreApplication::processEvents,
4485  // block event before calling saver->save().
4486  bool oldScreensaverblockevents = screensaverblockevents;
4487  if (*screensaverinterval >= 1000) {
4489 #ifdef EVENT_BLOCK_DEBUG
4491  qDebug("ready to block events");
4492 #endif
4493  }
4494  int *oldScreensaverinterval = screensaverinterval;
4495  if (saver->save(level)) {
4496  // only update screensaverinterval if it hasn't already changed
4497  if (oldScreensaverinterval == screensaverinterval) {
4501  } else {
4502  screensaverinterval = 0;
4503  }
4504  }
4505  } else {
4506  // restore previous state
4507  screensaverblockevents = oldScreensaverblockevents;
4508 
4509  // for some reason, the saver don't want us to change to the
4510  // next level, so we'll stay at this level for another interval
4514  }
4515  }
4516  } else {
4517  screensaverinterval = 0;//screensaverintervals;
4518  screensaverblockevents = false;
4520  }
4521 }
void start()
Sets this time to the current time.
Definition: qdatetime.cpp:2070
Q_CORE_EXPORT void qDebug(const char *,...)
QTimer * screensavertimer
QWSScreenSaver * saver
void start(int msec)
Starts or restarts the timer with a timeout interval of msec milliseconds.
Definition: qtimer.cpp:249
virtual bool save(int level)=0
Implement this function to activate the screensaver, saving the current screen.

◆ screensaverblockevent()

bool QWSServerPrivate::screensaverblockevent ( int  index,
int *  screensaverinterval,
bool  isDown 
)

Definition at line 1431 of file qwindowsystem_qws.cpp.

Referenced by QWSServer::processKeyEvent(), and QWSServer::sendMouseEvent().

1432 {
1433  static bool ignoreEvents[2] = { false, false };
1434  if ( isDown ) {
1435  if ( !ignoreEvents[index] ) {
1436  bool wake = false;
1437  if ( screensaverintervals ) {
1439  wake = true;
1440  }
1441  }
1442  if ( screensaverblockevents && wake ) {
1443 #ifdef EVENT_BLOCK_DEBUG
1444  qDebug( "waking the screen" );
1445 #endif
1446  ignoreEvents[index] = true;
1447  } else if ( !screensaverblockevents ) {
1448 #ifdef EVENT_BLOCK_DEBUG
1449  qDebug( "the screen was already awake" );
1450 #endif
1451  ignoreEvents[index] = false;
1452  }
1453  }
1454  } else {
1455  if ( ignoreEvents[index] ) {
1456 #ifdef EVENT_BLOCK_DEBUG
1457  qDebug( "mouseup?" );
1458 #endif
1459  ignoreEvents[index] = false;
1460  return true;
1461  }
1462  }
1463  return ignoreEvents[index];
1464 }
Q_CORE_EXPORT void qDebug(const char *,...)
quint16 index

◆ send_im_mouse()

void QWSServerPrivate::send_im_mouse ( const QWSIMMouseCommand cmd)
private

Definition at line 4085 of file qwindowsystem_qws.cpp.

4086 {
4087  if (current_IM)
4089 }
struct QWSIMMouseCommand::SimpleData simpleData
static QWSInputMethod * current_IM
virtual void mouseHandler(int pos, int state)
Handles mouse events within the preedit text.

◆ sendFontRemovedEvent()

void QWSServerPrivate::sendFontRemovedEvent ( const QByteArray font)
private

Definition at line 1896 of file qwindowsystem_qws.cpp.

1897 {
1899  event.simpleData.type = QWSFontEvent::FontRemoved;
1900  event.setData(font.constData(), font.length(), false);
1901 
1903  for (; it != clientMap.constEnd(); ++it)
1904  (*it)->sendEvent(&event);
1905 }
EventRef event
#define it(className, varName)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
int length() const
Same as size().
Definition: qbytearray.h:356
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:380
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67

◆ sendKeyEventUnfiltered()

void QWSServerPrivate::sendKeyEventUnfiltered ( int  unicode,
int  keycode,
Qt::KeyboardModifiers  modifiers,
bool  isPress,
bool  autoRepeat 
)
staticprivate

Definition at line 2671 of file qwindowsystem_qws.cpp.

Referenced by QWSServer::sendKeyEvent().

2673 {
2675 
2676 #ifndef QT_NO_QWS_KEYBOARD
2677  if (unicode < 0)
2678  unicode = keyUnicode(keycode);
2679 #endif
2680 
2682  event.simpleData.window = win ? win->winId() : 0;
2683  event.simpleData.unicode = unicode;
2684  event.simpleData.keycode = keycode;
2685  event.simpleData.modifiers = modifiers;
2686  event.simpleData.is_press = isPress;
2687  event.simpleData.is_auto_repeat = autoRepeat;
2688 
2689  QWSClient *serverClient = qwsServerPrivate->clientMap.value(-1);
2690  QWSClient *winClient = win ? win->client() : 0;
2691  if (serverClient)
2692  serverClient->sendEvent(&event);
2693  if (winClient && winClient != serverClient)
2694  winClient->sendEvent(&event);
2695 }
void sendEvent(QWSEvent *event)
EventRef event
int keycode
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
QWSWindow * focusw
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
static int keyUnicode(int keycode)
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
static QWSServerPrivate * qwsServerPrivate
int winId() const
Returns the window&#39;s ID.
static QWSWindow * keyboardGrabber
The QWSClient class encapsulates a client process in Qt for Embedded Linux.

◆ sendMaxWindowRectEvents()

void QWSServerPrivate::sendMaxWindowRectEvents ( const QRect rect)
private
Warning
This function is not part of the public interface.

Definition at line 2272 of file qwindowsystem_qws.cpp.

Referenced by QWSServer::setMaxWindowRect().

2273 {
2275  for (; it != clientMap.constEnd(); ++it)
2276  (*it)->sendMaxWindowRectEvent(rect);
2277 }
#define it(className, varName)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the map.
Definition: qmap.h:374
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the map...
Definition: qmap.h:380
The QMap class is a template class that provides a skip-list-based dictionary.
Definition: qdatastream.h:67

◆ sendMouseEventUnfiltered()

void QWSServerPrivate::sendMouseEventUnfiltered ( const QPoint pos,
int  state,
int  wheel = 0 
)
staticprivate

Definition at line 2388 of file qwindowsystem_qws.cpp.

Referenced by QWSServer::sendMouseEvent(), and QWSInputMethod::sendMouseEvent().

2389 {
2390  const int btnMask = Qt::LeftButton | Qt::RightButton | Qt::MidButton;
2392 
2393  QWSWindow *win = qwsServer->windowAt(pos);
2394 
2395  QWSClient *serverClient = qwsServerPrivate->clientMap.value(-1);
2396  QWSClient *winClient = win ? win->client() : 0;
2397 
2398 
2399  bool imMouse = false;
2400 #ifndef QT_NO_QWS_INPUTMETHODS
2401  // check for input method window
2402  if (current_IM && current_IM_winId != -1) {
2405 
2406  imMouse = kbw == win;
2407  if ( !imMouse ) {
2408  QWidget *target = winClient == serverClient ?
2409  QApplication::widgetAt(pos) : 0;
2410  imMouse = target && (target->testAttribute(Qt::WA_InputMethodTransparent));
2411  }
2412  }
2413 #endif
2414 
2415  //If grabbing window disappears, grab is still active until
2416  //after mouse release.
2419  winClient = win ? win->client() : 0;
2420  }
2421  event.simpleData.window = win ? win->id : 0;
2422 
2423 #ifndef QT_NO_QWS_CURSOR
2424  if (qt_screencursor)
2425  qt_screencursor->move(pos.x(),pos.y());
2426 
2427  // Arrow cursor over desktop
2428  // prevWin remembers if the last event was over a window
2429  if (!win && prevWin) {
2432  else
2434  prevWin = false;
2435  }
2436  // reset prevWin
2437  if (win && !prevWin)
2438  prevWin = true;
2439 #endif
2440 
2441  if ((state&btnMask) && !qwsServerPrivate->mouseGrabbing) {
2443  if (imMouse)
2445  }
2446  if (!(state&btnMask))
2448 
2449  event.simpleData.x_root=pos.x();
2450  event.simpleData.y_root=pos.y();
2451  event.simpleData.state=state | qws_keyModifiers;
2452  event.simpleData.delta = wheel;
2453  event.simpleData.time=qwsServerPrivate->timer.elapsed();
2454 
2455  static int oldstate = 0;
2456 
2457 #ifndef QT_NO_QWS_INPUTMETHODS
2458  //tell the input method if we click on a different window that is not IM transparent
2459  bool isPress = state > oldstate;
2460  if (isPress && !imMouse && current_IM && current_IM_winId != -1)
2462 #endif
2463 
2464  if (serverClient)
2465  serverClient->sendEvent(&event);
2466  if (winClient && winClient != serverClient)
2467  winClient->sendEvent(&event);
2468 
2469  if ( !imMouse ) {
2470  // Make sure that if we leave a window, that window gets one last mouse
2471  // event so that it knows the mouse has left.
2472  QWSClient *oldClient = qwsServer->d_func()->cursorClient;
2473  if (oldClient && oldClient != winClient && oldClient != serverClient) {
2474  event.simpleData.state = oldstate | qws_keyModifiers;
2475  oldClient->sendEvent(&event);
2476  }
2477  }
2478 
2479  oldstate = state;
2480  if ( !imMouse )
2481  qwsServer->d_func()->cursorClient = winClient;
2482 
2483  if (!(state&btnMask) && !qwsServerPrivate->mouseGrabbing)
2485 }
void sendEvent(QWSEvent *event)
virtual void move(int x, int y)
Moves the mouse cursor to the given position, i.e., (x, y).
QWSCursor * nextCursor
EventRef event
static QWSCursor * systemCursor(int id)
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
static bool prevWin
static int current_IM_winId
QWSWindow * focusw
static QWSInputMethod * current_IM
virtual void mouseHandler(int pos, int state)
Handles mouse events within the preedit text.
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
static QWidget * widgetAt(const QPoint &p)
Returns the widget at global screen position point, or 0 if there is no Qt widget there...
bool testAttribute(Qt::WidgetAttribute) const
Returns true if attribute attribute is set on this widget; otherwise returns false.
Definition: qwidget.h:1041
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
static int qws_keyModifiers
void releaseMouse(QWSWindow *w)
QWSWindow * windowAt(const QPoint &pos)
Returns the window containing the given position.
static QWSServerPrivate * qwsServerPrivate
int elapsed() const
Returns the number of milliseconds that have elapsed since the last time start() or restart() was cal...
Definition: qdatetime.cpp:2123
QWSWindow * mouseGrabber
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
static QWSWindow * keyboardGrabber
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
Q_GUI_EXPORT QScreenCursor * qt_screencursor
Definition: qscreen_qws.cpp:67
The QWSClient class encapsulates a client process in Qt for Embedded Linux.
QWSServer Q_GUI_EXPORT * qwsServer
static Qt::KeyboardModifiers oldstate
Definition: qdnd_qws.cpp:87
void setCursor(QWSCursor *curs)

◆ sendQCopEvent()

void QWSServerPrivate::sendQCopEvent ( QWSClient c,
const QString ch,
const QString msg,
const QByteArray data,
bool  response = false 
)
staticprivate
Warning
This function is not part of the public interface.

Definition at line 2564 of file qwindowsystem_qws.cpp.

Referenced by QCopChannel::answer().

2567 {
2568  Q_ASSERT(c);
2569 
2571  event.channel = ch.toLatin1();
2572  event.message = msg.toLatin1();
2573  event.data = data;
2574  event.simpleData.is_response = response;
2575  event.simpleData.lchannel = ch.length();
2576  event.simpleData.lmessage = msg.length();
2577  event.simpleData.ldata = data.size();
2578  int l = event.simpleData.lchannel + event.simpleData.lmessage +
2579  event.simpleData.ldata;
2580 
2581  // combine channel, message and data into one block of raw bytes
2582  char *tmp = new char [l];
2583  char *d = tmp;
2584  memcpy(d, event.channel.constData(), event.simpleData.lchannel);
2585  d += event.simpleData.lchannel;
2586  memcpy(d, event.message.constData(), event.simpleData.lmessage);
2587  d += event.simpleData.lmessage;
2588  memcpy(d, data.constData(), event.simpleData.ldata);
2589 
2590  event.setDataDirect(tmp, l);
2591 
2592  c->sendEvent(&event);
2593 }
void sendEvent(QWSEvent *event)
double d
Definition: qnumeric_p.h:62
EventRef event
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static const char * data(const QByteArray &arr)
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
QFactoryLoader * l
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402

◆ set_altitude()

void QWSServerPrivate::set_altitude ( const QWSChangeAltitudeCommand cmd)
private

Definition at line 3931 of file qwindowsystem_qws.cpp.

3932 {
3933  QWSClient *serverClient = clientMap.value(-1);
3934  invokeSetAltitude(cmd, serverClient);
3935 }
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
void invokeSetAltitude(const QWSChangeAltitudeCommand *cmd, QWSClient *client)
The QWSClient class encapsulates a client process in Qt for Embedded Linux.

◆ set_identity()

void QWSServerPrivate::set_identity ( const QWSIdentifyCommand cmd)
private

Definition at line 3949 of file qwindowsystem_qws.cpp.

3950 {
3951  invokeIdentify(cmd, clientMap.value(-1));
3952 }
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
void invokeIdentify(const QWSIdentifyCommand *cmd, QWSClient *client)

◆ set_opacity()

void QWSServerPrivate::set_opacity ( const QWSSetOpacityCommand cmd)
private

Definition at line 3937 of file qwindowsystem_qws.cpp.

3938 {
3939  QWSClient *serverClient = clientMap.value(-1);
3940  invokeSetOpacity(cmd, serverClient);
3941 }
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
void invokeSetOpacity(const QWSSetOpacityCommand *cmd, QWSClient *client)
The QWSClient class encapsulates a client process in Qt for Embedded Linux.

◆ setCursor()

void QWSServerPrivate::setCursor ( QWSCursor curs)
private

Definition at line 352 of file qwscursor_qws.cpp.

Referenced by initializeCursor(), sendMouseEventUnfiltered(), and QWSServer::setCursorVisible().

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)
364 
365  if (qt_screencursor) {
366  qt_screencursor->set(curs->image(),
367  curs->hotSpot().x(),
368  curs->hotSpot().y());
369  }
370 #endif
371 }
static QWSCursor * systemCursor(int id)
QImage & image()
Definition: qwscursor_qws.h:66
QWSCursor * cursor
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
Q_GUI_EXPORT QScreenCursor * qt_screencursor
Definition: qscreen_qws.cpp:67
QPoint hotSpot() const
Definition: qwscursor_qws.h:65
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
virtual void set(const QImage &image, int hotx, int hoty)
Sets the cursor&#39;s image to be the given image.

◆ setFocus()

void QWSServerPrivate::setFocus ( QWSWindow changingw,
bool  gain 
)
private

Definition at line 3029 of file qwindowsystem_qws.cpp.

Referenced by QWSWindow::setActiveWindow().

3030 {
3031  Q_Q(QWSServer);
3032 #ifndef QT_NO_QWS_INPUTMETHODS
3033  /*
3034  This is the logic:
3035  QWSWindow *loser = 0;
3036  if (gain && focusw != changingw)
3037  loser = focusw;
3038  else if (!gain && focusw == changingw)
3039  loser = focusw;
3040  But these five lines can be reduced to one:
3041  */
3042  if (current_IM) {
3043  QWSWindow *loser = (!gain == (focusw==changingw)) ? focusw : 0;
3044  if (loser && loser->winId() == current_IM_winId)
3046  }
3047 #endif
3048  if (gain) {
3049  if (focusw != changingw) {
3050  if (focusw) focusw->focus(0);
3051  focusw = changingw;
3052  focusw->focus(1);
3053  emit q->windowEvent(focusw, QWSServer::Active);
3054  }
3055  } else if (focusw == changingw) {
3056  if (changingw->client())
3057  changingw->focus(0);
3058  focusw = 0;
3059  // pass focus to window which most recently got it...
3060  QWSWindow* bestw=0;
3061  for (int i=0; i<windows.size(); ++i) {
3062  QWSWindow* w = windows.at(i);
3063  if (w != changingw && !w->hidden() &&
3064  (!bestw || bestw->focusPriority() < w->focusPriority()))
3065  bestw = w;
3066  }
3067  if (!bestw && changingw->focusPriority()) { // accept focus back?
3068  bestw = changingw; // must be the only one
3069  }
3070  focusw = bestw;
3071  if (focusw) {
3072  focusw->focus(1);
3073  emit q->windowEvent(focusw, QWSServer::Active);
3074  }
3075  }
3076 }
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
static int current_IM_winId
QWSWindow * focusw
bool hidden() const
static QWSInputMethod * current_IM
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
void focus(bool get)
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
int focusPriority() const
virtual void updateHandler(int type)
Handles update events including resets and focus changes.
int winId() const
Returns the window&#39;s ID.
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QList< QWSWindow * > windows
int size() const
Returns the number of items in the list.
Definition: qlist.h:137

◆ setWindowRegion()

void QWSServerPrivate::setWindowRegion ( QWSWindow changingw,
const QRegion r 
)
private

Changes the requested region of window changingw to r If changingw is 0, the server's reserved region is changed.

Definition at line 3681 of file qwindowsystem_qws.cpp.

3682 {
3683  if (!changingw) {
3684  qWarning("Not implemented in this release");
3685  return;
3686  }
3687 
3688  if (changingw->requested_region == r)
3689  return;
3690 
3691  const QRegion oldRegion(changingw->allocatedRegion());
3692  changingw->requested_region = r;
3693  update_regions();
3694  const QRegion newRegion(changingw->allocatedRegion());
3695 
3696  int idx = windows.indexOf(changingw);
3697  exposeRegion(oldRegion - newRegion, idx);
3698 }
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
QRegion requested_region
void exposeRegion(const QRegion &, int index=0)
Q_CORE_EXPORT void qWarning(const char *,...)
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
int indexOf(const T &t, int from=0) const
Returns the index position of the first occurrence of value in the list, searching forward from index...
Definition: qlist.h:847
QList< QWSWindow * > windows

◆ showCursor()

void QWSServerPrivate::showCursor ( )
private

Definition at line 2141 of file qwindowsystem_qws.cpp.

2142 {
2143 #ifndef QT_NO_QWS_CURSOR
2144  if (qt_screencursor)
2145  qt_screencursor->show();
2146 #endif
2147 }
Q_GUI_EXPORT QScreenCursor * qt_screencursor
Definition: qscreen_qws.cpp:67
virtual void show()
Shows the mouse cursor.

◆ update_regions()

void QWSServerPrivate::update_regions ( )

Definition at line 3579 of file qwindowsystem_qws.cpp.

Referenced by QWSServer::updateWindowRegions().

3580 {
3581  if (disablePainting)
3582  return;
3583 
3584  QRegion available = QRect(0, 0, qt_screen->width(), qt_screen->height());
3585  QRegion transparentRegion;
3586 
3587  // only really needed if there are unbuffered surfaces...
3588  const bool doLock = (clientMap.size() > 1);
3589  if (doLock)
3590  QWSDisplay::grab(true);
3591 
3592  for (int i = 0; i < windows.count(); ++i) {
3593  QWSWindow *w = windows.at(i);
3594  QRegion r = (w->requested_region & available);
3595 
3596 #ifndef QT_NO_QWSEMBEDWIDGET
3597  // Subtract regions needed for embedded windows
3598  const int n = w->d->embedded.size();
3599  for (int i = 0; i < n; ++i)
3600  r -= w->d->embedded.at(i)->allocatedRegion();
3601 
3602  // Limited to the embedder region
3603  if (w->d->embedder)
3604  r &= w->d->embedder->requested_region;
3605 #endif // QT_NO_QWSEMBEDWIDGET
3606 
3607  QWSWindowSurface *surface = w->windowSurface();
3608  const bool opaque = w->isOpaque()
3609  && (w->d->painted || !surface || !surface->isBuffered());
3610 
3611  if (!opaque) {
3612  transparentRegion += r;
3613  } else {
3614  if (surface && (surface->isRegionReserved() || !surface->isBuffered()))
3615  r -= transparentRegion;
3616  available -= r;
3617  }
3618 
3619  if (r != w->allocatedRegion()) {
3620  w->setAllocatedRegion(r);
3621  w->client()->sendRegionEvent(w->winId(), r,
3623  }
3624 
3625 #ifdef QT_QWS_CLIENTBLIT
3626 #ifdef QT_NO_QWS_CURSOR
3627  // This optimization only really works when there isn't a crazy cursor
3628  // wizzing around.
3629  QRegion directPaint = (r - transparentRegion); // in gloal coords
3630  if(directPaint != w->directPaintRegion()) {
3631  w->setDirectPaintRegion(directPaint);
3632  static int id = 0;
3633  surface->setDirectRegion(directPaint, ++id);
3634  w->client()->sendRegionEvent(w->winId(), directPaint,
3635  QWSRegionEvent::DirectPaint, id);
3636  }
3637 #endif
3638 #endif
3639  }
3640 
3641  if (doLock)
3643 }
void setAllocatedRegion(const QRegion &region)
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
int size() const
Returns the number of (key, value) pairs in the map.
Definition: qmap.h:201
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
QRegion allocatedRegion() const
Returns the region that the window is allowed to draw onto, including any window decorations but excl...
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
QRegion requested_region
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
static void grab()
QWSWindowPrivate * d
QList< QWSWindow * > embedded
void sendRegionEvent(int winid, QRegion rgn, int type)
int winId() const
Returns the window&#39;s ID.
QList< QWSWindow * > windows
bool isRegionReserved() const
Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QWSWindowSurface * windowSurface() const
static void ungrab()
bool isOpaque() const
Returns true if the window is opaque, i.

◆ updateClientCursorPos()

void QWSServerPrivate::updateClientCursorPos ( )
private

Definition at line 4578 of file qwindowsystem_qws.cpp.

4579 {
4580  Q_Q(QWSServer);
4582  QWSClient *winClient = win ? win->client() : 0;
4583  if (winClient && winClient != cursorClient)
4584  q->sendMouseEvent(QWSServer::mousePosition, mouseState);
4585 }
QWSClient * client() const
Returns a reference to the QWSClient object that owns this window.
QWSClient * cursorClient
#define Q_Q(Class)
Definition: qglobal.h:2483
The QWSWindow class encapsulates a top-level window in Qt for Embedded Linux.
QWSWindow * windowAt(const QPoint &pos)
Returns the window containing the given position.
static QWSServerPrivate * qwsServerPrivate
The QWSServer class encapsulates a server process in Qt for Embedded Linux.
QWSWindow * mouseGrabber
static QPoint mousePosition
The QWSClient class encapsulates a client process in Qt for Embedded Linux.
QWSServer Q_GUI_EXPORT * qwsServer

Friends and Related Functions

◆ QCopChannel

friend class QCopChannel
friend

Definition at line 67 of file qwindowsystem_p.h.

◆ QWSDisplay

friend class QWSDisplay
friend

Definition at line 70 of file qwindowsystem_p.h.

◆ QWSInputMethod

friend class QWSInputMethod
friend

Definition at line 71 of file qwindowsystem_p.h.

◆ QWSMouseHandler

friend class QWSMouseHandler
friend

Definition at line 68 of file qwindowsystem_p.h.

◆ QWSWindow

friend class QWSWindow
friend

Definition at line 69 of file qwindowsystem_p.h.

Properties

◆ bgBrush

QBrush * QWSServerPrivate::bgBrush = 0
staticprivate

◆ channels

QMap<QString, QList<QWSClient*> > QWSServerPrivate::channels
private

Definition at line 294 of file qwindowsystem_p.h.

◆ clientMap

ClientMap QWSServerPrivate::clientMap
private

◆ commandQueue

QList<QWSCommandStruct*> QWSServerPrivate::commandQueue
private

Definition at line 274 of file qwindowsystem_p.h.

◆ crashedClientIds

QList<int> QWSServerPrivate::crashedClientIds

Definition at line 107 of file qwindowsystem_p.h.

◆ cursor

QWSCursor* QWSServerPrivate::cursor
private

◆ cursorClient

QWSClient* QWSServerPrivate::cursorClient

Definition at line 103 of file qwindowsystem_p.h.

◆ deletedWindows

QList<QWSWindow*> QWSServerPrivate::deletedWindows

Definition at line 106 of file qwindowsystem_p.h.

Referenced by ~QWSServerPrivate().

◆ disablePainting

bool QWSServerPrivate::disablePainting
private

Definition at line 268 of file qwindowsystem_p.h.

◆ doClientIsActive

bool QWSServerPrivate::doClientIsActive
private

Definition at line 309 of file qwindowsystem_p.h.

◆ focusw

QWSWindow* QWSServerPrivate::focusw
private

◆ fontCleanupTimer

QBasicTimer QWSServerPrivate::fontCleanupTimer
private

Definition at line 303 of file qwindowsystem_p.h.

◆ fontReferenceCount

QMap<QByteArray, int> QWSServerPrivate::fontReferenceCount
private

Definition at line 302 of file qwindowsystem_p.h.

◆ haveviscurs

bool QWSServerPrivate::haveviscurs
private

◆ inputMethodMouseGrabbed

bool QWSServerPrivate::inputMethodMouseGrabbed
private

Definition at line 260 of file qwindowsystem_p.h.

Referenced by sendMouseEventUnfiltered().

◆ keyboardhandlers

QList<QWSKeyboardHandler*> QWSServerPrivate::keyboardhandlers
private

Definition at line 271 of file qwindowsystem_p.h.

Referenced by QWSServer::keyboardHandler(), and QWSServer::setKeyboardHandler().

◆ mouseGrabber

QWSWindow* QWSServerPrivate::mouseGrabber
private

Definition at line 258 of file qwindowsystem_p.h.

Referenced by sendMouseEventUnfiltered(), and updateClientCursorPos().

◆ mouseGrabbing

bool QWSServerPrivate::mouseGrabbing
private

Definition at line 259 of file qwindowsystem_p.h.

Referenced by sendMouseEventUnfiltered().

◆ mousehandlers

QList<QWSMouseHandler*> QWSServerPrivate::mousehandlers
private

◆ mouseState

int QWSServerPrivate::mouseState

Definition at line 104 of file qwindowsystem_p.h.

Referenced by QWSServer::sendMouseEvent(), and QWSInputMethod::sendMouseEvent().

◆ nextCursor

QWSCursor* QWSServerPrivate::nextCursor
private

Definition at line 265 of file qwindowsystem_p.h.

Referenced by sendMouseEventUnfiltered().

◆ nReserved

int QWSServerPrivate::nReserved
private

Definition at line 278 of file qwindowsystem_p.h.

◆ pendingDoClients

QList<QWSClient*> QWSServerPrivate::pendingDoClients
private

Definition at line 310 of file qwindowsystem_p.h.

◆ propertyManager

QWSPropertyManager QWSServerPrivate::propertyManager
private

Definition at line 243 of file qwindowsystem_p.h.

◆ ramlen

int QWSServerPrivate::ramlen
private

Definition at line 239 of file qwindowsystem_p.h.

◆ saver

QWSScreenSaver* QWSServerPrivate::saver

Definition at line 102 of file qwindowsystem_p.h.

Referenced by QWSServer::setScreenSaver(), and ~QWSServerPrivate().

◆ screensaverblockevents

bool QWSServerPrivate::screensaverblockevents

Definition at line 100 of file qwindowsystem_p.h.

◆ screensavereventblocklevel

int QWSServerPrivate::screensavereventblocklevel

Definition at line 99 of file qwindowsystem_p.h.

Referenced by QWSServer::setScreenSaverBlockLevel().

◆ screensaverinterval

int* QWSServerPrivate::screensaverinterval
private

◆ screensaverintervals

int* QWSServerPrivate::screensaverintervals

Definition at line 98 of file qwindowsystem_p.h.

Referenced by QWSServer::setScreenSaverIntervals(), and ~QWSServerPrivate().

◆ screensavertime

QTime QWSServerPrivate::screensavertime

Definition at line 96 of file qwindowsystem_p.h.

◆ screensavertimer

QTimer* QWSServerPrivate::screensavertimer

◆ sdepth

int QWSServerPrivate::sdepth
private

Definition at line 261 of file qwindowsystem_p.h.

◆ selectionOwner

struct QWSServerPrivate::SelectionOwner QWSServerPrivate::selectionOwner
private

◆ sharedram

uchar* QWSServerPrivate::sharedram
private

Definition at line 238 of file qwindowsystem_p.h.

◆ sheight

int QWSServerPrivate::sheight
private

Definition at line 261 of file qwindowsystem_p.h.

Referenced by QWSServer::endDisplayReconfigure(), and initializeCursor().

◆ soundserver

QWSSoundServer* QWSServerPrivate::soundserver
private

Definition at line 291 of file qwindowsystem_p.h.

◆ ssocket

QWSServerSocket* QWSServerPrivate::ssocket
private

Definition at line 298 of file qwindowsystem_p.h.

◆ swidth

int QWSServerPrivate::swidth
private

Definition at line 261 of file qwindowsystem_p.h.

Referenced by QWSServer::endDisplayReconfigure(), and initializeCursor().

◆ timer

QTime QWSServerPrivate::timer
private

Definition at line 254 of file qwindowsystem_p.h.

Referenced by sendMouseEventUnfiltered().

◆ windows

QList<QWSWindow*> QWSServerPrivate::windows
private

Definition at line 277 of file qwindowsystem_p.h.

Referenced by QWSServer::windowList(), and ~QWSServerPrivate().


The documentation for this class was generated from the following files: