Make the outline for moving/resizing work with Qt4, which bothers
to support XOR painting only when XRender is available. Given that outline should be mainly used with older systems, go for a DIY Xlib-based solution. Needs changes in decorations using it. BUG: 149997 svn path=/trunk/KDE/kdebase/workspace/; revision=739136
This commit is contained in:
parent
6cf0a9599e
commit
ab70575d1f
13 changed files with 33 additions and 58 deletions
|
@ -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();
|
||||
|
|
1
bridge.h
1
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 );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
13
geometry.cpp
13
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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -31,6 +31,7 @@ DEALINGS IN THE SOFTWARE.
|
|||
#if defined Q_WS_X11 && ! defined K_WS_QTONLY
|
||||
#include <X11/Xlib.h>
|
||||
#include <fixx11h.h>
|
||||
#include <QX11Info>
|
||||
#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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue