From 287b654d39b5ac6587616df9c664fdf156572463 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Wed, 6 Dec 2000 15:03:59 +0000 Subject: [PATCH] an attempt to reduce the slowliness of opaque resize with non-Qt application svn path=/trunk/kdebase/kwin/; revision=73641 --- client.cpp | 28 +++++++++++++++++++++------- client.h | 5 ++++- main.cpp | 5 +++-- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/client.cpp b/client.cpp index 2dc237848c..fed879589d 100644 --- a/client.cpp +++ b/client.cpp @@ -254,17 +254,31 @@ QSizePolicy WindowWrapper::sizePolicy() const return QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); } - void WindowWrapper::resizeEvent( QResizeEvent * ) { if ( win && reparented ) { - XMoveResizeWindow( qt_xdisplay(), win, - 0, 0, width(), height() ); - if ( ((Client*)parentWidget())->shape() ) - ((Client*)parentWidget())->updateShape(); + if ( ((Client*)parentWidget())->isResize() ) { + QTimer::singleShot( 0, this, SLOT( deferredResize() ) ); + } else { + XMoveResizeWindow( qt_xdisplay(), win, + 0, 0, width(), height() ); + if ( ((Client*)parentWidget())->shape() ) + ((Client*)parentWidget())->updateShape(); + } } } +void WindowWrapper::deferredResize() +{ + XMoveResizeWindow( qt_xdisplay(), win, + 0, 0, width(), height() ); + ((Client*)parentWidget())->sendSynteticConfigureNotify(); + if ( ((Client*)parentWidget())->shape() ) + ((Client*)parentWidget())->updateShape(); + QApplication::syncX(); // process our own configure events synchronously. +} + + /*! Reimplemented to do map() as well */ @@ -1518,7 +1532,8 @@ void Client::leaveEvent( QEvent * ) void Client::setGeometry( int x, int y, int w, int h ) { QWidget::setGeometry(x, y, w, h); - sendSynteticConfigureNotify(); + if ( !isResize() ) + sendSynteticConfigureNotify(); } /*! @@ -1730,7 +1745,6 @@ void Client::maximizeRaw( bool vertically, bool horizontally ) if ( !vertically && !horizontally ) { maximize ( MaximizeRestore ); } else { - QRect geom = geometry(); MaximizeMode m = MaximizeRestore; if ( vertically && horizontally ) m = MaximizeFull; diff --git a/client.h b/client.h index 211a45fa31..75b8248fb1 100644 --- a/client.h +++ b/client.h @@ -46,7 +46,9 @@ protected: void resizeEvent( QResizeEvent * ); bool x11Event( XEvent * ); // X11 event - +private slots: + void deferredResize(); + private: WId win; Time lastMouseEventTime; @@ -293,6 +295,7 @@ private: QTimer* autoRaiseTimer; Colormap cmap; void verifyTransientFor(); + friend class WindowWrapper; }; inline WId Client::window() const diff --git a/main.cpp b/main.cpp index ce73237030..e38b107928 100644 --- a/main.cpp +++ b/main.cpp @@ -137,9 +137,10 @@ bool Application::x11EventFilter( XEvent *e ) switch ( e->type ) { case ButtonPress: case ButtonRelease: + kwin_time = e->xbutton.time; + break; case MotionNotify: - kwin_time = (e->type == MotionNotify) ? - e->xmotion.time : e->xbutton.time; + kwin_time = e->xmotion.time; break; case KeyPress: case KeyRelease: