diff options
Diffstat (limited to 'src/window.cpp')
-rw-r--r-- | src/window.cpp | 138 |
1 files changed, 72 insertions, 66 deletions
diff --git a/src/window.cpp b/src/window.cpp index e07456f..405269e 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -74,6 +74,7 @@ Aquamarine::Window::Window (QWidget *parent, WId clientId, WId frame, Type type, mShapeSet (false), mUniqueHorzShape (false), mUniqueVertShape (false), + mInitialized (true), mPopup (0), mAdvancedMenu (0), mDesktopMenu (0), @@ -729,22 +730,24 @@ Aquamarine::Window::createDecoration (void) KDecoration *decor; if (mDecor) - return; + return; decor = Decorator::pluginManager ()->createDecoration (this); decor->init (); mDecor = decor; + mInitialized = false; + if (mType == Normal && mFrame) { - Aquamarine::trapXError (); - XSelectInput (qt_xdisplay (), mFrame, - StructureNotifyMask | PropertyChangeMask | - ButtonPressMask | ButtonReleaseMask | PointerMotionMask | - EnterWindowMask | LeaveWindowMask); - if (Aquamarine::popXError ()) - return; + Aquamarine::trapXError (); + XSelectInput (qt_xdisplay (), mFrame, + StructureNotifyMask | PropertyChangeMask | + ButtonPressMask | ButtonReleaseMask | PointerMotionMask | + EnterWindowMask | LeaveWindowMask); + if (Aquamarine::popXError ()) + return; } resizeDecoration (true); @@ -1073,11 +1076,11 @@ Aquamarine::Window::updateShadow (void) mTexturePicture, &mLayout); - if (mPixmap) + if (mPixmap && mDecor) { /* hm, update or repaint doesn't seem to do it */ - mDecor->widget ()->hide (); - mDecor->widget ()->show (); + mDecor->widget ()->hide (); + mDecor->widget ()->show (); } mUpdateProperty = true; @@ -1148,7 +1151,7 @@ Aquamarine::Window::resizeDecoration (bool force) if (!force) { - if (w == width () && h == height ()) + if (w == width () && h == height ()) return FALSE; } @@ -1159,40 +1162,40 @@ Aquamarine::Window::resizeDecoration (bool force) if (mType != Normal && mType != Switcher) { - Display *xdisplay = qt_xdisplay (); - Screen *xscreen = ScreenOfDisplay (xdisplay, qt_xscreen ()); - decor_shadow_t *tmpShadow; - decor_context_t c; - - /* XXX: we have to create a temporary shadow to get the client - geometry. libdecoration should be fixed so it's able to just - fill out a context struct and not necessarily generate a - shadow for this purpose. */ - tmpShadow = decor_shadow_create (xdisplay, - xscreen, - 1, 1, - mBorder.left, - mBorder.right, - mBorder.top, - mBorder.bottom, - mBorder.left, - mBorder.right, - mBorder.top, - mBorder.bottom, - Aquamarine::Decorator::shadowOptions (), - &c, - decor_draw_simple, - (void *) 0); - - decor_shadow_destroy (xdisplay, tmpShadow); - - w = c.left_corner_space + 1 + c.right_corner_space; - - /* most styles render something useful at least 30 px width */ - if (w < 30) - w = 30; - - mGeometry = QRect (50, 50, w, + Display *xdisplay = qt_xdisplay (); + Screen *xscreen = ScreenOfDisplay (xdisplay, qt_xscreen ()); + decor_shadow_t *tmpShadow; + decor_context_t c; + + /* XXX: we have to create a temporary shadow to get the client + geometry. libdecoration should be fixed so it's able to just + fill out a context struct and not necessarily generate a + shadow for this purpose. */ + tmpShadow = decor_shadow_create (xdisplay, + xscreen, + 1, 1, + mBorder.left, + mBorder.right, + mBorder.top, + mBorder.bottom, + mBorder.left, + mBorder.right, + mBorder.top, + mBorder.bottom, + Aquamarine::Decorator::shadowOptions (), + &c, + decor_draw_simple, + (void *) 0); + + decor_shadow_destroy (xdisplay, tmpShadow); + + w = c.left_corner_space + 1 + c.right_corner_space; + + /* most styles render something useful at least 30 px width */ + if (w < 30) + w = 30; + + mGeometry = QRect (50, 50, w, c.top_corner_space + 1 + c.bottom_corner_space); } @@ -1201,14 +1204,14 @@ Aquamarine::Window::resizeDecoration (bool force) if (mPixmap) { - XFreePixmap (qt_xdisplay (), mPixmap); - mPixmap = None; + XFreePixmap (qt_xdisplay (), mPixmap); + mPixmap = None; } if (mPicture) { - XRenderFreePicture (qt_xdisplay (), mPicture); - mPicture = 0; + XRenderFreePicture (qt_xdisplay (), mPicture); + mPicture = 0; } setGeometry (QRect (mGeometry.x () + ROOT_OFF_X - mBorder.left, @@ -1217,32 +1220,34 @@ Aquamarine::Window::resizeDecoration (bool force) if (mMapped) { - mPendingConfigure++; + mPendingConfigure++; } else { - mPendingMap = 1; + mPendingMap = 1; - show (); + show (); - mMapped = true; + mMapped = true; - /* XXX: is there a more appropriate way to achieve this? - add WType_TopLevel flag so that visualRect isn't clipped - to parent. */ - setWFlags (getWFlags () | WType_TopLevel); + /* XXX: is there a more appropriate way to achieve this? + add WType_TopLevel flag so that visualRect isn't clipped + to parent. */ + setWFlags (getWFlags () | WType_TopLevel); - if (mDamageId != winId ()) - { - mDamageId = winId (); - XDamageCreate (qt_xdisplay (), mDamageId, - XDamageReportRawRectangles); - } + if (mDamageId != winId ()) + { + mDamageId = winId (); + XDamageCreate (qt_xdisplay (), mDamageId, + XDamageReportRawRectangles); + } } mDecor->resize (QSize (w, h)); mDecor->widget ()->show (); + mInitialized = true; + return TRUE; } @@ -1415,7 +1420,8 @@ Aquamarine::Window::updateFrame (WId frame) StructureNotifyMask | PropertyChangeMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | EnterWindowMask | LeaveWindowMask); - Aquamarine::popXError (); + if (!Aquamarine::popXError () && !mInitialized) + resizeDecoration(true); } void @@ -1554,7 +1560,7 @@ Aquamarine::Window::handleDesktopPopupActivated (int id) setDesktop (id); else { - setDesktop ((desktop () == NET::OnAllDesktops) ? + setDesktop ((desktop () == NET::OnAllDesktops) ? KWin::currentDesktop() : NET::OnAllDesktops); } } |