From 0df9f29ccd4eda6ba7c6d14820184e41d52ea501 Mon Sep 17 00:00:00 2001 From: Matthias Ettrich Date: Wed, 22 Mar 2000 11:47:10 +0000 Subject: [PATCH] help toolkits to figure out the frame geometry when receiving reparentNotify svn path=/trunk/kdebase/kwin/; revision=44288 --- client.cpp | 22 ++++++++++++++-------- client.h | 1 + stdclient.cpp | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/client.cpp b/client.cpp index 49c415831b..dcc22524d7 100644 --- a/client.cpp +++ b/client.cpp @@ -111,9 +111,6 @@ WindowWrapper::WindowWrapper( WId w, Client *parent, const char* name) wc.border_width = 0; XConfigureWindow( qt_xdisplay(), win, CWBorderWidth, &wc ); - // get the window - XReparentWindow( qt_xdisplay(), win, winId(), 0, 0 ); - // // overwrite Qt-defaults because we need SubstructureNotifyMask XSelectInput( qt_xdisplay(), winId(), KeyPressMask | KeyReleaseMask | @@ -140,6 +137,8 @@ WindowWrapper::WindowWrapper( WId w, Client *parent, const char* name) ButtonPressMask, GrabModeSync, GrabModeAsync, None, None ); + + reparented = FALSE; } WindowWrapper::~WindowWrapper() @@ -160,7 +159,7 @@ QSizePolicy WindowWrapper::sizePolicy() const void WindowWrapper::resizeEvent( QResizeEvent * ) { - if ( win ) { + if ( win && reparented ) { XMoveResizeWindow( qt_xdisplay(), win, 0, 0, width(), height() ); if ( ((Client*)parentWidget())->shape() ) @@ -171,6 +170,11 @@ void WindowWrapper::resizeEvent( QResizeEvent * ) void WindowWrapper::showEvent( QShowEvent* ) { if ( win ) { + if ( !reparented ) { + // get the window + XReparentWindow( qt_xdisplay(), win, winId(), 0, 0 ); + reparented = TRUE; + } XMoveResizeWindow( qt_xdisplay(), win, 0, 0, width(), height() ); XMapRaised( qt_xdisplay(), win ); @@ -193,10 +197,12 @@ void WindowWrapper::invalidateWindow() void WindowWrapper::releaseWindow() { if ( win ) { - XReparentWindow( qt_xdisplay(), win, - ((Client*)parentWidget())->workspace()->rootWin(), - parentWidget()->x(), - parentWidget()->y() ); + if ( reparented ) { + XReparentWindow( qt_xdisplay(), win, + ((Client*)parentWidget())->workspace()->rootWin(), + parentWidget()->x(), + parentWidget()->y() ); + } XRemoveFromSaveSet(qt_xdisplay(), win ); invalidateWindow(); diff --git a/client.h b/client.h index a3e4589e73..0a8ccbff0e 100644 --- a/client.h +++ b/client.h @@ -35,6 +35,7 @@ protected: private: WId win; Time lastMouseEventTime; + bool reparented; }; inline WId WindowWrapper::window() const diff --git a/stdclient.cpp b/stdclient.cpp index fb4dbafe4f..e29bfa8c96 100644 --- a/stdclient.cpp +++ b/stdclient.cpp @@ -317,7 +317,7 @@ void StdClient::stickyChange( bool s) button[1]->setIconSet( s?*pindown_pix:*pinup_pix ); } -void StdClient::paintEvent( QPaintEvent* e) +void StdClient::paintEvent( QPaintEvent* ) { QPainter p( this ); QRect t = titlebar->geometry();