void QWidget::hideWindow() { deactivateWidgetCleanup(); if (req_region.isEmpty()) // Already invisible? return; if ( testWFlags(WType_TopLevel) ) { releaseMouse(); #ifndef QT_NO_QWS_MANAGER if (QWSManager::grabbedMouse() == this) { if ( extra && extra->topextra && extra->topextra->qwsManager ) { extra->topextra->qwsManager->releaseGrab(); } } #endif qwsDisplay()->requestRegion(winId(), QRegion()); qwsDisplay()->requestFocus(winId(),FALSE); } else { QWidget *p = parentWidget(); if ( p ) { p->setChildrenAllocatedDirty( geometry(), this ); p->paintable_region_dirty = TRUE; if ( p->overlapping_children ) p->overlapping_children = -1; if ( p->isVisible() ) { QApplication::postEvent( p, new QPaintEvent(geometry(), TRUE) ); paint_children( p,geometry(),TRUE ); } } } updateRequestedRegion( mapToGlobal(QPoint(0,0)) ); }
void QWidget::setMicroFocusHint(int x, int y, int width, int height, bool text, QFont *) { if (QRect(x, y, width, height) != microFocusHint()) { d->createExtra(); d->extra->micro_focus_hint.setRect(x, y, width, height); } #ifndef QT_NO_QWS_INPUTMETHODS if (text) { QWidget *tlw = window(); int winid = tlw->internalWinId(); QPoint p(x, y + height); QPoint gp = mapToGlobal(p); QRect r = QRect(mapToGlobal(QPoint(0,0)), size()); r.setBottom(tlw->geometry().bottom()); //qDebug("QWidget::setMicroFocusHint %d %d %d %d", r.x(), // r.y(), r.width(), r.height()); QInputContext::setMicroFocusWidget(this); qwsDisplay()->setIMInfo(winid, gp.x(), gp.y(), r); //send font info, ###if necessary qwsDisplay()->setInputFont(winid, font()); } #endif }
int QWidget::metric(PaintDeviceMetric m) const { Q_D(const QWidget); int val; if (m == PdmWidth) { val = data->crect.width(); } else if (m == PdmWidthMM) { const QScreen *screen = d->getScreen(); val = data->crect.width() * screen->physicalWidth() / screen->width(); } else if (m == PdmHeight) { val = data->crect.height(); } else if (m == PdmHeightMM) { const QScreen *screen = d->getScreen(); val = data->crect.height() * screen->physicalHeight() / screen->height(); } else if (m == PdmDepth) { return qwsDisplay()->depth(); } else if (m == PdmDpiX || m == PdmPhysicalDpiX) { if (d->extra && d->extra->customDpiX) return d->extra->customDpiX; else if (d->parent) return static_cast<QWidget *>(d->parent)->metric(m); const QScreen *screen = d->getScreen(); return qRound(screen->width() / double(screen->physicalWidth() / 25.4)); } else if (m == PdmDpiY || m == PdmPhysicalDpiY) { if (d->extra && d->extra->customDpiY) return d->extra->customDpiY; else if (d->parent) return static_cast<QWidget *>(d->parent)->metric(m); const QScreen *screen = d->getScreen(); return qRound(screen->height() / double(screen->physicalHeight() / 25.4)); } else if (m == PdmNumColors) { QScreen *screen = d->getScreen(); int ret = screen->colorCount(); if (!ret) { const int depth = qwsDisplay()->depth(); switch (depth) { case 1: ret = 2; break; case 8: ret = 256; break; case 16: ret = 65536; break; case 24: ret = 16777216; break; case 32: ret = 2147483647; break; } } return ret; } else { val = QPaintDevice::metric(m);// XXX } return val; }
void QWidget::showWindow() { if ( testWFlags(WType_TopLevel) ) { updateRequestedRegion( mapToGlobal(QPoint(0,0)) ); QRegion r( req_region ); #ifndef QT_NO_QWS_MANAGER if ( extra && extra->topextra && extra->topextra->qwsManager ) { QRegion wmr = extra->topextra->qwsManager->region(); wmr = qt_screen->mapToDevice( wmr, QSize(qt_screen->width(), qt_screen->height()) ); r += wmr; } #endif qwsDisplay()->requestRegion(winId(), r); if ( !testWFlags(WStyle_Tool) ) { qwsDisplay()->requestFocus(winId(),TRUE); } qwsDisplay()->setAltitude( winId(), testWFlags(WStyle_StaysOnTop) ? 1 : 0, TRUE ); } else if ( !topLevelWidget()->in_show ) { updateRequestedRegion( mapToGlobal(QPoint(0,0)) ); QWidget *p = parentWidget(); p->setChildrenAllocatedDirty( geometry(), this ); p->paintable_region_dirty = TRUE; p->overlapping_children = -1; paint_heirarchy( this, TRUE ); } }
void QWidget::grabMouse(const QCursor &cursor) { if (qt_mouseGrb) qt_mouseGrb->releaseMouse(); qwsDisplay()->grabMouse(this,true); qwsDisplay()->selectCursor(this, cursor.handle()); qt_mouseGrb = this; qt_pressGrab = 0; }
void QWidget::raise() { QWidget *p = parentWidget(); if ( p && p->childObjects && p->childObjects->findRef(this) >= 0 ) p->childObjects->append( p->childObjects->take() ); if ( isTopLevel() ) { #ifdef QT_NO_WINDOWGROUPHINT if ( !testWFlags( WStyle_Tool ) ) setActiveWindow(); qwsDisplay()->setAltitude( winId(), 0 ); #else QWidget* act=0; if ( !testWFlags( WStyle_Tool ) ) act=this; qwsDisplay()->setAltitude( winId(), 0 ); if ( childObjects ) { QObjectListIt it(*childObjects); QObject* o; QWidgetList toraise; QWidget* w; while ((o=it.current())) { if ( o->isWidgetType() ) { w = (QWidget*)o; if ( w->isTopLevel() ) toraise.append(w); } ++it; } QWidgetListIt wit(toraise); while ((w=wit.current())) { if ( w->isVisible() ) { bool wastool = w->testWFlags( WStyle_Tool ); w->setWFlags( WStyle_Tool ); // avoid setActiveWindow flicker w->raise(); if ( !wastool ) { w->clearWFlags( WStyle_Tool ); act = w; } } ++wit; } } if ( act ) act->setActiveWindow(); #endif // QT_NO_WINDOWGROUPHINT } else if ( p ) { p->setChildrenAllocatedDirty( geometry(), this ); paint_heirarchy( this, TRUE ); } }
void PMainWindow::check_view_fullscreen() { if (!m_view) return; if (!m_view->hasFocus()&&m_aFullScreen->isOn()) { qwsDisplay()->requestFocus( m_disp->winId(), TRUE); } }
void PMainWindow::slotDisplay( const QString& inf ) { bool nwindow = false; if ( !m_disp ) { nwindow = true; initDisp(); m_disp->setIntensity(m_Intensity); m_setCurrentBrightness->setEnabled(true); m_hBright->setEnabled(true); } m_disp->setImage( inf ); if (m_SmallWindow) { if (m_gPrevNext->isEnabled()==false) { m_gPrevNext->addTo(toolBar); fsButton->hide(); } } m_gPrevNext->setEnabled(true); m_aDirUp->setEnabled(false); m_aShowInfo->setEnabled(true); m_aViewfile->setEnabled(false); m_aStartSlide->setEnabled(false); if (!nwindow && m_disp->fullScreen()!=m_aFullScreen->isOn()) { slotFullScreenToggled(m_aFullScreen->isOn()); } if (m_disp->fullScreen()) { if (!m_disp->isVisible()) { m_disp->showFullScreen(); qwsDisplay()->requestFocus( m_disp->winId(), TRUE); } } else { m_stack->raiseWidget( ImageDisplay ); } }
int QWidget::metric(PaintDeviceMetric m) const { Q_D(const QWidget); int val; if (m == PdmWidth) { val = data->crect.width(); } else if (m == PdmWidthMM) { const QScreen *screen = d->getScreen(); val = data->crect.width() * screen->physicalWidth() / screen->width(); } else if (m == PdmHeight) { val = data->crect.height(); } else if (m == PdmHeightMM) { const QScreen *screen = d->getScreen(); val = data->crect.height() * screen->physicalHeight() / screen->height(); } else if (m == PdmDepth) { return qwsDisplay()->depth(); } else if (m == PdmDpiX || m == PdmPhysicalDpiX) { const QScreen *screen = d->getScreen(); return qRound(screen->width() / double(screen->physicalWidth() / 25.4)); } else if (m == PdmDpiY || m == PdmPhysicalDpiY) { const QScreen *screen = d->getScreen(); return qRound(screen->height() / double(screen->physicalHeight() / 25.4)); } else { val = QPaintDevice::metric(m);// XXX } return val; }
void QWidget::releaseMouse() { if (qt_mouseGrb == this) { qwsDisplay()->grabMouse(this,false); qt_mouseGrb = 0; } }
void QWidget::releaseKeyboard() { if (keyboardGrb == this) { qwsDisplay()->grabKeyboard(this, false); keyboardGrb = 0; } }
void QWidget::grabKeyboard() { if (keyboardGrb) keyboardGrb->releaseKeyboard(); qwsDisplay()->grabKeyboard(this, true); keyboardGrb = this; }
void QWidget::setActiveWindow() { QWidget *tlw = topLevelWidget(); if ( tlw->isVisible() ) { qwsDisplay()->requestFocus( tlw->winId(), TRUE); } }
/*! \internal */ unsigned char * QWidget::scanLine(int i) const { // Should add widget x() here, maybe unsigned char * base=qwsDisplay()->frameBuffer(); if(base) base+=i*bytesPerLine(); return base; }
void QWidget::grabKeyboard() { if ( keyboardGrb ) keyboardGrb->releaseKeyboard(); // XXX XGrabKeyboard( x11Display(), winid, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime ); qwsDisplay()->grabKeyboard(this, TRUE); keyboardGrb = this; }
/*! \internal */ QGfx * QWidget::graphicsContext(bool clip_children) const { QGfx * qgfx_qws; qgfx_qws=qwsDisplay()->screenGfx(); updateGraphicsContext( qgfx_qws, clip_children ); return qgfx_qws; }
void QWidget::releaseKeyboard() { if ( keyboardGrb == this ) { // XXX XUngrabKeyboard( x11Display(), CurrentTime ); qwsDisplay()->grabKeyboard(this, FALSE); keyboardGrb = 0; } }
void QWidget::activateWindow() { QWidget *tlw = window(); if (tlw->isVisible()) { Q_ASSERT(tlw->testAttribute(Qt::WA_WState_Created)); qwsDisplay()->requestFocus(tlw->internalWinId(), true); } }
void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); d->aboutToDestroy(); if (!isWindow() && parentWidget()) parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry())); d->deactivateWidgetCleanup(); if (testAttribute(Qt::WA_WState_Created)) { setAttribute(Qt::WA_WState_Created, false); QObjectList childObjects = children(); for (int i = 0; i < childObjects.size(); ++i) { QObject *obj = childObjects.at(i); if (obj->isWidgetType()) static_cast<QWidget*>(obj)->destroy(destroySubWindows, destroySubWindows); } releaseMouse(); if (qt_pressGrab == this) qt_pressGrab = 0; if (keyboardGrb == this) releaseKeyboard(); if (testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal QApplicationPrivate::leaveModal(this); else if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this); #ifndef QT_NO_IM if (d->ic) { delete d->ic; d->ic =0; } else { // release previous focus information participating with // preedit preservation of qic -- while we still have a winId QInputContext *qic = QApplicationPrivate::inputContext; if (qic) qic->widgetDestroyed(this); } #endif //QT_NO_IM if ((windowType() == Qt::Desktop)) { } else { if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) { d->hide_sys(); } if (destroyWindow && isWindow()) { if (d->extra && d->extra->topextra && d->extra->topextra->backingStore) d->extra->topextra->backingStore->windowSurface->setGeometry(QRect()); qwsDisplay()->destroyRegion(internalWinId()); } } QT_TRY { d->setWinId(0); } QT_CATCH (const std::bad_alloc &) { // swallow - destructors must not throw } } }
void QWidget::updateCursor( const QRegion &r ) const { if ( qt_last_x && (!QWidget::mouseGrabber() || QWidget::mouseGrabber() == this) && qt_last_cursor != (WId)cursor().handle() && !qws_overrideCursor ) { QSize s( qt_screen->width(), qt_screen->height() ); QPoint pos = qt_screen->mapToDevice(QPoint(*qt_last_x, *qt_last_y), s); if ( r.contains(pos) ) qwsDisplay()->selectCursor((QWidget*)this, (unsigned int)cursor().handle()); } }
void QWidget::grabMouse() { if (qt_mouseGrb) qt_mouseGrb->releaseMouse(); qwsDisplay()->grabMouse(this,true); qt_mouseGrb = this; qt_pressGrab = 0; }
void QWidget::setCaption( const QString &caption ) { if ( extra && extra->topextra && extra->topextra->caption == caption ) return; // for less flicker createTLExtra(); extra->topextra->caption = caption; qwsDisplay()->setCaption(this, caption); QEvent e( QEvent::CaptionChange ); QApplication::sendEvent( this, &e ); }
void QWidget::lower() { QWidget *p = parentWidget(); if ( p && p->childObjects && p->childObjects->findRef(this) >= 0 ) p->childObjects->insert( 0, p->childObjects->take() ); if ( isTopLevel() ) qwsDisplay()->setAltitude( winId(), -1 ); else if ( p ) { p->setChildrenAllocatedDirty( geometry() ); paint_children( p,geometry(),TRUE ); } }
void QWidget::setMicroFocusHint( int x, int y, int width, int height, bool text, QFont *) { if ( QRect( x, y, width, height ) != microFocusHint() ) extraData()->micro_focus_hint.setRect( x, y, width, height ); #ifndef QT_NO_QWS_IM if ( text ) { QPoint p( x, y + height ); QPoint gp = mapToGlobal( p ); qwsDisplay()->setMicroFocus( gp.x(), gp.y()); } #endif }
void QWidget::updateGraphicsContext( QGfx *qgfx_qws, bool clip_children ) const { QPoint offset=mapToGlobal(QPoint(0,0)); QRegion r; // empty if not visible if ( isVisible() && topLevelWidget()->isVisible() ) { int rgnIdx = topLevelWidget()->alloc_region_index; if ( rgnIdx >= 0 ) { r = clip_children ? paintableRegion() : allocatedRegion(); QRegion req; bool changed = FALSE; QWSDisplay::grab(); const int *rgnRev = qwsDisplay()->regionManager()->revision( rgnIdx ); if ( topLevelWidget()->alloc_region_revision != *rgnRev ) { // The TL region has changed, so we better make sure we're // not writing to any regions we don't own anymore. // We'll get a RegionModified event soon that will get our // regions back in sync again. req = qwsDisplay()->regionManager()->region( rgnIdx ); changed = TRUE; } qgfx_qws->setGlobalRegionIndex( rgnIdx ); QWSDisplay::ungrab(); if ( changed ) { r &= req; } } } qgfx_qws->setWidgetDeviceRegion(r); qgfx_qws->setOffset(offset.x(),offset.y()); // Clip the window decoration for TL windows. // It is possible for these windows to draw on the wm decoration if // they change the clip region. Bug or feature? #ifndef QT_NO_QWS_MANAGER if ( extra && extra->topextra && extra->topextra->qwsManager ) qgfx_qws->setClipRegion(rect()); #endif }
void QWidget::destroy( bool destroyWindow, bool destroySubWindows ) { deactivateWidgetCleanup(); if ( testWState(WState_Created) ) { clearWState( WState_Created ); if ( children() ) { QObjectListIt it(*children()); register QObject *obj; while ( (obj=it.current()) ) { // destroy all widget children ++it; if ( obj->isWidgetType() ) ((QWidget*)obj)->destroy(destroySubWindows, destroySubWindows); } } releaseMouse(); if ( qt_pressGrab == this ) qt_pressGrab = 0; #ifndef QT_NO_QWS_MANAGER if (QWSManager::grabbedMouse() == this) { if ( extra && extra->topextra && extra->topextra->qwsManager ) { extra->topextra->qwsManager->releaseGrab(); } } #endif if ( keyboardGrb == this ) releaseKeyboard(); if ( testWFlags(WShowModal) ) // just be sure we leave modal qt_leave_modal( this ); else if ( testWFlags(WType_Popup) ) qApp->closePopup( this ); if ( testWFlags(WType_Desktop) ) { } else { if ( parentWidget() && parentWidget()->testWState(WState_Created) ) { hideWindow(); } if ( destroyWindow && isTopLevel() ) qwsDisplay()->destroyRegion( winId() ); } setWinId( 0 ); } }
void QWidget::setMask( const QRegion& region ) { createExtra(); if ( region == extra->mask ) return; alloc_region_dirty = TRUE; extra->mask = region; if ( isTopLevel() ) { if ( !region.isNull() ) { req_region = extra->mask; req_region.translate(crect.x(),crect.y()); //###expensive? req_region &= crect; //??? this is optional } else req_region = QRegion(crect); req_region = qt_screen->mapToDevice( req_region, QSize(qt_screen->width(), qt_screen->height()) ); } if ( isVisible() ) { if ( isTopLevel() ) { QRegion rgn( req_region ); #ifndef QT_NO_QWS_MANAGER if ( extra && extra->topextra && extra->topextra->qwsManager ) { QRegion wmr = extra->topextra->qwsManager->region(); wmr = qt_screen->mapToDevice( wmr, QSize(qt_screen->width(), qt_screen->height()) ); rgn += wmr; } #endif qwsDisplay()->requestRegion(winId(), rgn); } else { updateRequestedRegion( mapToGlobal(QPoint(0,0)) ); parentWidget()->paintable_region_dirty = TRUE; parentWidget()->repaint(geometry()); paint_children( parentWidget(),geometry(),TRUE ); } } }
int QWidget::metric( int m ) const { int val; if ( m == QPaintDeviceMetrics::PdmWidth ) { val = crect.width(); } else if ( m == QPaintDeviceMetrics::PdmWidthMM ) { // 75 dpi is 3dpmm val = (crect.width()*100)/288; } else if ( m == QPaintDeviceMetrics::PdmHeight ) { val = crect.height(); } else if ( m == QPaintDeviceMetrics::PdmHeightMM ) { val = (crect.height()*100)/288; } else if ( m == QPaintDeviceMetrics::PdmDepth ) { return qwsDisplay()->depth(); } else if ( m == QPaintDeviceMetrics::PdmDpiX || m == QPaintDeviceMetrics::PdmPhysicalDpiX ) { return 72; } else if ( m == QPaintDeviceMetrics::PdmDpiY || m == QPaintDeviceMetrics::PdmPhysicalDpiY ) { return 72; } else { val = QPaintDevice::metric(m);// XXX } return val; }
void QWidget::reparentSys( QWidget *parent, WFlags f, const QPoint &p, bool showIt ) { QWidget* oldtlw = topLevelWidget(); #ifndef QT_NO_CURSOR QCursor oldcurs; bool setcurs=testWState(WState_OwnCursor); if ( setcurs ) { oldcurs = cursor(); unsetCursor(); } #endif WId old_winid = winid; if ( testWFlags(WType_Desktop) ) old_winid = 0; if ( !isTopLevel() && parentWidget() && parentWidget()->testWState(WState_Created) ) hideWindow(); setWinId( 0 ); if ( parentObj != parent ) { QWidget *oldparent = parentWidget(); if ( oldparent ) { // remove from parent oldparent->removeChild( this ); oldparent->setChildrenAllocatedDirty(); oldparent->paintable_region_dirty = TRUE; } if ( parent ) { // insert into new parent parent->insertChild( this ); parent->setChildrenAllocatedDirty(); parent->paintable_region_dirty = TRUE; } } bool enable = isEnabled(); // remember status FocusPolicy fp = focusPolicy(); QSize s = size(); //QPixmap *bgp = (QPixmap *)backgroundPixmap(); //QColor bgc = bg_col; // save colors #ifndef QT_NO_WIDGET_TOPEXTRA QString capt= caption(); #endif widget_flags = f; clearWState( WState_Created | WState_Visible | WState_ForceHide ); create(); if ( isTopLevel() || (!parent || parent->isVisible() ) ) setWState( WState_ForceHide ); // new widgets do not show up in already visible parents /* if ( bgp ) XSetWindowBackgroundPixmap( dpy, winid, bgp->handle() ); else XSetWindowBackground( dpy, winid, bgc.pixel() ); */ setGeometry( p.x(), p.y(), s.width(), s.height() ); setEnabled( enable ); setFocusPolicy( fp ); #ifndef QT_NO_WIDGET_TOPEXTRA if ( !capt.isNull() ) { extra->topextra->caption = QString::null; setCaption( capt ); } #endif if ( showIt ) show(); if ( (int)old_winid > 0 ) qwsDisplay()->destroyRegion( old_winid ); #ifndef QT_NO_CURSOR if ( setcurs ) { setCursor(oldcurs); } #endif reparentFocusWidgets( oldtlw ); // fix focus chains }
void QWidget::internalSetGeometry( int x, int y, int w, int h, bool isMove ) { if ( extra ) { // any size restrictions? w = QMIN(w,extra->maxw); h = QMIN(h,extra->maxh); w = QMAX(w,extra->minw); h = QMAX(h,extra->minh); } if ( w < 1 ) // invalid size w = 1; if ( h < 1 ) h = 1; QPoint oldp = geometry().topLeft(); QSize olds = size(); QRect r( x, y, w, h ); bool isResize = olds != r.size(); // We only care about stuff that changes the geometry, or may // cause the window manager to change its state if ( r.size() == olds && oldp == r.topLeft() ) return; QRegion oldAlloc; if ( !isTopLevel() && isMove && ( w==olds.width() && h==olds.height() ) ) { oldAlloc = allocatedRegion(); } if (!in_show_maximized) { clearWState(WState_Maximized); clearWState(WState_FullScreen); if (isTopLevel()) topData()->normalGeometry = QRect(0, 0, -1, -1); } QPoint oldPos = pos(); crect = r; if ( testWFlags(WType_Desktop) ) return; if ( isTopLevel() ) { //### ConfigPending not implemented, do we need it? //setWState( WState_ConfigPending ); if ( isMove && ( w==olds.width() && h==olds.height() ) ) { // just need to translate current region QSize s( qt_screen->width(), qt_screen->height() ); QPoint td1 = qt_screen->mapToDevice( QPoint(0,0), s ); QPoint td2 = qt_screen->mapToDevice( QPoint(x - oldp.x(),y - oldp.y()), s ); QPoint dd = QPoint( td2.x()-td1.x(), td2.y()-td1.y() ); req_region.translate( dd.x(), dd.y() ); } else { if ( extra && !extra->mask.isNull() ) { req_region = extra->mask; req_region.translate(crect.x(),crect.y()); req_region &= crect; //??? this is optional } else { req_region = crect; } req_region = qt_screen->mapToDevice( req_region, QSize(qt_screen->width(), qt_screen->height()) ); } if ( isVisible() ) { if ( isMove && !isResize && alloc_region_index >= 0 ) { qwsDisplay()->moveRegion(winId(), x - oldp.x(), y - oldp.y()); setChildrenAllocatedDirty(); } else { QRegion rgn( req_region ); #ifndef QT_NO_QWS_MANAGER if ( extra && extra->topextra && extra->topextra->qwsManager ) { QRegion wmr = extra->topextra->qwsManager->region(); wmr = qt_screen->mapToDevice( wmr, QSize(qt_screen->width(), qt_screen->height()) ); rgn += wmr; } #endif qwsDisplay()->requestRegion(winId(), rgn); if ( extra && extra->topextra ) { QRect br( rgn.boundingRect() ); br = qt_screen->mapFromDevice( br, QSize(qt_screen->deviceWidth(), qt_screen->deviceHeight()) ); extra->topextra->fleft = crect.x()-br.x(); extra->topextra->ftop = crect.y()-br.y(); extra->topextra->fright = br.right()-crect.right(); extra->topextra->fbottom = br.bottom()-crect.bottom(); } } } } if ( isVisible() ) { isSettingGeometry = TRUE; if ( isMove ) { QMoveEvent e( pos(), oldPos ); QApplication::sendEvent( this, &e ); #ifndef QT_NO_QWS_MANAGER if (extra && extra->topextra && extra->topextra->qwsManager) QApplication::sendEvent( extra->topextra->qwsManager, &e ); #endif } if ( isResize ) { QResizeEvent e( r.size(), olds ); QApplication::sendEvent( this, &e ); #ifndef QT_NO_QWS_MANAGER if (extra && extra->topextra && extra->topextra->qwsManager) { QResizeEvent e( r.size(), olds ); QApplication::sendEvent(topData()->qwsManager, &e); } #endif /* if ( !testWFlags( WStaticContents ) ) { QApplication::postEvent(this,new QPaintEvent(clipRegion(), !testWFlags(WResizeNoErase) ) ); } */ } updateRequestedRegion( mapToGlobal(QPoint(0,0)) ); QWidget *p = parentWidget(); if ( !isTopLevel() || isResize ) { if ( p && !isTopLevel() ) { p->paintable_region_dirty = TRUE; QRegion oldr( QRect(oldp, olds) ); dirtyChildren.translate( x, y ); if ( p->isSettingGeometry ) { if ( oldp != r.topLeft() ) { QRegion upd( (QRegion(r) | oldr) & p->rect() ); dirtyChildren |= upd; } else { dirtyChildren |= QRegion(r) - oldr; QApplication::postEvent( this, new QPaintEvent(rect(), !testWFlags(QWidget::WResizeNoErase)) ); } p->dirtyChildren |= dirtyChildren; } else { QRegion upd( (QRegion(r) | oldr) & p->rect() ); dirtyChildren |= upd; QRegion paintRegion = dirtyChildren; #define FAST_WIDGET_MOVE #ifdef FAST_WIDGET_MOVE if ( isMove && ( w==olds.width() && h==olds.height() ) ) { QSize s( qt_screen->width(), qt_screen->height() ); QPoint td1 = qt_screen->mapToDevice( QPoint(0,0), s ); QPoint td2 = qt_screen->mapToDevice( QPoint(x - oldp.x(),y - oldp.y()), s ); QPoint dd = QPoint( td2.x()-td1.x(), td2.y()-td1.y() ); oldAlloc.translate( dd.x(), dd.y() ); QRegion alloc( allocatedRegion() ); QRegion scrollRegion( alloc & oldAlloc ); if ( !scrollRegion.isEmpty() ) { QGfx * gfx = p->graphicsContext(FALSE); gfx->setClipDeviceRegion( scrollRegion ); gfx->scroll(x,y,w,h,oldp.x(),oldp.y()); delete gfx; QSize ds( qt_screen->deviceWidth(), qt_screen->deviceHeight() ); scrollRegion = qt_screen->mapFromDevice( scrollRegion, ds ); QPoint gp = p->mapToGlobal( QPoint(0,0) ); scrollRegion.translate( -gp.x(), -gp.y() ); paintRegion -= scrollRegion; } } #endif if ( !oldr.isEmpty() ) QApplication::postEvent( p, new QPaintEvent(oldr, TRUE) ); p->setChildrenAllocatedDirty( dirtyChildren, this ); qwsUpdateActivePainters(); paint_children( p, paintRegion, isResize ); } p->overlapping_children = -1; } else { if ( oldp != r.topLeft() ) { qwsUpdateActivePainters(); paint_heirarchy( this, TRUE ); } else { setChildrenAllocatedDirty( dirtyChildren ); qwsUpdateActivePainters(); QApplication::postEvent( this, new QPaintEvent(rect(), !testWFlags(QWidget::WResizeNoErase)) ); paint_children( this, dirtyChildren, TRUE ); } } } else { qwsUpdateActivePainters(); } #ifndef QT_NO_QWS_MANAGER if (isResize && extra && extra->topextra && extra->topextra->qwsManager) { QApplication::postEvent(topData()->qwsManager, new QPaintEvent( clipRegion(), TRUE ) ); } #endif isSettingGeometry = FALSE; dirtyChildren = QRegion(); } else { if ( isMove ) QApplication::postEvent( this, new QMoveEvent( pos(), oldPos ) ); if ( isResize ) QApplication::postEvent( this, new QResizeEvent(crect.size(), olds) ); } }