⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qwindowsystem_qws.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    event.simpleData.requestor = cmd->simpleData.requestor;    event.simpleData.property = cmd->simpleData.selection;    event.simpleData.mimeTypes = cmd->simpleData.mimeTypes;    sendEvent(&event);}#ifndef QT_NO_QWSEMBEDWIDGET/*!   \internal*/void QWSClient::sendEmbedEvent(int windowid, QWSEmbedEvent::Type type,                               const QRegion &region){    QWSEmbedEvent event;    event.setData(windowid, type, region);    sendEvent(&event);}#endif // QT_NO_QWSEMBEDWIDGET/*!   \fn void QWSClient::connectionClosed()   \internal*//*!    \fn void QWSClient::readyRead();    \internal*//*!   \fn int QWSClient::clientId () const   Returns an integer uniquely identfying this client.*//*!   \fn QString QWSClient::identity () const   Returns the name of this client's running application.*//********************************************************************* * * Class: QWSServer * *********************************************************************//*!    \class QWSServer    \brief The QWSServer class encapsulates a server process in Qtopia    Core.    \ingroup qws    When you run a \l {Qtopia Core} application, it either runs as a    server or connects to an existing server. The server and client    processes have different responsibilities: The client process    performs all application specific operations. The server process    is responsible for managing the clients as well as taking care of    the pointer handling, character input, and screen output. In    addition, the server provides functionality to handle input    methods.    In \l {Qtopia Core}, all system generated events are passed to the    server application which then propagates the event to the    appropriate client. See the \l {Qtopia Core Architecture}    documentation for details.    Note that this class is instantiated by QApplication for \l    {Qtopia Core} server processes; you should never construct this    class yourself. Use the instance() function to retrieve a pointer    to the server object.    Note that the static functions of the QWSServer class can only be    used in the server process.    \tableofcontents    \section1 Client Administration    As applications add and remove windows, the server process    maintains information about each window. In \l {Qtopia Core},    top-level windows are encapsulated as QWSWindow objects. Each    window can tell which client that owns it through its    QWSWindow::client() function. Use the clientWindows() function to    retrieve a list of the current top-level windows. Given a    particular position on the display, the window containing it can    be retrieved using the windowAt() function.    QWSServer also provides the windowEvent() signal which is emitted    whenever something happens to a top level window; the WindowEvent    enum describes the various types of events that the signal    recognizes. In addition, the server class provides the    markedText() signal which is emitted whenever some text has been    selected in any of the windows, passing the selection as    parameter.    The QCopChannel class and the QCOP communication protocol enable    transfer of messages between clients. QWSServer provides the    newChannel() and removedChannel() signals that is emitted whenever    a new QCopChannel object is created or destroyed, respectively.    See also: QWSWindow, QWSClient and QCopChannel.    \section1 Mouse Handling    The mouse driver (represented by an instance of the    QWSMouseHandler class) is loaded by the server application when it    starts running, using Qt's \l {How to Create Qt Plugins}{plugin    system}. A mouse driver receives mouse events from the device and    encapsulates each event with an instance of the QWSEvent class    which it then passes to the server.    The openMouse() function opens the mouse devices specified by the    QWS_MOUSE_PROTO environment variable, and the setMouseHandler()    functions sets the primary mouse driver. Alternatively, the static    setDefaultMouse() function provides means of specifying the mouse    driver to use if the QWS_MOUSE_PROTO variable is not defined (note    that the default is otherwise platform dependent). The primary    mouse driver can be retrieved using the static mouseHandler()    function. Use the closeMouse() function to delete the mouse    drivers.    In addition, the QWSServer class can control the flow of mouse    input using the suspendMouse() and resumeMouse() functions.    See also: QWSMouseHandler and \l {Qtopia Core Pointer Handling}.    \section1 Keyboard Handling    The keyboard driver (represented by an instance of the    QWSKeyboardHandler class) is loaded by the server application when    it starts running, using Qt's \l {How to Create Qt Plugins}{plugin    system}. A keyboard driver receives keyboard events from the    device and encapsulates each event with an instance of the    QWSEvent class which it then passes to the server.    The openKeyboard() function opens the keyboard devices specified    by the QWS_KEYBOARD environment variable, and the    setKeyboardHandler() functions sets the primary keyboard    driver. Alternatively, the static setDefaultKeyboard() function    provides means of specifying the keyboard driver to use if the    QWS_KEYBOARD variable is not defined (note again that the default    is otherwise platform dependent). The primary keyboard driver can    be retrieved using the static keyboardHandler() function. Use the    closeKeyboard() function to delete the keyboard drivers.    In addition, the QWSServer class can handle key events from both    physical and virtual keyboards using the processKeyEvent() and    sendKeyEvent() functions, respectively. Use the    addKeyboardFilter() function to filter the key events from    physical keyboard drivers, the most recently added filter can be    removed and deleted using the removeKeyboardFilter() function.    See also: QWSKeyboardHandler and \l {Qtopia Core Character Input}.    \section1 Display Handling    When a screen update is required, the server runs through all the    top-level windows that intersect with the region that is about to    be updated, and ensures that the associated clients have updated    their memory buffer. Then the server uses the screen driver    (represented by an instance of the QScreen class) to copy the    content of the memory to the screen.    In addition, the QWSServer class provides some means of managing    the screen output: Use the refresh() function to refresh the    entire display, or alternatively a specified region of it. The    enablePainting() function can be used to disable (and enable)    painting onto the screen. QWSServer also provide the    setMaxWindowRect() function restricting the area of the screen    which \l {Qtopia Core} applications will consider to be the    maximum area to use for windows. To set the brush used as the    background in the absence of obscuring windows, QWSServer provides    the static setBackground() function. The corresponding    backgroundBrush() function returns the currently set brush.    QWSServer also controls the screen saver: Use the setScreenSaver()    to install a custom screen saver derived from the QWSScreenSaver    class. Once installed, the screensaver can be activated using the    screenSaverActivate() function, and the screenSaverActive()    function returns its current status. Use the    setScreenSaverInterval() function to specify the timeout interval.    \l{Qtopia Core} also supports multilevel screen saving, use the    setScreenSaverIntervals() function to specify the various levels    and their timeout intervals.    Finally, the QWSServer class controls the cursor's appearance,    i.e., use the setCursorVisible() function to hide or show the    cursor, and the isCursorVisible() function to determine whether    the cursor is visible on the display or not.    See also: QScreen and \l {Qtopia Core Display Management}.    \section1 Input Method Handling    Whenever the server receives an event, it queries its stack of    top-level windows to find the window containing the event's    position (each window can identify the client application that    created it). Then the server forwards the event to the appropriate    client. If an input method is installed, it is used as a filter    between the server and the client application.    Derive from the QWSInputMethod class to create custom input    methods, and use the server's setCurrentInputMethod() function to    install it. Use the sendIMEvent() and sendIMQuery() functions to    send input method events and queries.    QWSServer provides the IMMouse enum describing the various mouse    events recognized by the QWSInputMethod::mouseHandler()    function. The latter function allows subclasses of QWSInputMethod    to handle mouse events within the preedit text.    See also: QWSInputMethod*//*!    \enum QWSServer::IMState    \obsolete    This enum describes the various states of an input method.    \value IMCompose Composing.    \value IMStart Equivalent to IMCompose.    \value IMEnd Finished composing.    \sa QWSInputMethod::sendIMEvent()*//*!    \enum QWSServer::IMMouse    This enum describes the various types of mouse events recognized    by the QWSInputMethod::mouseHandler() function.    \value MousePress An event generated by pressing a mouse button.    \value MouseRelease An event generated by relasing a mouse button.    \value MouseMove An event generated by moving the mouse cursor.    \value MouseOutside This value is only reserved, i.e., it is not used in                                    current implementations.    \sa QWSInputMethod, setCurrentInputMethod()*//*!    \enum QWSServer::ServerFlags    \internal    This enum is used to pass various options to the window system    server.    \value DisableKeyboard Ignore all keyboard input.    \value DisableMouse Ignore all mouse input.*//*!    \enum QWSServer::WindowEvent    This enum specifies the various events that can occur in a    top-level window.    \value Create A new window has been created (by the QWidget constructor).    \value Destroy The window has been closed and deleted (by the QWidget destructor).    \value Hide The window has been hidden using the QWidget::hide() function.    \value Show The window has been shown using the QWidget::show() function or similar.    \value Raise The window has been raised to the top of the desktop.    \value Lower The window has been lowered.    \value Geometry The window has changed size or position.    \value Active The window has become the active window (i.e., it has keyboard focus).    \value Name The window has been named.    \sa windowEvent()*//*!    \fn void QWSServer::markedText(const QString &selection)    This signal is emitted whenever some text is selected in any of    the running applications, passing the selected text in the \a    selection parameter.    \sa windowEvent()*//*!    \fn const QList<QWSWindow*> &QWSServer::clientWindows()    Returns the list of current top-level windows.    Note that the collection of top-level windows changes as    applications add and remove widgets so it should not be stored for    future use. The windows are sorted in stacking order from top-most    to bottom-most.    Use the QWSWindow::client() function to retrieve the client    application that owns a given window.    \sa windowAt(), instance()*//*!    \fn void QWSServer::newChannel(const QString& channel)    This signal is emitted whenever a new QCopChannel object is    created, passing the channel's name in the \a channel parameter.    \sa removedChannel()*//*!    \fn void QWSServer::removedChannel(const QString& channel)    This signal is emitted immediately after the given the QCopChannel    object specified by \a channel, is destroyed.    Note that a channel is not destroyed until all its listeners have    been unregistered.    \sa newChannel()*//*!    \fn QWSServer::QWSServer(int flags, QObject *parent)    \internal    Construct a QWSServer object with the given \a parent.  The \a    flags are used for keyboard and mouse settings.    \warning This class is instantiated by QApplication for    \l {Qtopia Core} server processes. You should never construct this    class yourself.    \sa {Running Applications}*//*!    \fn static QWSServer* QWSServer::instance()    \since 4.2    Returns a pointer to the server instance.    Note that the pointer will be 0 if the application is not the    server, i.e., if the QApplication::type() function doesn't return    QApplication::GuiServer.    \sa clientWindows(), windowAt()*/struct QWSCommandStruct{    QWSCommandStruct(QWSCommand *c, QWSClient *cl) :command(c),client(cl){}    ~QWSCommandStruct() { delete command; }    QWSCommand *command;    QWSClient *client;};QWSServer::QWSServer(int flags, QObject *parent) :    QObject(*new QWSServerPrivate, parent){    Q_D(QWSServer);    d->initServer(flags);}#ifdef QT3_SUPPORT/*!    Use the two-argument overload and call the    QObject::setObjectName() function instead.*/QWSServer::QWSServer(int flags, QObject *parent, const char *name) :    QObject(*new QWSServerPrivate, parent){    Q_D(QWSServer);    setObjectName(QString::fromAscii(name));    d->initServer(flags);}#endif#ifndef QT_NO_QWS_MULTIPROCESSstatic void ignoreSignal(int) {} // Used to eat SIGPIPE signals below#endifbool QWSServerPrivate::screensaverblockevent( int index, int *screensaverinterval, bool isDown ){    static bool ignoreEvents[2] = { false, false };    if ( isDown ) {        if ( !ignoreEvents[index] ) {            bool wake = false;            if ( screensaverintervals ) {                if ( screensaverinterval != screensaverintervals ) {                    wake = true;                }            }            if ( screensaverblockevents && wake ) {#ifdef EVENT_BLOCK_DEBUG                qDebug( "waking the screen" );#endif                ignoreEvents[index] = true;            } else if ( !screensaverblockevents ) {#ifdef EVENT_BLOCK_DEBUG                qDebug( "the screen was already awake" );#endif                ignoreEvents[index] = false;            }        }    } else {        if ( ignoreEvents[index] ) {#ifdef EVENT_BLOCK_DEBUG            qDebug( "mouseup?" );#endif            ignoreEvents[index] = false;            return true;        }    }    return ignoreEvents[index];}void QWSServerPrivate::initServer(int flags){    Q_Q(QWSServer);    Q_ASSERT(!qwsServer);    qwsServer = q;    qwsServerPrivate = this;    disablePainting = false;#ifndef QT_NO_QWS_MULTIPROCESS    ssocket = new QWSServerSocket(qws_qtePipeFilename(), q);    QObject::connect(ssocket, SIGNAL(newConnection()), q, SLOT(_q_newConnection()));    if ( !ssocket->isListening()) {        perror("QWSServerPrivate::initServer: server socket not listening");        qFatal("Failed to bind to %s", qws_qtePipeFilename().toLatin1().constData());    }    struct linger tmp;    tmp.l_onoff=1;    tmp.l_linger=0;    setsockopt(ssocket->socketDescriptor(),SOL_SOCKET,SO_LINGER,(char *)&tmp,sizeof(tmp));    signal(SIGPIPE, ignoreSignal); //we get it when we read#endif    focusw = 0;    mouseGrabber = 0;    mouseGrabbing = false;    keyboardGrabber = 0;    keyboardGrabbing = false;#ifndef QT_NO_QWS_CURSOR    haveviscurs = false;    cursor = 0;    nextCursor = 0;#endif#ifndef QT_NO_QWS_MULTIPROCESS    if (!geteuid()) {#if !defined(Q_OS_FREEBSD) && !defined(Q_OS_SOLARIS) && !defined(Q_OS_DARWIN) && !defined(QT_LSB)        if(mount(0,"/var/shm", "shm", 0, 0)) {            /* This just confuses people with 2.2 kernels            if (errno != EBUSY)                qDebug("Failed mounting shm fs on /var/shm: %s",strerror(errno));            */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -