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

📄 qwindowsystem_qws.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    for (int i = 0; i < n; ++i)        d->embedded.at(i)->lower();#endif}/*!    \internal    Shows the window.*/void QWSWindow::show(){    operation(QWSWindowOperationEvent::Show);#ifndef QT_NO_QWSEMBEDWIDGET    const int n = d->embedded.size();    for (int i = 0; i < n; ++i)        d->embedded.at(i)->show();#endif}/*!    \internal    Hides the window.*/void QWSWindow::hide(){    operation(QWSWindowOperationEvent::Hide);#ifndef QT_NO_QWSEMBEDWIDGET    const int n = d->embedded.size();    for (int i = 0; i < n; ++i)        d->embedded.at(i)->hide();#endif}/*!    \internal    Make this the active window (i.e., sets the keyboard focus to this    window).*/void QWSWindow::setActiveWindow(){    qwsServerPrivate->setFocus(this, true);#ifndef QT_NO_QWSEMBEDWIDGET    const int n = d->embedded.size();    for (int i = 0; i < n; ++i)        d->embedded.at(i)->setActiveWindow();#endif}void QWSWindow::setName(const QString &n){    rgnName = n;}/*!  \internal  Sets the window's caption to \a c.*/void QWSWindow::setCaption(const QString &c){    rgnCaption = c;}static int global_focus_time_counter=100;void QWSWindow::focus(bool get){    if (get)        last_focus_time = global_focus_time_counter++;    if (c) {        QWSFocusEvent event;        event.simpleData.window = id;        event.simpleData.get_focus = get;        c->sendEvent(&event);    }#ifndef QT_NO_QWSEMBEDWIDGET    const int n = d->embedded.size();    for (int i = 0; i < n; ++i)        d->embedded.at(i)->focus(get);#endif}void QWSWindow::operation(QWSWindowOperationEvent::Operation o){    if (!c)        return;    QWSWindowOperationEvent event;    event.simpleData.window = id;    event.simpleData.op = o;    c->sendEvent(&event);}/*!    \internal    Destructor.*/QWSWindow::~QWSWindow(){#ifndef QT_NO_QWS_INPUTMETHODS    if (current_IM_composing_win == this)        current_IM_composing_win = 0;#endif#ifndef QT_NO_QWSEMBEDWIDGET    QWSWindow *embedder = d->embedder;    if (embedder) {        embedder->d->embedded.removeAll(this);        d->embedder = 0;    }    while (!d->embedded.isEmpty())        stopEmbed(d->embedded.first());#endif#ifndef QT_NO_QWS_MULTIPROCESS    if (surface && !surface->isBuffered()) {        if (c && c->d_func()) // d_func() will be 0 if client is deleted            c->removeUnbufferedSurface();    }#endif    delete surface;    delete d;}/*!    \internal    Returns the region that the window is allowed to draw onto,    including any window decorations but excluding regions covered by    other windows.    \sa paintedRegion(), requestedRegion()*/QRegion QWSWindow::allocatedRegion() const{    return d->allocatedRegion;}/*!    \internal    Returns the region that the window is known to have drawn into.    \sa allocatedRegion(), requestedRegion()*/QRegion QWSWindow::paintedRegion() const{    return (d->painted ? d->allocatedRegion : QRegion());}inline void QWSWindow::setAllocatedRegion(const QRegion &region){    d->allocatedRegion = region;}#ifndef QT_NO_QWSEMBEDWIDGETinline void QWSWindow::startEmbed(QWSWindow *w){    d->embedded.append(w);    w->d->embedder = this;}inline void QWSWindow::stopEmbed(QWSWindow *w){    w->d->embedder = 0;    w->client()->sendEmbedEvent(w->winId(), QWSEmbedEvent::Region, QRegion());    d->embedded.removeAll(w);}#endif // QT_NO_QWSEMBEDWIDGET/********************************************************************* * * Class: QWSClient * *********************************************************************/class QWSClientPrivate : public QObjectPrivate{    Q_DECLARE_PUBLIC(QWSClient)public:    QWSClientPrivate();    ~QWSClientPrivate();    void setLockId(int id);    void unlockCommunication();private:#ifndef QT_NO_QWS_MULTIPROCESS    QWSLock *clientLock;    bool shutdown;    int numUnbufferedSurfaces;#endif    QSet<QByteArray> usedFonts;    friend class QWSServerPrivate;};QWSClientPrivate::QWSClientPrivate(){#ifndef QT_NO_QWS_MULTIPROCESS    clientLock = 0;    shutdown = false;    numUnbufferedSurfaces = 0;#endif}QWSClientPrivate::~QWSClientPrivate(){#ifndef QT_NO_QWS_MULTIPROCESS    delete clientLock;#endif}void QWSClientPrivate::setLockId(int id){#ifdef QT_NO_QWS_MULTIPROCESS    Q_UNUSED(id);#else    clientLock = new QWSLock(id);#endif}void QWSClientPrivate::unlockCommunication(){#ifndef QT_NO_QWS_MULTIPROCESS    if (clientLock)        clientLock->unlock(QWSLock::Communication);#endif}/*!    \class QWSClient    \ingroup qws    \brief The QWSClient class encapsulates a client process in Qtopia    Core.    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.    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. A list of    the current windows can be retrieved using the    QWSServer::clientWindows() function, and each window can tell    which client that owns it through its QWSWindow::client()    function.    A QWSClient object has an unique ID that can be retrieved using    its clientId() function. QWSClient also provides the identity()    function which typically returns the name of this client's running    application.    \sa QWSServer, QWSWindow, {Qtopia Core Architecture}*//*!   \internal*///always use frame bufferQWSClient::QWSClient(QObject* parent, QWS_SOCK_BASE* sock, int id)    : QObject(*new QWSClientPrivate, parent), command(0), cid(id){#ifdef QT_NO_QWS_MULTIPROCESS    Q_UNUSED(sock);    isClosed = false;#else    csocket = 0;    if (!sock) {        socketDescriptor = -1;        isClosed = false;    } else {        csocket = static_cast<QWSSocket*>(sock); //###        isClosed = false;        csocket->flush();        socketDescriptor = csocket->socketDescriptor();        connect(csocket, SIGNAL(readyRead()), this, SIGNAL(readyRead()));        connect(csocket, SIGNAL(disconnected()), this, SLOT(closeHandler()));        connect(csocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(errorHandler()));    }#endif //QT_NO_QWS_MULTIPROCESS}/*!   \internal*/QWSClient::~QWSClient(){    qDeleteAll(cursors);    delete command;#ifndef QT_NO_QWS_MULTIPROCESS    delete csocket;#endif}#ifndef QT_NO_QWS_MULTIPROCESSvoid QWSClient::removeUnbufferedSurface(){    Q_D(QWSClient);    --d->numUnbufferedSurfaces;}void QWSClient::addUnbufferedSurface(){    Q_D(QWSClient);    ++d->numUnbufferedSurfaces;}#endif // QT_NO_QWS_MULTIPROCESS/*!   \internal*/void QWSClient::setIdentity(const QString& i){    id = i;}void QWSClient::closeHandler(){    isClosed = true;    emit connectionClosed();}void QWSClient::errorHandler(){#if defined(QWS_SOCKET_DEBUG)    qDebug("Client %p error %s", this, csocket ? csocket->errorString().toLatin1().constData() : "(no socket)");#endif    isClosed = true;//####Do we need to clean out the pipes?    emit connectionClosed();}/*!   \internal*/int QWSClient::socket() const{    return socketDescriptor;}/*!   \internal*/void QWSClient::sendEvent(QWSEvent* event){#ifndef QT_NO_QWS_MULTIPROCESS    if (csocket) {        // qDebug() << "QWSClient::sendEvent type " << event->type << " socket state " << csocket->state();        if ((QAbstractSocket::SocketState)(csocket->state()) == QAbstractSocket::ConnectedState) {            event->write(csocket);        }    }    else#endif    {        qt_client_enqueue(event);    }}/*!   \internal*/void QWSClient::sendRegionEvent(int winid, QRegion rgn, int type){#ifndef QT_NO_QWS_MULTIPROCESS    Q_D(QWSClient);    if (d->clientLock)        d->clientLock->lock(QWSLock::RegionEvent);#endif    QWSRegionEvent event;    event.setData(winid, rgn, type);//    qDebug() << "Sending Region event to" << winid << "rgn" << rgn << "type" << type;    sendEvent(&event);#ifndef QT_NO_QWS_MULTIPROCESS    if (d->clientLock && d->numUnbufferedSurfaces > 0)        csocket->waitForBytesWritten(); // ### must flush to prevent deadlock#endif}extern int qt_servershmid;/*!   \internal*/void QWSClient::sendConnectedEvent(const char *display_spec){    QWSConnectedEvent event;    event.simpleData.window = 0;    event.simpleData.len = strlen(display_spec) + 1;    event.simpleData.clientId = cid;    event.simpleData.servershmid = qt_servershmid;    char * tmp=(char *)display_spec;    event.setData(tmp, event.simpleData.len);    sendEvent(&event);}/*!   \internal*/void QWSClient::sendMaxWindowRectEvent(const QRect &rect){    QWSMaxWindowRectEvent event;    event.simpleData.window = 0;    event.simpleData.rect = rect;    sendEvent(&event);}/*!   \internal*/#ifndef QT_NO_QWS_PROPERTIESvoid QWSClient::sendPropertyNotifyEvent(int property, int state){    QWSPropertyNotifyEvent event;    event.simpleData.window = 0; // not used yet    event.simpleData.property = property;    event.simpleData.state = state;    sendEvent(&event);}/*!   \internal*/void QWSClient::sendPropertyReplyEvent(int property, int len, const char *data){    QWSPropertyReplyEvent event;    event.simpleData.window = 0; // not used yet    event.simpleData.property = property;    event.simpleData.len = len;    event.setData(data, len);    sendEvent(&event);}#endif //QT_NO_QWS_PROPERTIES/*!   \internal*/void QWSClient::sendSelectionClearEvent(int windowid){    QWSSelectionClearEvent event;    event.simpleData.window = windowid;    sendEvent(&event);}/*!   \internal*/void QWSClient::sendSelectionRequestEvent(QWSConvertSelectionCommand *cmd, int windowid){    QWSSelectionRequestEvent event;    event.simpleData.window = windowid;

⌨️ 快捷键说明

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