help toolkits to figure out the frame geometry when receiving reparentNotify

svn path=/trunk/kdebase/kwin/; revision=44288
icc-effect-5.14.5
Matthias Ettrich 2000-03-22 11:47:10 +00:00
parent 0bb1975556
commit 0df9f29ccd
3 changed files with 16 additions and 9 deletions

View File

@ -111,9 +111,6 @@ WindowWrapper::WindowWrapper( WId w, Client *parent, const char* name)
wc.border_width = 0; wc.border_width = 0;
XConfigureWindow( qt_xdisplay(), win, CWBorderWidth, &wc ); XConfigureWindow( qt_xdisplay(), win, CWBorderWidth, &wc );
// get the window
XReparentWindow( qt_xdisplay(), win, winId(), 0, 0 );
// // overwrite Qt-defaults because we need SubstructureNotifyMask // // overwrite Qt-defaults because we need SubstructureNotifyMask
XSelectInput( qt_xdisplay(), winId(), XSelectInput( qt_xdisplay(), winId(),
KeyPressMask | KeyReleaseMask | KeyPressMask | KeyReleaseMask |
@ -140,6 +137,8 @@ WindowWrapper::WindowWrapper( WId w, Client *parent, const char* name)
ButtonPressMask, ButtonPressMask,
GrabModeSync, GrabModeAsync, GrabModeSync, GrabModeAsync,
None, None ); None, None );
reparented = FALSE;
} }
WindowWrapper::~WindowWrapper() WindowWrapper::~WindowWrapper()
@ -160,7 +159,7 @@ QSizePolicy WindowWrapper::sizePolicy() const
void WindowWrapper::resizeEvent( QResizeEvent * ) void WindowWrapper::resizeEvent( QResizeEvent * )
{ {
if ( win ) { if ( win && reparented ) {
XMoveResizeWindow( qt_xdisplay(), win, XMoveResizeWindow( qt_xdisplay(), win,
0, 0, width(), height() ); 0, 0, width(), height() );
if ( ((Client*)parentWidget())->shape() ) if ( ((Client*)parentWidget())->shape() )
@ -171,6 +170,11 @@ void WindowWrapper::resizeEvent( QResizeEvent * )
void WindowWrapper::showEvent( QShowEvent* ) void WindowWrapper::showEvent( QShowEvent* )
{ {
if ( win ) { if ( win ) {
if ( !reparented ) {
// get the window
XReparentWindow( qt_xdisplay(), win, winId(), 0, 0 );
reparented = TRUE;
}
XMoveResizeWindow( qt_xdisplay(), win, XMoveResizeWindow( qt_xdisplay(), win,
0, 0, width(), height() ); 0, 0, width(), height() );
XMapRaised( qt_xdisplay(), win ); XMapRaised( qt_xdisplay(), win );
@ -193,10 +197,12 @@ void WindowWrapper::invalidateWindow()
void WindowWrapper::releaseWindow() void WindowWrapper::releaseWindow()
{ {
if ( win ) { if ( win ) {
XReparentWindow( qt_xdisplay(), win, if ( reparented ) {
((Client*)parentWidget())->workspace()->rootWin(), XReparentWindow( qt_xdisplay(), win,
parentWidget()->x(), ((Client*)parentWidget())->workspace()->rootWin(),
parentWidget()->y() ); parentWidget()->x(),
parentWidget()->y() );
}
XRemoveFromSaveSet(qt_xdisplay(), win ); XRemoveFromSaveSet(qt_xdisplay(), win );
invalidateWindow(); invalidateWindow();

View File

@ -35,6 +35,7 @@ protected:
private: private:
WId win; WId win;
Time lastMouseEventTime; Time lastMouseEventTime;
bool reparented;
}; };
inline WId WindowWrapper::window() const inline WId WindowWrapper::window() const

View File

@ -317,7 +317,7 @@ void StdClient::stickyChange( bool s)
button[1]->setIconSet( s?*pindown_pix:*pinup_pix ); button[1]->setIconSet( s?*pindown_pix:*pinup_pix );
} }
void StdClient::paintEvent( QPaintEvent* e) void StdClient::paintEvent( QPaintEvent* )
{ {
QPainter p( this ); QPainter p( this );
QRect t = titlebar->geometry(); QRect t = titlebar->geometry();