diff --git a/bridge.cpp b/bridge.cpp index 3ea8a8a48f..12e5b479d7 100644 --- a/bridge.cpp +++ b/bridge.cpp @@ -110,11 +110,6 @@ QRect Bridge::iconGeometry() const return QRect( r.pos.x, r.pos.y, r.size.width, r.size.height ); } -QWidget* Bridge::workspaceWidget() const - { - return c->workspace()->desktopWidget(); - } - WId Bridge::windowId() const { return c->window(); diff --git a/bridge.h b/bridge.h index b721f38db5..f7f2f94eef 100644 --- a/bridge.h +++ b/bridge.h @@ -49,7 +49,6 @@ class Bridge : public KDecorationBridge virtual QRect geometry() const; virtual QRect iconGeometry() const; virtual QRegion unobscuredRegion( const QRegion& r ) const; - virtual QWidget* workspaceWidget() const; virtual WId windowId() const; virtual void closeWindow(); virtual void maximize( MaximizeMode mode ); diff --git a/clients/b2/b2client.cpp b/clients/b2/b2client.cpp index cbf3a8b192..65a56c46ea 100644 --- a/clients/b2/b2client.cpp +++ b/clients/b2/b2client.cpp @@ -1240,6 +1240,7 @@ bool B2Client::drawbound(const QRect& geom, bool clear) } else { *visible_bound = geom; } +#if 0 if (!workspaceWidget()) { kDebug() << "workspaceWidget is null"; } else { @@ -1256,7 +1257,7 @@ bool B2Client::drawbound(const QRect& geom, bool clear) p.end(); } } - +#endif return true; } diff --git a/geometry.cpp b/geometry.cpp index 2075c296c6..5c5b3d97bd 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2218,9 +2218,13 @@ void Client::doDrawbound( const QRect& geom, bool clear ) { if( decoration != NULL && decoration->drawbound( geom, clear )) return; // done by decoration - QPainter p ( workspace()->desktopWidget() ); - p.setPen( QPen( Qt::white, 5 ) ); - p.setCompositionMode( QPainter::CompositionMode_Xor ); + XGCValues xgc; + xgc.function = GXxor; + xgc.foreground = WhitePixel( display(), DefaultScreen( display())); + xgc.line_width = 5; + xgc.subwindow_mode = IncludeInferiors; + GC gc = XCreateGC( display(), DefaultRootWindow( display()), + GCFunction | GCForeground | GCLineWidth | GCSubwindowMode, &xgc ); // the line is 5 pixel thick, so compensate for the extra two pixels // on outside (#88657) QRect g = geom; @@ -2234,7 +2238,8 @@ void Client::doDrawbound( const QRect& geom, bool clear ) g.setTop( g.top() + 2 ); g.setBottom( g.bottom() - 2 ); } - p.drawRect( g ); + XDrawRectangle( display(), DefaultRootWindow( display()), gc, g.x(), g.y(), g.width(), g.height()); + XFreeGC( display(), gc ); } void Client::positionGeometryTip() diff --git a/kcmkwin/kwindecoration/preview.cpp b/kcmkwin/kwindecoration/preview.cpp index 422ee850c9..5fbc66ab01 100644 --- a/kcmkwin/kwindecoration/preview.cpp +++ b/kcmkwin/kwindecoration/preview.cpp @@ -375,11 +375,6 @@ QRegion KDecorationPreviewBridge::unobscuredRegion( const QRegion& r ) const return preview->unobscuredRegion( active, r ); } -QWidget* KDecorationPreviewBridge::workspaceWidget() const - { - return preview; - } - WId KDecorationPreviewBridge::windowId() const { return 0; // no decorated window diff --git a/kcmkwin/kwindecoration/preview.h b/kcmkwin/kwindecoration/preview.h index b0405b58f5..114ed68470 100644 --- a/kcmkwin/kwindecoration/preview.h +++ b/kcmkwin/kwindecoration/preview.h @@ -96,7 +96,6 @@ class KDecorationPreviewBridge virtual QRect geometry() const; virtual QRect iconGeometry() const; virtual QRegion unobscuredRegion( const QRegion& r ) const; - virtual QWidget* workspaceWidget() const; virtual WId windowId() const; virtual void closeWindow(); virtual void maximize( MaximizeMode mode ); diff --git a/lib/kdecoration.cpp b/lib/kdecoration.cpp index e69f448e64..a072c64e87 100644 --- a/lib/kdecoration.cpp +++ b/lib/kdecoration.cpp @@ -31,6 +31,7 @@ DEALINGS IN THE SOFTWARE. #if defined Q_WS_X11 && ! defined K_WS_QTONLY #include #include +#include #endif #include "kdecoration_p.h" @@ -224,11 +225,6 @@ QRegion KDecoration::unobscuredRegion( const QRegion& r ) const return bridge_->unobscuredRegion( r ); } -QWidget* KDecoration::workspaceWidget() const - { - return bridge_->workspaceWidget(); - } - WId KDecoration::windowId() const { return bridge_->windowId(); @@ -340,7 +336,7 @@ void KDecoration::ungrabXServer() { bridge_->grabXServer( false ); } - + KDecoration::Position KDecoration::mousePosition( const QPoint& p ) const { const int range = 16; diff --git a/lib/kdecoration.h b/lib/kdecoration.h index 68eaf0b7f7..c9147e88e5 100644 --- a/lib/kdecoration.h +++ b/lib/kdecoration.h @@ -522,11 +522,6 @@ class KWIN_EXPORT KDecoration * @param r The region you want to check for holes */ QRegion unobscuredRegion( const QRegion& r ) const; - /** - * Returns the main workspace widget. The main purpose of this function is to - * allow painting the minimize animation or the transparent move bound on it. - */ - QWidget* workspaceWidget() const; /** * Returns the handle of the window that is being decorated. It is possible * the returned value will be 0. @@ -645,11 +640,26 @@ class KWIN_EXPORT KDecoration * Note that if you e.g. paint the outline using a 5 pixels wide line, * you should compensate for the 2 pixels that would make the window * look larger. + * It is the decoration's responsibility to do the painting, using + * e.g. code like: + * @code + * Display* dpy = QX11Info::display(); + * XGCValues xgc; + * xgc.function = GXxor; + * xgc.foreground = WhitePixel( dpy, DefaultScreen( dpy )); + * xgc.line_width = width; + * xgc.subwindow_mode = IncludeInferiors; + * GC gc = XCreateGC( dpy, DefaultRootWindow( dpy ), + * GCFunction | GCForeground | GCLineWidth | GCSubwindowMode, &xgc ); + * XDrawRectangle( dpy, DefaultRootWindow( dpy ), gc, r.x(), r.y(), r.width(), r.height()); + * XFreeGC( dpy, gc ); + * @endcode * * @param geom The geometry at this the bound should be drawn - * @param clear @a true if the bound should be cleared + * @param clear @a true if the bound should be cleared (when doing the usual XOR + * painting this argument can be simply ignored) * - * @see workspaceWidget() and geometry(). + * @see geometry() */ virtual bool drawbound( const QRect& geom, bool clear ); /** @@ -659,8 +669,9 @@ class KWIN_EXPORT KDecoration * futher event processing is allowed (i.e. no kapp->processEvents()). * @a False should be returned if the default implementation should be used. * Note that you should not use this function to force disabling of the animation. + * See @p drawbound() for details on how to do the painting. * - * @see workspaceWidget(), geometry() and helperShowHide(). + * @see geometry() and helperShowHide(). */ virtual bool animateMinimize( bool minimize ); /** @@ -705,7 +716,7 @@ class KWIN_EXPORT KDecoration * that affect widget drawing are allowed. Window type flags like WX11BypassWM * or WStyle_NoBorder are forbidden. */ - Qt::WFlags initialWFlags() const; + Qt::WFlags initialWFlags() const; /** * This function is only allowed to be called once from animateMinimize(). * It can be used if the window should be shown or hidden at a specific diff --git a/lib/kdecoration_p.h b/lib/kdecoration_p.h index a532039d83..d3a04057f4 100644 --- a/lib/kdecoration_p.h +++ b/lib/kdecoration_p.h @@ -88,7 +88,6 @@ class KDecorationBridge : public KDecorationDefines virtual QRect geometry() const = 0; virtual QRect iconGeometry() const = 0; virtual QRegion unobscuredRegion( const QRegion& r ) const = 0; - virtual QWidget* workspaceWidget() const = 0; virtual WId windowId() const = 0; virtual void closeWindow() = 0; virtual void maximize( MaximizeMode mode ) = 0; diff --git a/tools/decobenchmark/preview.cpp b/tools/decobenchmark/preview.cpp index fab5a6e469..3782885a52 100644 --- a/tools/decobenchmark/preview.cpp +++ b/tools/decobenchmark/preview.cpp @@ -328,11 +328,6 @@ QRegion KDecorationPreviewBridge::unobscuredRegion( const QRegion& r ) const return preview->unobscuredRegion( active, r ); } -QWidget* KDecorationPreviewBridge::workspaceWidget() const - { - return preview; - } - WId KDecorationPreviewBridge::windowId() const { return 0; // no decorated window diff --git a/tools/decobenchmark/preview.h b/tools/decobenchmark/preview.h index 460fadcc8a..d114871610 100644 --- a/tools/decobenchmark/preview.h +++ b/tools/decobenchmark/preview.h @@ -87,7 +87,6 @@ class KDecorationPreviewBridge virtual QRect geometry() const; virtual QRect iconGeometry() const; virtual QRegion unobscuredRegion( const QRegion& r ) const; - virtual QWidget* workspaceWidget() const; virtual WId windowId() const; virtual void closeWindow(); virtual void maximize( MaximizeMode mode ); diff --git a/workspace.cpp b/workspace.cpp index 61e2e19648..fd094edd43 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -78,7 +78,6 @@ Workspace::Workspace( bool restore ) number_of_desktops(0), active_popup( NULL ), active_popup_client( NULL ), - desktop_widget (0), temporaryRulesMessages( "_KDE_NET_WM_TEMPORARY_RULES", NULL, false ), rules_updates_disabled( false ), active_client (0), @@ -166,10 +165,6 @@ Workspace::Workspace( bool restore ) (void) QApplication::desktop(); // trigger creation of desktop widget - desktop_widget = new QWidget( 0, Qt::Desktop ); - desktop_widget->setObjectName( "desktop_widget" ); - desktop_widget->setAttribute( Qt::WA_PaintUnclipped ); - // call this before XSelectInput() on the root window startup = new KStartupInfo( KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this ); @@ -450,7 +445,6 @@ Workspace::~Workspace() it != unmanaged.end(); ++it ) (*it)->release(); - delete desktop_widget; delete tab_box; delete popupinfo; delete popup; @@ -2042,16 +2036,6 @@ bool Workspace::keyPressMouseEmulation( XKeyEvent& ev ) } -/*! - Returns the workspace's desktop widget. The desktop widget is - sometimes required by clients to draw on it, for example outlines on - moving or resizing. - */ -QWidget* Workspace::desktopWidget() - { - return desktop_widget; - } - //Delayed focus functions void Workspace::delayFocus() { diff --git a/workspace.h b/workspace.h index 2e387ee3cf..8d4806c884 100644 --- a/workspace.h +++ b/workspace.h @@ -156,7 +156,6 @@ class Workspace : public QObject, public KDecorationDefines void setActiveScreenMouse( const QPoint &mousepos ); QRect screenGeometry( int screen ) const; int screenNumber( const QPoint &pos ) const; - QWidget* desktopWidget(); // for TabBox Client* currentTabBoxClient() const; @@ -559,8 +558,6 @@ class Workspace : public QObject, public KDecorationDefines QWidget* active_popup; Client* active_popup_client; - QWidget* desktop_widget; - void loadSessionInfo(); void loadWindowRules(); void editWindowRules( Client* c, bool whole_app );