Name the class used to postpone geometry changes also Blocker,
to be consistent with the one used for stacking changes. svn path=/branches/work/kwin_composite/; revision=606262
This commit is contained in:
parent
8100c40188
commit
09781249b9
4 changed files with 146 additions and 295 deletions
216
client.cpp
216
client.cpp
|
@ -28,6 +28,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
#include "atoms.h"
|
||||
#include "notifications.h"
|
||||
#include "rules.h"
|
||||
#include "scene.h"
|
||||
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <QX11Info>
|
||||
|
@ -63,12 +64,10 @@ namespace KWinInternal
|
|||
is done in manage().
|
||||
*/
|
||||
Client::Client( Workspace *ws )
|
||||
: QObject( NULL ),
|
||||
: Toplevel( ws ),
|
||||
client( None ),
|
||||
wrapper( None ),
|
||||
frame( None ),
|
||||
decoration( NULL ),
|
||||
wspace( ws ),
|
||||
bridge( new Bridge( this )),
|
||||
move_faked_activity( false ),
|
||||
move_resize_grab_window( None ),
|
||||
|
@ -82,7 +81,7 @@ Client::Client( Workspace *ws )
|
|||
process_killer( NULL ),
|
||||
user_time( CurrentTime ), // not known yet
|
||||
allowed_actions( 0 ),
|
||||
postpone_geometry_updates( 0 ),
|
||||
block_geometry_updates( 0 ),
|
||||
pending_geometry_update( false ),
|
||||
shade_geometry_change( false ),
|
||||
border_left( 0 ),
|
||||
|
@ -111,7 +110,6 @@ Client::Client( Workspace *ws )
|
|||
deleting = false;
|
||||
keep_above = false;
|
||||
keep_below = false;
|
||||
is_shape = false;
|
||||
motif_noborder = false;
|
||||
motif_may_move = true;
|
||||
motif_may_resize = true;
|
||||
|
@ -124,6 +122,7 @@ Client::Client( Workspace *ws )
|
|||
modal = false;
|
||||
noborder = false;
|
||||
user_noborder = false;
|
||||
not_obscured = false;
|
||||
urgency = false;
|
||||
ignore_focus_stealing = false;
|
||||
demands_attention = false;
|
||||
|
@ -142,7 +141,7 @@ Client::Client( Workspace *ws )
|
|||
|
||||
cmap = None;
|
||||
|
||||
frame_geometry = QRect( 0, 0, 100, 100 ); // so that decorations don't start with size being (0,0)
|
||||
geom = QRect( 0, 0, 100, 100 ); // so that decorations don't start with size being (0,0)
|
||||
client_size = QSize( 100, 100 );
|
||||
|
||||
// SELI initialize xsizehints??
|
||||
|
@ -155,9 +154,10 @@ Client::~Client()
|
|||
{
|
||||
assert(!moveResizeMode);
|
||||
assert( client == None );
|
||||
assert( frame == None && wrapper == None );
|
||||
assert( wrapper == None );
|
||||
// assert( frameId() == None );
|
||||
assert( decoration == NULL );
|
||||
assert( postpone_geometry_updates == 0 );
|
||||
assert( block_geometry_updates == 0 );
|
||||
assert( !check_active_modal );
|
||||
delete info;
|
||||
delete bridge;
|
||||
|
@ -176,12 +176,13 @@ void Client::releaseWindow( bool on_shutdown )
|
|||
{
|
||||
assert( !deleting );
|
||||
deleting = true;
|
||||
finishCompositing();
|
||||
workspace()->discardUsedWindowRules( this, true ); // remove ForceTemporarily rules
|
||||
StackingUpdatesBlocker blocker( workspace());
|
||||
if (moveResizeMode)
|
||||
leaveMoveResize();
|
||||
finishWindowRules();
|
||||
++postpone_geometry_updates;
|
||||
++block_geometry_updates;
|
||||
setMappingState( WithdrawnState );
|
||||
setModal( false ); // otherwise its mainwindow wouldn't get focus
|
||||
hidden = true; // so that it's not considered visible anymore (can't use hideClient(), it would set flags)
|
||||
|
@ -219,9 +220,9 @@ void Client::releaseWindow( bool on_shutdown )
|
|||
client = None;
|
||||
XDestroyWindow( display(), wrapper );
|
||||
wrapper = None;
|
||||
XDestroyWindow( display(), frame );
|
||||
frame = None;
|
||||
--postpone_geometry_updates; // don't use GeometryUpdatesBlocker, it would now set the geometry
|
||||
XDestroyWindow( display(), frameId());
|
||||
// frame = None;
|
||||
--block_geometry_updates; // don't use GeometryUpdatesBlocker, it would now set the geometry
|
||||
deleteClient( this, Allowed );
|
||||
}
|
||||
|
||||
|
@ -231,12 +232,13 @@ void Client::destroyClient()
|
|||
{
|
||||
assert( !deleting );
|
||||
deleting = true;
|
||||
finishCompositing();
|
||||
workspace()->discardUsedWindowRules( this, true ); // remove ForceTemporarily rules
|
||||
StackingUpdatesBlocker blocker( workspace());
|
||||
if (moveResizeMode)
|
||||
leaveMoveResize();
|
||||
finishWindowRules();
|
||||
++postpone_geometry_updates;
|
||||
++block_geometry_updates;
|
||||
setModal( false );
|
||||
hidden = true; // so that it's not considered visible anymore
|
||||
workspace()->clientHidden( this );
|
||||
|
@ -246,9 +248,9 @@ void Client::destroyClient()
|
|||
client = None; // invalidate
|
||||
XDestroyWindow( display(), wrapper );
|
||||
wrapper = None;
|
||||
XDestroyWindow( display(), frame );
|
||||
frame = None;
|
||||
--postpone_geometry_updates; // don't use GeometryUpdatesBlocker, it would now set the geometry
|
||||
XDestroyWindow( display(), frameId());
|
||||
// frame = None;
|
||||
--block_geometry_updates; // don't use GeometryUpdatesBlocker, it would now set the geometry
|
||||
deleteClient( this, Allowed );
|
||||
}
|
||||
|
||||
|
@ -258,12 +260,11 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
|
|||
|| ( decoration != NULL && !noBorder())))
|
||||
return;
|
||||
bool do_show = false;
|
||||
postponeGeometryUpdates( true );
|
||||
blockGeometryUpdates( true );
|
||||
if( force )
|
||||
destroyDecoration();
|
||||
if( !noBorder())
|
||||
{
|
||||
setMask( QRegion()); // reset shape mask
|
||||
decoration = workspace()->createDecoration( bridge );
|
||||
// TODO check decoration's minimum size?
|
||||
decoration->init();
|
||||
|
@ -278,15 +279,18 @@ void Client::updateDecoration( bool check_workspace_pos, bool force )
|
|||
workarea_diff_x = save_workarea_diff_x;
|
||||
workarea_diff_y = save_workarea_diff_y;
|
||||
do_show = true;
|
||||
if( scene != NULL )
|
||||
scene->windowGeometryShapeChanged( this );
|
||||
}
|
||||
else
|
||||
destroyDecoration();
|
||||
if( check_workspace_pos )
|
||||
checkWorkspacePosition();
|
||||
postponeGeometryUpdates( false );
|
||||
blockGeometryUpdates( false );
|
||||
if( do_show )
|
||||
decoration->widget()->show();
|
||||
updateFrameExtents();
|
||||
addDamageFull();
|
||||
}
|
||||
|
||||
void Client::destroyDecoration()
|
||||
|
@ -304,6 +308,9 @@ void Client::destroyDecoration()
|
|||
move( grav );
|
||||
workarea_diff_x = save_workarea_diff_x;
|
||||
workarea_diff_y = save_workarea_diff_y;
|
||||
if( scene != NULL )
|
||||
scene->windowGeometryShapeChanged( this );
|
||||
addDamageFull();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,7 +323,7 @@ void Client::checkBorderSizes()
|
|||
if( new_left == border_left && new_right == border_right
|
||||
&& new_top == border_top && new_bottom == border_bottom )
|
||||
return;
|
||||
GeometryUpdatesPostponer blocker( this );
|
||||
GeometryUpdatesBlocker blocker( this );
|
||||
move( calculateGravitation( true ));
|
||||
border_left = new_left;
|
||||
border_right = new_right;
|
||||
|
@ -333,7 +340,7 @@ void Client::checkBorderSizes()
|
|||
|
||||
void Client::detectNoBorder()
|
||||
{
|
||||
if( Shape::hasShape( window()))
|
||||
if( shape())
|
||||
{
|
||||
noborder = true;
|
||||
return;
|
||||
|
@ -421,47 +428,22 @@ void Client::setUserNoBorder( bool set )
|
|||
|
||||
void Client::updateShape()
|
||||
{
|
||||
if ( shape() )
|
||||
XShapeCombineShape(display(), frameId(), ShapeBounding,
|
||||
clientPos().x(), clientPos().y(),
|
||||
window(), ShapeBounding, ShapeSet);
|
||||
else
|
||||
XShapeCombineMask( display(), frameId(), ShapeBounding, 0, 0,
|
||||
None, ShapeSet);
|
||||
if( scene != NULL )
|
||||
scene->windowGeometryShapeChanged( this );
|
||||
addDamageFull();
|
||||
// workaround for #19644 - shaped windows shouldn't have decoration
|
||||
if( shape() && !noBorder())
|
||||
{
|
||||
noborder = true;
|
||||
updateDecoration( true );
|
||||
}
|
||||
if( shape())
|
||||
{
|
||||
XShapeCombineShape(display(), frameId(), ShapeBounding,
|
||||
clientPos().x(), clientPos().y(),
|
||||
window(), ShapeBounding, ShapeSet);
|
||||
}
|
||||
// !shape() mask setting is done in setMask() when the decoration
|
||||
// calls it or when the decoration is created/destroyed
|
||||
|
||||
if( Shape::version() >= 0x11 ) // 1.1, has input shape support
|
||||
{ // There appears to be no way to find out if a window has input
|
||||
// shape set or not, so always propagate the input shape
|
||||
// (it's the same like the bounding shape by default).
|
||||
// Also, build the shape using a helper window, not directly
|
||||
// in the frame window, because the sequence set-shape-to-frame,
|
||||
// remove-shape-of-client, add-input-shape-of-client has the problem
|
||||
// that after the second step there's a hole in the input shape
|
||||
// until the real shape of the client is added and that can make
|
||||
// the window lose focus (which is a problem with mouse focus policies)
|
||||
static Window helper_window = None;
|
||||
if( helper_window == None )
|
||||
helper_window = XCreateSimpleWindow( display(), rootWindow(),
|
||||
0, 0, 1, 1, 0, 0, 0 );
|
||||
XResizeWindow( display(), helper_window, width(), height());
|
||||
XShapeCombineShape( display(), helper_window, ShapeInput, 0, 0,
|
||||
frameId(), ShapeBounding, ShapeSet );
|
||||
XShapeCombineShape( display(), helper_window, ShapeInput,
|
||||
clientPos().x(), clientPos().y(),
|
||||
window(), ShapeBounding, ShapeSubtract );
|
||||
XShapeCombineShape( display(), helper_window, ShapeInput,
|
||||
clientPos().x(), clientPos().y(),
|
||||
window(), ShapeInput, ShapeUnion );
|
||||
XShapeCombineShape( display(), frameId(), ShapeInput, 0, 0,
|
||||
helper_window, ShapeInput, ShapeSet );
|
||||
}
|
||||
}
|
||||
|
||||
void Client::setMask( const QRegion& reg, int mode )
|
||||
|
@ -490,7 +472,9 @@ void Client::setMask( const QRegion& reg, int mode )
|
|||
xrects, rects.count(), ShapeSet, mode );
|
||||
delete[] xrects;
|
||||
}
|
||||
updateShape();
|
||||
if( scene != NULL )
|
||||
scene->windowGeometryShapeChanged( this );
|
||||
addDamageFull();
|
||||
}
|
||||
|
||||
QRegion Client::mask() const
|
||||
|
@ -739,7 +723,7 @@ void Client::setShade( ShadeMode mode )
|
|||
}
|
||||
|
||||
assert( decoration != NULL ); // noborder windows can't be shaded
|
||||
GeometryUpdatesPostponer blocker( this );
|
||||
GeometryUpdatesBlocker blocker( this );
|
||||
// decorations may turn off some borders when shaded
|
||||
decoration->borders( border_left, border_right, border_top, border_bottom );
|
||||
|
||||
|
@ -923,8 +907,8 @@ void Client::setMappingState(int s)
|
|||
XChangeProperty(display(), window(), atoms->wm_state, atoms->wm_state, 32,
|
||||
PropModeReplace, (unsigned char *)data, 2);
|
||||
|
||||
if( was_unmanaged ) // manage() did postpone_geometry_updates = 1, now it's ok to finally set the geometry
|
||||
postponeGeometryUpdates( false );
|
||||
if( was_unmanaged ) // manage() did block_geometry_updates = 1, now it's ok to finally set the geometry
|
||||
blockGeometryUpdates( false );
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -935,7 +919,7 @@ void Client::rawShow()
|
|||
{
|
||||
if( decoration != NULL )
|
||||
decoration->widget()->show(); // not really necessary, but let it know the state
|
||||
XMapWindow( display(), frame );
|
||||
XMapWindow( display(), frameId());
|
||||
if( !isShade())
|
||||
{
|
||||
XMapWindow( display(), wrapper );
|
||||
|
@ -957,7 +941,7 @@ void Client::rawHide()
|
|||
// will be missed is also very minimal, so I don't think it's needed to grab the server
|
||||
// here.
|
||||
XSelectInput( display(), wrapper, ClientWinMask ); // avoid getting UnmapNotify
|
||||
XUnmapWindow( display(), frame );
|
||||
XUnmapWindow( display(), frameId());
|
||||
XUnmapWindow( display(), wrapper );
|
||||
XUnmapWindow( display(), client );
|
||||
XSelectInput( display(), wrapper, ClientWinMask | SubstructureNotifyMask );
|
||||
|
@ -1302,7 +1286,7 @@ QString Client::readName() const
|
|||
return KWin::readNameProperty( window(), XA_WM_NAME );
|
||||
}
|
||||
|
||||
KWIN_COMPARE_PREDICATE( FetchNameInternalPredicate, const Client*, (!cl->isSpecialWindow() || cl->isToolbar()) && cl != value && cl->caption() == value->caption());
|
||||
KWIN_COMPARE_PREDICATE( FetchNameInternalPredicate, Client, const Client*, (!cl->isSpecialWindow() || cl->isToolbar()) && cl != value && cl->caption() == value->caption());
|
||||
|
||||
void Client::setCaption( const QString& _s, bool force )
|
||||
{
|
||||
|
@ -1320,7 +1304,7 @@ void Client::setCaption( const QString& _s, bool force )
|
|||
QString machine_suffix;
|
||||
if( wmClientMachine( false ) != "localhost" && !isLocalMachine( wmClientMachine( false )))
|
||||
machine_suffix = " <@" + wmClientMachine( true ) + '>';
|
||||
QString shortcut_suffix = !shortcut().isNull() ? ( " {" + shortcut().toString() + '}' ) : QString();
|
||||
QString shortcut_suffix = !shortcut().isNull() ? ( " {" + shortcut().toString() + '}' ) : "";
|
||||
cap_suffix = machine_suffix + shortcut_suffix;
|
||||
if ( ( !isSpecialWindow() || isToolbar()) && workspace()->findClient( FetchNameInternalPredicate( this )))
|
||||
{
|
||||
|
@ -1619,58 +1603,6 @@ bool Client::wantsInput() const
|
|||
return rules()->checkAcceptFocus( input || Ptakefocus );
|
||||
}
|
||||
|
||||
bool Client::isDesktop() const
|
||||
{
|
||||
return windowType() == NET::Desktop;
|
||||
}
|
||||
|
||||
bool Client::isDock() const
|
||||
{
|
||||
return windowType() == NET::Dock;
|
||||
}
|
||||
|
||||
bool Client::isTopMenu() const
|
||||
{
|
||||
return windowType() == NET::TopMenu;
|
||||
}
|
||||
|
||||
|
||||
bool Client::isMenu() const
|
||||
{
|
||||
return windowType() == NET::Menu && !isTopMenu(); // because of backwards comp.
|
||||
}
|
||||
|
||||
bool Client::isToolbar() const
|
||||
{
|
||||
return windowType() == NET::Toolbar;
|
||||
}
|
||||
|
||||
bool Client::isSplash() const
|
||||
{
|
||||
return windowType() == NET::Splash;
|
||||
}
|
||||
|
||||
bool Client::isUtility() const
|
||||
{
|
||||
return windowType() == NET::Utility;
|
||||
}
|
||||
|
||||
bool Client::isDialog() const
|
||||
{
|
||||
return windowType() == NET::Dialog;
|
||||
}
|
||||
|
||||
bool Client::isNormalWindow() const
|
||||
{
|
||||
return windowType() == NET::Normal;
|
||||
}
|
||||
|
||||
bool Client::isSpecialWindow() const
|
||||
{
|
||||
return isDesktop() || isDock() || isSplash() || isTopMenu()
|
||||
|| isToolbar(); // TODO
|
||||
}
|
||||
|
||||
NET::WindowType Client::windowType( bool direct, int supported_types ) const
|
||||
{
|
||||
NET::WindowType wt = info->windowType( supported_types );
|
||||
|
@ -1702,6 +1634,12 @@ NET::WindowType Client::windowType( bool direct, int supported_types ) const
|
|||
return wt;
|
||||
}
|
||||
|
||||
bool Client::isSpecialWindow() const
|
||||
{
|
||||
return isDesktop() || isDock() || isSplash() || isTopMenu()
|
||||
|| isToolbar(); // TODO
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets an appropriate cursor shape for the logical mouse position \a m
|
||||
|
||||
|
@ -1798,46 +1736,24 @@ void Client::cancelAutoRaise()
|
|||
autoRaiseTimer = 0;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
kdbgstream& operator<<( kdbgstream& stream, const Client* cl )
|
||||
double Client::opacity() const
|
||||
{
|
||||
if( cl == NULL )
|
||||
return stream << "\'NULL_CLIENT\'";
|
||||
return stream << "\'ID:" << cl->window() << ";WMCLASS:" << cl->resourceClass() << ":" << cl->resourceName() << ";Caption:" << cl->caption() << "\'";
|
||||
if( info->opacity() == 0xffffffff )
|
||||
return 1.0;
|
||||
return info->opacity() * 1.0 / 0xffffffff;
|
||||
}
|
||||
kdbgstream& operator<<( kdbgstream& stream, const ClientList& list )
|
||||
|
||||
void Client::setOpacity( double opacity )
|
||||
{
|
||||
stream << "LIST:(";
|
||||
bool first = true;
|
||||
for( ClientList::ConstIterator it = list.begin();
|
||||
it != list.end();
|
||||
++it )
|
||||
{
|
||||
if( !first )
|
||||
stream << ":";
|
||||
first = false;
|
||||
stream << *it;
|
||||
}
|
||||
stream << ")";
|
||||
return stream;
|
||||
opacity = qBound( 0.0, opacity, 1.0 );
|
||||
info->setOpacity( static_cast< unsigned long >( opacity * 0xffffffff ));
|
||||
// we'll react on PropertyNotify
|
||||
}
|
||||
kdbgstream& operator<<( kdbgstream& stream, const ConstClientList& list )
|
||||
|
||||
void Client::debug( kdbgstream& stream ) const
|
||||
{
|
||||
stream << "LIST:(";
|
||||
bool first = true;
|
||||
for( ConstClientList::ConstIterator it = list.begin();
|
||||
it != list.end();
|
||||
++it )
|
||||
{
|
||||
if( !first )
|
||||
stream << ":";
|
||||
first = false;
|
||||
stream << *it;
|
||||
}
|
||||
stream << ")";
|
||||
return stream;
|
||||
stream << "\'ID:" << window() << ";WMCLASS:" << resourceClass() << ":" << resourceName() << ";Caption:" << caption() << "\'";
|
||||
}
|
||||
#endif
|
||||
|
||||
QPixmap * kwin_get_menu_pix_hack()
|
||||
{
|
||||
|
|
164
client.h
164
client.h
|
@ -28,6 +28,7 @@ License. See the file "COPYING" for the exact licensing terms.
|
|||
#include "workspace.h"
|
||||
#include "kdecoration.h"
|
||||
#include "rules.h"
|
||||
#include "toplevel.h"
|
||||
|
||||
class QTimer;
|
||||
class KProcess;
|
||||
|
@ -42,7 +43,8 @@ class WinInfo;
|
|||
class SessionInfo;
|
||||
class Bridge;
|
||||
|
||||
class Client : public QObject, public KDecorationDefines
|
||||
class Client
|
||||
: public Toplevel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -52,7 +54,6 @@ class Client : public QObject, public KDecorationDefines
|
|||
Window wrapperId() const;
|
||||
Window decorationId() const;
|
||||
|
||||
Workspace* workspace() const;
|
||||
const Client* transientFor() const;
|
||||
Client* transientFor();
|
||||
bool isTransient() const;
|
||||
|
@ -66,23 +67,20 @@ class Client : public QObject, public KDecorationDefines
|
|||
const Group* group() const;
|
||||
Group* group();
|
||||
void checkGroup( Group* gr = NULL, bool force = false );
|
||||
// prefer isXXX() instead
|
||||
NET::WindowType windowType( bool direct = false, int supported_types = SUPPORTED_WINDOW_TYPES_MASK ) const;
|
||||
const WindowRules* rules() const;
|
||||
void removeRule( Rules* r );
|
||||
void setupWindowRules( bool ignore_temporary );
|
||||
void applyWindowRules();
|
||||
virtual NET::WindowType windowType( bool direct = false, int supported_types = SUPPORTED_WINDOW_TYPES_MASK ) const;
|
||||
// returns true for "special" windows and false for windows which are "normal"
|
||||
// (normal=window which has a border, can be moved by the user, can be closed, etc.)
|
||||
// true for Desktop, Dock, Splash, Override and TopMenu (and Toolbar??? - for now)
|
||||
// false for Normal, Dialog, Utility and Menu (and Toolbar??? - not yet) TODO
|
||||
bool isSpecialWindow() const;
|
||||
bool hasNETSupport() const;
|
||||
|
||||
QRect geometry() const;
|
||||
QSize size() const;
|
||||
QSize minSize() const;
|
||||
QSize maxSize() const;
|
||||
QPoint pos() const;
|
||||
QRect rect() const;
|
||||
int x() const;
|
||||
int y() const;
|
||||
int width() const;
|
||||
int height() const;
|
||||
QPoint clientPos() const; // inside of geometry()
|
||||
QSize clientSize() const;
|
||||
|
||||
|
@ -165,24 +163,9 @@ class Client : public QObject, public KDecorationDefines
|
|||
// auxiliary functions, depend on the windowType
|
||||
bool wantsTabFocus() const;
|
||||
bool wantsInput() const;
|
||||
bool hasNETSupport() const;
|
||||
bool isMovable() const;
|
||||
bool isDesktop() const;
|
||||
bool isDock() const;
|
||||
bool isToolbar() const;
|
||||
bool isTopMenu() const;
|
||||
bool isMenu() const;
|
||||
bool isNormalWindow() const; // normal as in 'NET::Normal or NET::Unknown non-transient'
|
||||
bool isDialog() const;
|
||||
bool isSplash() const;
|
||||
bool isUtility() const;
|
||||
// returns true for "special" windows and false for windows which are "normal"
|
||||
// (normal=window which has a border, can be moved by the user, can be closed, etc.)
|
||||
// true for Desktop, Dock, Splash, Override and TopMenu (and Toolbar??? - for now)
|
||||
// false for Normal, Dialog, Utility and Menu (and Toolbar??? - not yet) TODO
|
||||
bool isSpecialWindow() const;
|
||||
|
||||
bool isResizable() const;
|
||||
bool isMovable() const;
|
||||
bool isCloseable() const; // may be closed by the user (may have a close button)
|
||||
|
||||
void takeActivity( int flags, bool handled, allowed_t ); // takes ActivityFlags as arg (in utils.h)
|
||||
|
@ -195,9 +178,10 @@ class Client : public QObject, public KDecorationDefines
|
|||
void updateDecoration( bool check_workspace_pos, bool force = false );
|
||||
void checkBorderSizes();
|
||||
|
||||
// shape extensions
|
||||
bool shape() const;
|
||||
void updateShape();
|
||||
|
||||
virtual double opacity() const;
|
||||
void setOpacity( double opacity );
|
||||
|
||||
void setGeometry( int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet );
|
||||
void setGeometry( const QRect& r, ForceGeometry_t force = NormalGeometrySet );
|
||||
|
@ -287,6 +271,15 @@ class Client : public QObject, public KDecorationDefines
|
|||
void checkActiveModal();
|
||||
bool hasStrut() const;
|
||||
|
||||
bool isMove() const
|
||||
{
|
||||
return moveResizeMode && mode == PositionCenter;
|
||||
}
|
||||
bool isResize() const
|
||||
{
|
||||
return moveResizeMode && mode != PositionCenter;
|
||||
}
|
||||
|
||||
private slots:
|
||||
void autoRaise();
|
||||
void shadeHover();
|
||||
|
@ -320,6 +313,7 @@ class Client : public QObject, public KDecorationDefines
|
|||
void clientMessageEvent( XClientMessageEvent* e );
|
||||
void enterNotifyEvent( XCrossingEvent* e );
|
||||
void leaveNotifyEvent( XCrossingEvent* e );
|
||||
void visibilityNotifyEvent( XVisibilityEvent* e );
|
||||
void focusInEvent( XFocusInEvent* e );
|
||||
void focusOutEvent( XFocusOutEvent* e );
|
||||
|
||||
|
@ -329,6 +323,9 @@ class Client : public QObject, public KDecorationDefines
|
|||
|
||||
void processDecorationButtonPress( int button, int state, int x, int y, int x_root, int y_root );
|
||||
|
||||
protected:
|
||||
virtual void debug( kdbgstream& stream ) const;
|
||||
|
||||
private slots:
|
||||
void pingTimeout();
|
||||
void processKillerExited();
|
||||
|
@ -367,7 +364,7 @@ class Client : public QObject, public KDecorationDefines
|
|||
void configureRequest( int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool );
|
||||
NETExtendedStrut strut() const;
|
||||
int checkShadeGeometry( int w, int h );
|
||||
void postponeGeometryUpdates( bool postpone );
|
||||
void blockGeometryUpdates( bool block );
|
||||
|
||||
bool startMoveResize();
|
||||
void finishMoveResize( bool cancel );
|
||||
|
@ -399,12 +396,10 @@ class Client : public QObject, public KDecorationDefines
|
|||
Time readUserCreationTime() const;
|
||||
static bool sameAppWindowRoleMatch( const Client* c1, const Client* c2, bool active_hack );
|
||||
void startupIdChanged();
|
||||
|
||||
|
||||
Window client;
|
||||
Window wrapper;
|
||||
Window frame;
|
||||
KDecoration* decoration;
|
||||
Workspace* wspace;
|
||||
Bridge* bridge;
|
||||
int desk;
|
||||
bool buttonDown;
|
||||
|
@ -412,14 +407,6 @@ class Client : public QObject, public KDecorationDefines
|
|||
bool move_faked_activity;
|
||||
Window move_resize_grab_window;
|
||||
bool unrestrictedMoveResize;
|
||||
bool isMove() const
|
||||
{
|
||||
return moveResizeMode && mode == PositionCenter;
|
||||
}
|
||||
bool isResize() const
|
||||
{
|
||||
return moveResizeMode && mode != PositionCenter;
|
||||
}
|
||||
|
||||
Position mode;
|
||||
QPoint moveOffset;
|
||||
|
@ -445,7 +432,6 @@ class Client : public QObject, public KDecorationDefines
|
|||
uint active :1;
|
||||
uint deleting : 1; // true when doing cleanup and destroying the client
|
||||
uint keep_above : 1; // NET::KeepAbove (was stays_on_top)
|
||||
uint is_shape :1;
|
||||
uint skip_taskbar :1;
|
||||
uint original_skip_taskbar :1; // unaffected by KWin
|
||||
uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol?
|
||||
|
@ -465,6 +451,7 @@ class Client : public QObject, public KDecorationDefines
|
|||
uint modal : 1; // NET::Modal
|
||||
uint noborder : 1;
|
||||
uint user_noborder : 1;
|
||||
uint not_obscured : 1;
|
||||
uint urgency : 1; // XWMHints, UrgencyHint
|
||||
uint ignore_focus_stealing : 1; // don't apply focus stealing prevention to this client
|
||||
uint demands_attention : 1;
|
||||
|
@ -502,9 +489,8 @@ class Client : public QObject, public KDecorationDefines
|
|||
Time ping_timestamp;
|
||||
Time user_time;
|
||||
unsigned long allowed_actions;
|
||||
QRect frame_geometry;
|
||||
QSize client_size;
|
||||
int postpone_geometry_updates; // >0 - new geometry is remembered, but not actually set
|
||||
int block_geometry_updates; // >0 - new geometry is remembered, but not actually set
|
||||
bool pending_geometry_update;
|
||||
bool shade_geometry_change;
|
||||
int border_left, border_right, border_top, border_bottom;
|
||||
|
@ -515,20 +501,20 @@ class Client : public QObject, public KDecorationDefines
|
|||
friend struct FetchNameInternalPredicate;
|
||||
friend struct CheckIgnoreFocusStealingProcedure;
|
||||
friend struct ResetupRulesProcedure;
|
||||
friend class GeometryUpdatesPostponer;
|
||||
friend class GeometryUpdatesBlocker;
|
||||
void show() { assert( false ); } // SELI remove after Client is no longer QWidget
|
||||
void hide() { assert( false ); }
|
||||
QTimer* demandAttentionKNotifyTimer;
|
||||
};
|
||||
|
||||
// helper for Client::postponeGeometryUpdates() being called in pairs (true/false)
|
||||
class GeometryUpdatesPostponer
|
||||
// helper for Client::blockGeometryUpdates() being called in pairs (true/false)
|
||||
class GeometryUpdatesBlocker
|
||||
{
|
||||
public:
|
||||
GeometryUpdatesPostponer( Client* c )
|
||||
: cl( c ) { cl->postponeGeometryUpdates( true ); }
|
||||
~GeometryUpdatesPostponer()
|
||||
{ cl->postponeGeometryUpdates( false ); }
|
||||
GeometryUpdatesBlocker( Client* c )
|
||||
: cl( c ) { cl->blockGeometryUpdates( true ); }
|
||||
~GeometryUpdatesBlocker()
|
||||
{ cl->blockGeometryUpdates( false ); }
|
||||
private:
|
||||
Client* cl;
|
||||
};
|
||||
|
@ -555,7 +541,7 @@ inline Window Client::window() const
|
|||
|
||||
inline Window Client::frameId() const
|
||||
{
|
||||
return frame;
|
||||
return handle();
|
||||
}
|
||||
|
||||
inline Window Client::wrapperId() const
|
||||
|
@ -568,11 +554,6 @@ inline Window Client::decorationId() const
|
|||
return decoration != NULL ? decoration->widget()->winId() : None;
|
||||
}
|
||||
|
||||
inline Workspace* Client::workspace() const
|
||||
{
|
||||
return wspace;
|
||||
}
|
||||
|
||||
inline const Client* Client::transientFor() const
|
||||
{
|
||||
return transient_for;
|
||||
|
@ -728,12 +709,6 @@ inline bool Client::keepBelow() const
|
|||
return keep_below;
|
||||
}
|
||||
|
||||
inline bool Client::shape() const
|
||||
{
|
||||
return is_shape;
|
||||
}
|
||||
|
||||
|
||||
inline bool Client::isFullScreen() const
|
||||
{
|
||||
return fullscreen_mode != FullScreenNone;
|
||||
|
@ -789,46 +764,6 @@ inline QByteArray Client::windowRole() const
|
|||
return window_role;
|
||||
}
|
||||
|
||||
inline QRect Client::geometry() const
|
||||
{
|
||||
return frame_geometry;
|
||||
}
|
||||
|
||||
inline QSize Client::size() const
|
||||
{
|
||||
return frame_geometry.size();
|
||||
}
|
||||
|
||||
inline QPoint Client::pos() const
|
||||
{
|
||||
return frame_geometry.topLeft();
|
||||
}
|
||||
|
||||
inline int Client::x() const
|
||||
{
|
||||
return frame_geometry.x();
|
||||
}
|
||||
|
||||
inline int Client::y() const
|
||||
{
|
||||
return frame_geometry.y();
|
||||
}
|
||||
|
||||
inline int Client::width() const
|
||||
{
|
||||
return frame_geometry.width();
|
||||
}
|
||||
|
||||
inline int Client::height() const
|
||||
{
|
||||
return frame_geometry.height();
|
||||
}
|
||||
|
||||
inline QRect Client::rect() const
|
||||
{
|
||||
return QRect( 0, 0, width(), height());
|
||||
}
|
||||
|
||||
inline QPoint Client::clientPos() const
|
||||
{
|
||||
return QPoint( border_left, border_top );
|
||||
|
@ -874,7 +809,7 @@ inline const WindowRules* Client::rules() const
|
|||
return &client_rules;
|
||||
}
|
||||
|
||||
KWIN_PROCEDURE( CheckIgnoreFocusStealingProcedure, cl->ignore_focus_stealing = options->checkIgnoreFocusStealing( cl ));
|
||||
KWIN_PROCEDURE( CheckIgnoreFocusStealingProcedure, Client, cl->ignore_focus_stealing = options->checkIgnoreFocusStealing( cl ));
|
||||
|
||||
inline Window Client::moveResizeGrabWindow() const
|
||||
{
|
||||
|
@ -891,22 +826,9 @@ inline void Client::removeRule( Rules* rule )
|
|||
client_rules.remove( rule );
|
||||
}
|
||||
|
||||
#ifdef NDEBUG
|
||||
inline
|
||||
kndbgstream& operator<<( kndbgstream& stream, const Client* ) { return stream; }
|
||||
inline
|
||||
kndbgstream& operator<<( kndbgstream& stream, const ClientList& ) { return stream; }
|
||||
inline
|
||||
kndbgstream& operator<<( kndbgstream& stream, const ConstClientList& ) { return stream; }
|
||||
#else
|
||||
kdbgstream& operator<<( kdbgstream& stream, const Client* );
|
||||
kdbgstream& operator<<( kdbgstream& stream, const ClientList& );
|
||||
kdbgstream& operator<<( kdbgstream& stream, const ConstClientList& );
|
||||
#endif
|
||||
|
||||
KWIN_COMPARE_PREDICATE( WindowMatchPredicate, Window, cl->window() == value );
|
||||
KWIN_COMPARE_PREDICATE( FrameIdMatchPredicate, Window, cl->frameId() == value );
|
||||
KWIN_COMPARE_PREDICATE( WrapperIdMatchPredicate, Window, cl->wrapperId() == value );
|
||||
KWIN_COMPARE_PREDICATE( WindowMatchPredicate, Client, Window, cl->window() == value );
|
||||
KWIN_COMPARE_PREDICATE( FrameIdMatchPredicate, Client, Window, cl->frameId() == value );
|
||||
KWIN_COMPARE_PREDICATE( WrapperIdMatchPredicate, Client, Window, cl->wrapperId() == value );
|
||||
|
||||
} // namespace
|
||||
|
||||
|
|
24
geometry.cpp
24
geometry.cpp
|
@ -1405,7 +1405,7 @@ void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, i
|
|||
|| ns != size())
|
||||
{
|
||||
QRect orig_geometry = geometry();
|
||||
GeometryUpdatesPostponer blocker( this );
|
||||
GeometryUpdatesBlocker blocker( this );
|
||||
move( new_pos );
|
||||
plainResize( ns );
|
||||
setGeometry( QRect( calculateGravitation( false, gravity ), size()));
|
||||
|
@ -1438,7 +1438,7 @@ void Client::configureRequest( int value_mask, int rx, int ry, int rw, int rh, i
|
|||
if( ns != size()) // don't restore if some app sets its own size again
|
||||
{
|
||||
QRect orig_geometry = geometry();
|
||||
GeometryUpdatesPostponer blocker( this );
|
||||
GeometryUpdatesBlocker blocker( this );
|
||||
int save_gravity = xSizeHint.win_gravity;
|
||||
xSizeHint.win_gravity = gravity;
|
||||
resizeWithChecks( ns );
|
||||
|
@ -1664,7 +1664,7 @@ void Client::setGeometry( int x, int y, int w, int h, ForceGeometry_t force )
|
|||
workspace()->addDamage( geometry()); // TODO cache the previous real geometry
|
||||
geom = QRect( x, y, w, h );
|
||||
updateWorkareaDiffs();
|
||||
if( postpone_geometry_updates != 0 )
|
||||
if( block_geometry_updates != 0 )
|
||||
{
|
||||
pending_geometry_update = true;
|
||||
return;
|
||||
|
@ -1721,7 +1721,7 @@ void Client::plainResize( int w, int h, ForceGeometry_t force )
|
|||
workspace()->addDamage( geometry()); // TODO cache the previous real geometry
|
||||
geom.setSize( QSize( w, h ));
|
||||
updateWorkareaDiffs();
|
||||
if( postpone_geometry_updates != 0 )
|
||||
if( block_geometry_updates != 0 )
|
||||
{
|
||||
pending_geometry_update = true;
|
||||
return;
|
||||
|
@ -1756,7 +1756,7 @@ void Client::move( int x, int y, ForceGeometry_t force )
|
|||
workspace()->addDamage( geometry()); // TODO cache the previous real geometry
|
||||
geom.moveTopLeft( QPoint( x, y ));
|
||||
updateWorkareaDiffs();
|
||||
if( postpone_geometry_updates != 0 )
|
||||
if( block_geometry_updates != 0 )
|
||||
{
|
||||
pending_geometry_update = true;
|
||||
return;
|
||||
|
@ -1769,17 +1769,17 @@ void Client::move( int x, int y, ForceGeometry_t force )
|
|||
workspace()->addDamage( geometry());
|
||||
}
|
||||
|
||||
void Client::postponeGeometryUpdates( bool postpone )
|
||||
void Client::blockGeometryUpdates( bool block )
|
||||
{
|
||||
if( postpone )
|
||||
if( block )
|
||||
{
|
||||
if( postpone_geometry_updates == 0 )
|
||||
if( block_geometry_updates == 0 )
|
||||
pending_geometry_update = false;
|
||||
++postpone_geometry_updates;
|
||||
++block_geometry_updates;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( --postpone_geometry_updates == 0 )
|
||||
if( --block_geometry_updates == 0 )
|
||||
{
|
||||
if( pending_geometry_update )
|
||||
{
|
||||
|
@ -1828,7 +1828,7 @@ void Client::changeMaximize( bool vertical, bool horizontal, bool adjust )
|
|||
if( !adjust && max_mode == old_mode )
|
||||
return;
|
||||
|
||||
GeometryUpdatesPostponer blocker( this );
|
||||
GeometryUpdatesBlocker blocker( this );
|
||||
|
||||
// maximing one way and unmaximizing the other way shouldn't happen
|
||||
Q_ASSERT( !( vertical && horizontal )
|
||||
|
@ -2080,7 +2080,7 @@ void Client::setFullScreen( bool set, bool user )
|
|||
if( was_fs == isFullScreen())
|
||||
return;
|
||||
StackingUpdatesBlocker blocker1( workspace());
|
||||
GeometryUpdatesPostponer blocker2( this );
|
||||
GeometryUpdatesBlocker blocker2( this );
|
||||
workspace()->updateClientLayer( this ); // active fullscreens get different layer
|
||||
info->setState( isFullScreen() ? NET::FullScreen : 0, NET::FullScreen );
|
||||
updateDecoration( false, false );
|
||||
|
|
37
manage.cpp
37
manage.cpp
|
@ -38,17 +38,25 @@ bool Client::manage( Window w, bool isMapped )
|
|||
{
|
||||
StackingUpdatesBlocker stacking_blocker( workspace());
|
||||
|
||||
XWindowAttributes attr;
|
||||
if( !XGetWindowAttributes(display(), w, &attr))
|
||||
return false;
|
||||
|
||||
grabXServer();
|
||||
|
||||
XWindowAttributes attr;
|
||||
if( !XGetWindowAttributes(display(), w, &attr))
|
||||
{
|
||||
ungrabXServer();
|
||||
return false;
|
||||
}
|
||||
|
||||
// from this place on, manage() mustn't return false
|
||||
postpone_geometry_updates = 1;
|
||||
block_geometry_updates = 1;
|
||||
pending_geometry_update = true; // force update when finishing with geometry changes
|
||||
|
||||
embedClient( w, attr );
|
||||
|
||||
vis = attr.visual;
|
||||
bit_depth = attr.depth;
|
||||
|
||||
setupCompositing();
|
||||
|
||||
// SELI order all these things in some sane manner
|
||||
|
||||
|
@ -77,6 +85,7 @@ bool Client::manage( Window w, bool isMapped )
|
|||
NET::WM2UserTime |
|
||||
NET::WM2StartupId |
|
||||
NET::WM2ExtendedStrut |
|
||||
NET::WM2Opacity |
|
||||
0;
|
||||
|
||||
info = new WinInfo( this, display(), client, rootWindow(), properties, 2 );
|
||||
|
@ -105,6 +114,9 @@ bool Client::manage( Window w, bool isMapped )
|
|||
setupWindowRules( false );
|
||||
setCaption( cap_normal, true );
|
||||
|
||||
if( Extensions::shapeAvailable())
|
||||
XShapeSelectInput( display(), window(), ShapeNotifyMask );
|
||||
detectShape( window());
|
||||
detectNoBorder();
|
||||
fetchIconicName();
|
||||
getWMHints(); // needs to be done before readTransient() because of reading the group
|
||||
|
@ -313,9 +325,8 @@ bool Client::manage( Window w, bool isMapped )
|
|||
if(( !isSpecialWindow() || isToolbar()) && isMovable())
|
||||
keepInArea( area, partial_keep_in_area );
|
||||
|
||||
XShapeSelectInput( display(), window(), ShapeNotifyMask );
|
||||
is_shape = Shape::hasShape( window());
|
||||
updateShape();
|
||||
if( shape())
|
||||
updateShape();
|
||||
|
||||
//CT extra check for stupid jdk 1.3.1. But should make sense in general
|
||||
// if client has initial state set to Iconic and is transient with a parent
|
||||
|
@ -510,7 +521,7 @@ bool Client::manage( Window w, bool isMapped )
|
|||
// sendSyntheticConfigureNotify(); done when setting mapping state
|
||||
|
||||
delete session;
|
||||
|
||||
|
||||
ungrabXServer();
|
||||
|
||||
client_rules.discardTemporary();
|
||||
|
@ -528,7 +539,7 @@ bool Client::manage( Window w, bool isMapped )
|
|||
void Client::embedClient( Window w, const XWindowAttributes &attr )
|
||||
{
|
||||
assert( client == None );
|
||||
assert( frame == None );
|
||||
assert( frameId() == None );
|
||||
assert( wrapper == None );
|
||||
client = w;
|
||||
// we don't want the window to be destroyed when we are destroyed
|
||||
|
@ -544,9 +555,10 @@ void Client::embedClient( Window w, const XWindowAttributes &attr )
|
|||
swa.background_pixmap = None;
|
||||
swa.border_pixel = 0;
|
||||
|
||||
frame = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
|
||||
Window frame = XCreateWindow( display(), rootWindow(), 0, 0, 1, 1, 0,
|
||||
attr.depth, InputOutput, attr.visual,
|
||||
CWColormap | CWBackPixmap | CWBorderPixel, &swa );
|
||||
setHandle( frame );
|
||||
wrapper = XCreateWindow( display(), frame, 0, 0, 1, 1, 0,
|
||||
attr.depth, InputOutput, attr.visual,
|
||||
CWColormap | CWBackPixmap | CWBorderPixel, &swa );
|
||||
|
@ -565,7 +577,8 @@ void Client::embedClient( Window w, const XWindowAttributes &attr )
|
|||
FocusChangeMask |
|
||||
ExposureMask |
|
||||
PropertyChangeMask |
|
||||
StructureNotifyMask | SubstructureRedirectMask );
|
||||
StructureNotifyMask | SubstructureRedirectMask |
|
||||
VisibilityChangeMask );
|
||||
XSelectInput( display(), wrapper, ClientWinMask | SubstructureNotifyMask );
|
||||
XSelectInput( display(), client,
|
||||
FocusChangeMask |
|
||||
|
|
Loading…
Reference in a new issue