void QWSWindowSurface::setGeometry(const QRect &rect, const QRegion &mask)
{
    if (rect == geometry()) // XXX: && mask == prevMask
        return;

    const bool isResize = rect.size() != geometry().size();
    const bool needsRepaint = isResize || !isBuffered();

    QWindowSurface::setGeometry(rect);

    const QRegion region = mask & rect;
    QWidget *win = window();
    // Only request regions for widgets visible on the screen.
    // (Added the !win check for compatibility reasons, because
    // there was no "if (win)" check before).
    const bool requestQWSRegion = !win || !win->testAttribute(Qt::WA_DontShowOnScreen);
    if (requestQWSRegion)
        QWidget::qwsDisplay()->requestRegion(winId(), key(), permanentState(), region);

    if (needsRepaint)
        invalidateBuffer();

    if (!requestQWSRegion) {
        // We didn't request a region, hence we won't get a QWSRegionEvent::Allocation
        // event back from the server so we set the clip directly. We have to
        // do this after the invalidateBuffer() call above, as it might trigger a
        // backing store sync, resulting in too many update requests.
        setClipRegion(region);
    }
}
Beispiel #2
0
 boost::asio::ip::tcp::socket &MasterNodeConnection::tcpSocket()
 {
     if (isBuffered())
         return stream->next_layer();
     else
         return *socket;
 }
Beispiel #3
0
bool SqliteCursor::drv_open(const KDbEscapedString& sql)
{
    //! @todo decode
    if (! d->data) {
        // this may as example be the case if SqliteConnection::drv_useDatabase()
        // wasn't called before. Normaly sqlite_compile/sqlite3_prepare
        // should handle it, but it crashes in in sqlite3SafetyOn at util.c:786
        sqliteWarning() << "SqliteCursor::drv_open(): Database handle undefined.";
        return false;
    }

    int res = sqlite3_prepare(
                  d->data,            /* Database handle */
                  sql.constData(),       /* SQL statement, UTF-8 encoded */
                  sql.length(),             /* Length of zSql in bytes. */
                  &d->prepared_st_handle,  /* OUT: Statement handle */
                  0/*const char **pzTail*/     /* OUT: Pointer to unused portion of zSql */
              );
    if (res != SQLITE_OK) {
        m_result.setServerErrorCode(res);
        storeResult();
        return false;
    }
    if (isBuffered()) {
//! @todo manage size dynamically
        d->records.resize(128);
    }

    return true;
}
/*!
    Sets the region currently visible on the screen to be the given \a
    clip region.

    \sa clipRegion()
*/
void QWSWindowSurface::setClipRegion(const QRegion &clip)
{
    if (clip == d_ptr->clip)
        return;

    QRegion expose = (clip - d_ptr->clip);
    d_ptr->clip = clip;

    if (expose.isEmpty() || clip.isEmpty())
        return; // No repaint or flush required.

    QWidget *win = window();
    if (!win)
        return;

    if (isBuffered()) {
        // No repaint required. Flush exposed area via the backing store.
        win->d_func()->syncBackingStore(expose);
        return;
    }

#ifndef QT_NO_QWS_MANAGER
    // Invalidate exposed decoration area.
    if (win && win->isWindow()) {
        QTLWExtra *topextra = win->d_func()->extra->topextra;
        if (QWSManager *manager = topextra->qwsManager) {
            QRegion decorationExpose(manager->region());
            decorationExpose.translate(-win->geometry().topLeft());
            decorationExpose &= expose;
            if (!decorationExpose.isEmpty()) {
                expose -= decorationExpose;
                manager->d_func()->dirtyRegion(QDecoration::All, QDecoration::Normal, decorationExpose);
            }
        }
    }
#endif

    // Invalidate exposed widget area.
    win->d_func()->invalidateBuffer(expose);
}
/*!
    Move the surface with the given \a offset.

    A subclass may reimplement this function to enable accelerated window move.
    It must return true if the move was successful and no repaint is necessary,
    false otherwise.

    The default implementation updates the QWindowSurface geometry and
    returns true if the surface is buffered; false otherwise.

    This function is called by the window system on the client instance.

    \sa isBuffered()
*/
bool QWSWindowSurface::move(const QPoint &offset)
{
    QWindowSurface::setGeometry(geometry().translated(offset));
    return isBuffered();
}