SVN_SILENT Standardize coding style on client.* and workspace.*

svn path=/trunk/KDE/kdebase/workspace/; revision=898612
This commit is contained in:
Lucas Murray 2008-12-18 13:50:57 +00:00
parent 5f3b538cde
commit 038667db7a
4 changed files with 1567 additions and 1549 deletions

File diff suppressed because it is too large Load diff

206
client.h
View file

@ -46,6 +46,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <X11/extensions/sync.h> #include <X11/extensions/sync.h>
#endif #endif
// TODO: Cleanup the order of things in this .h file
class QProcess; class QProcess;
class QTimer; class QTimer;
class KStartupInfoData; class KStartupInfoData;
@ -62,7 +64,7 @@ class Client
{ {
Q_OBJECT Q_OBJECT
public: public:
Client( Workspace *ws ); Client( Workspace* ws );
Window wrapperId() const; Window wrapperId() const;
Window decorationId() const; Window decorationId() const;
@ -71,10 +73,10 @@ class Client
bool isTransient() const; bool isTransient() const;
bool groupTransient() const; bool groupTransient() const;
bool wasOriginallyGroupTransient() const; bool wasOriginallyGroupTransient() const;
ClientList mainClients() const; // call once before loop , is not indirect ClientList mainClients() const; // Call once before loop , is not indirect
ClientList allMainClients() const; // call once before loop , is indirect ClientList allMainClients() const; // Call once before loop , is indirect
bool hasTransient( const Client* c, bool indirect ) const; bool hasTransient( const Client* c, bool indirect ) const;
const ClientList& transients() const; // is not indirect const ClientList& transients() const; // Is not indirect
void checkTransient( Window w ); void checkTransient( Window w );
Client* findModal( bool allow_itself = false ); Client* findModal( bool allow_itself = false );
const Group* group() const; const Group* group() const;
@ -88,16 +90,18 @@ class Client
void updateWindowRules(); void updateWindowRules();
void updateFullscreenMonitors( NETFullscreenMonitors topology ); void updateFullscreenMonitors( NETFullscreenMonitors topology );
// 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.) * Returns true for "special" windows and false for windows which are "normal"
// true for Desktop, Dock, Splash, Override and TopMenu (and Toolbar??? - for now) * (normal=window which has a border, can be moved by the user, can be closed, etc.)
// false for Normal, Dialog, Utility and Menu (and Toolbar??? - not yet) TODO * 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 isSpecialWindow() const;
bool hasNETSupport() const; bool hasNETSupport() const;
QSize minSize() const; QSize minSize() const;
QSize maxSize() const; QSize maxSize() const;
virtual QPoint clientPos() const; // inside of geometry() virtual QPoint clientPos() const; // Inside of geometry()
virtual QSize clientSize() const; virtual QSize clientSize() const;
bool windowEvent( XEvent* e ); bool windowEvent( XEvent* e );
@ -110,12 +114,13 @@ class Client
void releaseWindow( bool on_shutdown = false ); void releaseWindow( bool on_shutdown = false );
void destroyClient(); void destroyClient();
enum Sizemode // how to resize the window in order to obey constains (mainly aspect ratios) /// How to resize the window in order to obey constains (mainly aspect ratios)
enum Sizemode
{ {
SizemodeAny, SizemodeAny,
SizemodeFixedW, // try not to affect width SizemodeFixedW, ///< Try not to affect width
SizemodeFixedH, // try not to affect height SizemodeFixedH, ///< Try not to affect height
SizemodeMax // try not to make it larger in either direction SizemodeMax ///< Try not to make it larger in either direction
}; };
QSize adjustedSize( const QSize&, Sizemode mode = SizemodeAny ) const; QSize adjustedSize( const QSize&, Sizemode mode = SizemodeAny ) const;
QSize adjustedSize() const; QSize adjustedSize() const;
@ -129,13 +134,13 @@ class Client
virtual int desktop() const; virtual int desktop() const;
void setDesktop( int ); void setDesktop( int );
void setOnAllDesktops( bool set ); void setOnAllDesktops( bool set );
// !isMinimized() && not hidden, i.e. normally visible on some virtual desktop
bool isShown( bool shaded_is_shown ) const;
bool isHiddenInternal() const; // for compositing
bool isShade() const; // true only for ShadeNormal /// Is not minimized and not hidden. I.e. normally visible on some virtual desktop.
ShadeMode shadeMode() const; // prefer isShade() bool isShown( bool shaded_is_shown ) const;
bool isHiddenInternal() const; // For compositing
bool isShade() const; // True only for ShadeNormal
ShadeMode shadeMode() const; // Prefer isShade()
void setShade( ShadeMode mode ); void setShade( ShadeMode mode );
bool isShadeable() const; bool isShadeable() const;
@ -153,7 +158,7 @@ class Client
bool isFullScreenable( bool fullscreen_hack = false ) const; bool isFullScreenable( bool fullscreen_hack = false ) const;
bool isActiveFullScreen() const; bool isActiveFullScreen() const;
bool userCanSetFullScreen() const; bool userCanSetFullScreen() const;
QRect geometryFSRestore() const { return geom_fs_restore; } // only for session saving QRect geometryFSRestore() const { return geom_fs_restore; } // Only for session saving
int fullScreenMode() const { return fullscreen_mode; } // only for session saving int fullScreenMode() const { return fullscreen_mode; } // only for session saving
bool noBorder() const; bool noBorder() const;
@ -178,16 +183,16 @@ class Client
void setModal( bool modal ); void setModal( bool modal );
bool isModal() const; bool isModal() const;
// auxiliary functions, depend on the windowType // Auxiliary functions, depend on the windowType
bool wantsTabFocus() const; bool wantsTabFocus() const;
bool wantsInput() const; bool wantsInput() const;
bool isResizable() const; bool isResizable() const;
bool isMovable() const; bool isMovable() const;
bool isMovableAcrossScreens() const; bool isMovableAcrossScreens() const;
bool isCloseable() const; // may be closed by the user (may have a close button) 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) void takeActivity( int flags, bool handled, allowed_t ); // Takes ActivityFlags as arg (in utils.h)
void takeFocus( allowed_t ); void takeFocus( allowed_t );
void demandAttention( bool set = true ); void demandAttention( bool set = true );
@ -199,15 +204,15 @@ class Client
void repaintDecoration(); void repaintDecoration();
void updateShape(); void updateShape();
void setGeometry( int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet ); void setGeometry( int x, int y, int w, int h, ForceGeometry_t force = NormalGeometrySet );
void setGeometry( const QRect& r, ForceGeometry_t force = NormalGeometrySet ); void setGeometry( const QRect& r, ForceGeometry_t force = NormalGeometrySet );
void move( int x, int y, ForceGeometry_t force = NormalGeometrySet ); void move( int x, int y, ForceGeometry_t force = NormalGeometrySet );
void move( const QPoint & p, ForceGeometry_t force = NormalGeometrySet ); void move( const QPoint& p, ForceGeometry_t force = NormalGeometrySet );
// plainResize() simply resizes /// plainResize() simply resizes
void plainResize( int w, int h, ForceGeometry_t force = NormalGeometrySet ); void plainResize( int w, int h, ForceGeometry_t force = NormalGeometrySet );
void plainResize( const QSize& s, ForceGeometry_t force = NormalGeometrySet ); void plainResize( const QSize& s, ForceGeometry_t force = NormalGeometrySet );
// resizeWithChecks() resizes according to gravity, and checks workarea position /// resizeWithChecks() resizes according to gravity, and checks workarea position
void resizeWithChecks( int w, int h, ForceGeometry_t force = NormalGeometrySet ); void resizeWithChecks( int w, int h, ForceGeometry_t force = NormalGeometrySet );
void resizeWithChecks( const QSize& s, ForceGeometry_t force = NormalGeometrySet ); void resizeWithChecks( const QSize& s, ForceGeometry_t force = NormalGeometrySet );
void keepInArea( QRect area, bool partial = false ); void keepInArea( QRect area, bool partial = false );
@ -221,17 +226,17 @@ class Client
KShortcut shortcut() const; KShortcut shortcut() const;
void setShortcut( const QString& cut ); void setShortcut( const QString& cut );
bool performMouseCommand( Options::MouseCommand, const QPoint &globalPos, bool handled = false ); bool performMouseCommand( Options::MouseCommand, const QPoint& globalPos, bool handled = false );
QRect adjustedClientArea( const QRect& desktop, const QRect& area ) const; QRect adjustedClientArea( const QRect& desktop, const QRect& area ) const;
Colormap colormap() const; Colormap colormap() const;
// updates visibility depending on being shaded, virtual desktop, etc. /// Updates visibility depending on being shaded, virtual desktop, etc.
void updateVisibility(); void updateVisibility();
// hides a client - basically like minimize, but without effects, it's simply hidden /// Hides a client - Basically like minimize, but without effects, it's simply hidden
void hideClient( bool hide ); void hideClient( bool hide );
bool hiddenPreview() const; // window is mapped in order to get a window pixmap bool hiddenPreview() const; ///< Window is mapped in order to get a window pixmap
virtual void setupCompositing(); virtual void setupCompositing();
virtual void finishCompositing(); virtual void finishCompositing();
@ -247,8 +252,9 @@ class Client
void NETMoveResize( int x_root, int y_root, NET::Direction direction ); void NETMoveResize( int x_root, int y_root, NET::Direction direction );
void NETMoveResizeWindow( int flags, int x, int y, int width, int height ); void NETMoveResizeWindow( int flags, int x, int y, int width, int height );
void restackWindow( Window above, int detail, NET::RequestSource source, Time timestamp, bool send_event = false ); void restackWindow( Window above, int detail, NET::RequestSource source, Time timestamp,
bool send_event = false );
void gotPing( Time timestamp ); void gotPing( Time timestamp );
void checkWorkspacePosition(); void checkWorkspacePosition();
@ -257,7 +263,7 @@ class Client
bool hasUserTimeSupport() const; bool hasUserTimeSupport() const;
bool ignoreFocusStealing() const; bool ignoreFocusStealing() const;
// does 'delete c;' /// Does 'delete c;'
static void deleteClient( Client* c, allowed_t ); static void deleteClient( Client* c, allowed_t );
static bool belongToSameApplication( const Client* c1, const Client* c2, bool active_hack = false ); static bool belongToSameApplication( const Client* c1, const Client* c2, bool active_hack = false );
@ -284,7 +290,7 @@ class Client
{ {
return moveResizeMode && mode != PositionCenter; return moveResizeMode && mode != PositionCenter;
} }
// Decorations <-> Effects // Decorations <-> Effects
QList<QRect> shadowQuads( ShadowType type ) const; QList<QRect> shadowQuads( ShadowType type ) const;
double shadowOpacity( ShadowType type ) const; double shadowOpacity( ShadowType type ) const;
@ -302,22 +308,22 @@ class Client
friend class Bridge; // FRAME friend class Bridge; // FRAME
virtual void processMousePressEvent( QMouseEvent* e ); virtual void processMousePressEvent( QMouseEvent* e );
private: // TODO cleanup the order of things in the .h file private:
// use Workspace::createClient() // Use Workspace::createClient()
virtual ~Client(); // use destroyClient() or releaseWindow() virtual ~Client(); ///< Use destroyClient() or releaseWindow()
Position mousePosition( const QPoint& ) const; Position mousePosition( const QPoint& ) const;
void updateCursor(); void updateCursor();
// transparent stuff // Transparent stuff
void drawbound( const QRect& geom ); void drawbound( const QRect& geom );
void clearbound(); void clearbound();
void doDrawbound( const QRect& geom, bool clear ); void doDrawbound( const QRect& geom, bool clear );
// handlers for X11 events // Handlers for X11 events
bool mapRequestEvent( XMapRequestEvent* e ); bool mapRequestEvent( XMapRequestEvent* e );
void unmapNotifyEvent( XUnmapEvent*e ); void unmapNotifyEvent( XUnmapEvent* e );
void destroyNotifyEvent( XDestroyWindowEvent*e ); void destroyNotifyEvent( XDestroyWindowEvent* e );
void configureRequestEvent( XConfigureRequestEvent* e ); void configureRequestEvent( XConfigureRequestEvent* e );
virtual void propertyNotifyEvent( XPropertyEvent* e ); virtual void propertyNotifyEvent( XPropertyEvent* e );
void clientMessageEvent( XClientMessageEvent* e ); void clientMessageEvent( XClientMessageEvent* e );
@ -347,14 +353,14 @@ class Client
void delayedSetShortcut(); void delayedSetShortcut();
private: private:
void exportMappingState( int s ); // ICCCM 4.1.3.1, 4.1.4 , NETWM 2.5.1 void exportMappingState( int s ); // ICCCM 4.1.3.1, 4.1.4, NETWM 2.5.1
bool isManaged() const; // returns false if this client is not yet managed bool isManaged() const; ///< Returns false if this client is not yet managed
void updateAllowedActions( bool force = false ); void updateAllowedActions( bool force = false );
QSize sizeForClientSize( const QSize&, Sizemode mode = SizemodeAny, bool noframe = false ) const; QSize sizeForClientSize( const QSize&, Sizemode mode = SizemodeAny, bool noframe = false ) const;
QRect fullscreenMonitorsArea( NETFullscreenMonitors topology ) const; QRect fullscreenMonitorsArea( NETFullscreenMonitors topology ) const;
void changeMaximize( bool horizontal, bool vertical, bool adjust ); void changeMaximize( bool horizontal, bool vertical, bool adjust );
void checkMaximizeGeometry(); void checkMaximizeGeometry();
int checkFullScreenHack( const QRect& geom ) const; // 0 - none, 1 - one xinerama screen, 2 - full area int checkFullScreenHack( const QRect& geom ) const; // 0 - None, 1 - One xinerama screen, 2 - Full area
void updateFullScreenHack( const QRect& geom ); void updateFullScreenHack( const QRect& geom );
void getWmNormalHints(); void getWmNormalHints();
void getMotifHints(); void getMotifHints();
@ -397,7 +403,7 @@ class Client
static void sendClientMessage( Window w, Atom a, Atom protocol, static void sendClientMessage( Window w, Atom a, Atom protocol,
long data1 = 0, long data2 = 0, long data3 = 0 ); long data1 = 0, long data2 = 0, long data3 = 0 );
void embedClient( Window w, const XWindowAttributes &attr ); void embedClient( Window w, const XWindowAttributes& attr );
void detectNoBorder(); void detectNoBorder();
void destroyDecoration(); void destroyDecoration();
void updateFrameExtents(); void updateFrameExtents();
@ -415,7 +421,7 @@ class Client
bool session ) const; bool session ) const;
Time readUserCreationTime() const; Time readUserCreationTime() const;
void startupIdChanged(); void startupIdChanged();
Window client; Window client;
Window wrapper; Window wrapper;
KDecoration* decoration; KDecoration* decoration;
@ -433,14 +439,14 @@ class Client
QPoint invertedMoveOffset; QPoint invertedMoveOffset;
QRect moveResizeGeom; QRect moveResizeGeom;
QRect initialMoveResizeGeom; QRect initialMoveResizeGeom;
XSizeHints xSizeHint; XSizeHints xSizeHint;
void sendSyntheticConfigureNotify(); void sendSyntheticConfigureNotify();
enum MappingState enum MappingState
{ {
Withdrawn, // not handled, as per ICCCM WithdrawnState Withdrawn, ///< Not handled, as per ICCCM WithdrawnState
Mapped, // the frame is mapped Mapped, ///< The frame is mapped
Unmapped, // the frame is not mapped Unmapped, ///< The frame is not mapped
Kept // the frame should be unmapped, but is kept (for compositing) Kept ///< The frame should be unmapped, but is kept (For compositing)
}; };
MappingState mapping_state; MappingState mapping_state;
void readTransient(); void readTransient();
@ -454,31 +460,31 @@ class Client
Client* transient_for; Client* transient_for;
Window transient_for_id; Window transient_for_id;
Window original_transient_for_id; Window original_transient_for_id;
ClientList transients_list; // SELI make this ordered in stacking order? ClientList transients_list; // SELI TODO: Make this ordered in stacking order?
ShadeMode shade_mode; ShadeMode shade_mode;
uint active :1; uint active : 1;
uint deleting : 1; // true when doing cleanup and destroying the client uint deleting : 1; ///< True when doing cleanup and destroying the client
uint keep_above : 1; // NET::KeepAbove (was stays_on_top) uint keep_above : 1; ///< NET::KeepAbove (was stays_on_top)
uint skip_taskbar :1; uint skip_taskbar : 1;
uint original_skip_taskbar :1; // unaffected by KWin uint original_skip_taskbar : 1; ///< Unaffected by KWin
uint Pdeletewindow :1; // does the window understand the DeleteWindow protocol? uint Pdeletewindow : 1; ///< Does the window understand the DeleteWindow protocol?
uint Ptakefocus :1;// does the window understand the TakeFocus protocol? uint Ptakefocus : 1;///< Does the window understand the TakeFocus protocol?
uint Ptakeactivity : 1; // does it support _NET_WM_TAKE_ACTIVITY uint Ptakeactivity : 1; ///< Does it support _NET_WM_TAKE_ACTIVITY
uint Pcontexthelp : 1; // does the window understand the ContextHelp protocol? uint Pcontexthelp : 1; ///< Does the window understand the ContextHelp protocol?
uint Pping : 1; // does it support _NET_WM_PING? uint Pping : 1; ///< Does it support _NET_WM_PING?
uint input :1; // does the window want input in its wm_hints uint input : 1; ///< Does the window want input in its wm_hints
uint skip_pager : 1; uint skip_pager : 1;
uint motif_may_resize : 1; uint motif_may_resize : 1;
uint motif_may_move :1; uint motif_may_move : 1;
uint motif_may_close : 1; uint motif_may_close : 1;
uint keep_below : 1; // NET::KeepBelow uint keep_below : 1; ///< NET::KeepBelow
uint minimized : 1; uint minimized : 1;
uint hidden : 1; // forcibly hidden by calling hide() uint hidden : 1; ///< Forcibly hidden by calling hide()
uint modal : 1; // NET::Modal uint modal : 1; ///< NET::Modal
uint noborder : 1; uint noborder : 1;
uint app_noborder : 1; // the app requested no border using something (window type, motif hints) uint app_noborder : 1; ///< The app requested no border using something (window type, motif hints)
uint urgency : 1; // XWMHints, UrgencyHint uint urgency : 1; ///< XWMHints, UrgencyHint
uint ignore_focus_stealing : 1; // don't apply focus stealing prevention to this client uint ignore_focus_stealing : 1; ///< Don't apply focus stealing prevention to this client
uint demands_attention : 1; uint demands_attention : 1;
WindowRules client_rules; WindowRules client_rules;
void getWMHints(); void getWMHints();
@ -487,9 +493,13 @@ class Client
QPixmap icon_pix; QPixmap icon_pix;
QPixmap miniicon_pix; QPixmap miniicon_pix;
QCursor cursor; QCursor cursor;
// FullScreenHack - non-NETWM fullscreen (noborder,size of desktop) // DON'T reorder - Saved to config files !!!
// DON'T reorder - saved to config files !!! enum FullScreenMode
enum FullScreenMode { FullScreenNone, FullScreenNormal, FullScreenHack }; {
FullScreenNone,
FullScreenNormal,
FullScreenHack ///< Non-NETWM fullscreen (noborder and size of desktop)
};
FullScreenMode fullscreen_mode; FullScreenMode fullscreen_mode;
MaximizeMode max_mode; MaximizeMode max_mode;
QRect geom_restore; QRect geom_restore;
@ -510,8 +520,13 @@ class Client
Time user_time; Time user_time;
unsigned long allowed_actions; unsigned long allowed_actions;
QSize client_size; QSize client_size;
int block_geometry_updates; // >0 - new geometry is remembered, but not actually set int block_geometry_updates; // > 0 = New geometry is remembered, but not actually set
enum PendingGeometry_t { PendingGeometryNone, PendingGeometryNormal, PendingGeometryForced }; enum PendingGeometry_t
{
PendingGeometryNone,
PendingGeometryNormal,
PendingGeometryForced
};
PendingGeometry_t pending_geometry_update; PendingGeometry_t pending_geometry_update;
QRect geom_before_block; QRect geom_before_block;
bool shade_geometry_change; bool shade_geometry_change;
@ -524,7 +539,7 @@ class Client
bool sync_resize_pending; bool sync_resize_pending;
int border_left, border_right, border_top, border_bottom; int border_left, border_right, border_top, border_bottom;
QRegion _mask; QRegion _mask;
static bool check_active_modal; // see Client::checkActiveModal() static bool check_active_modal; ///< \see Client::checkActiveModal()
KShortcut _shortcut; KShortcut _shortcut;
int sm_stacking_order; int sm_stacking_order;
friend struct FetchNameInternalPredicate; friend struct FetchNameInternalPredicate;
@ -536,7 +551,9 @@ class Client
friend bool performTransiencyCheck(); friend bool performTransiencyCheck();
}; };
// helper for Client::blockGeometryUpdates() being called in pairs (true/false) /**
* Helper for Client::blockGeometryUpdates() being called in pairs (true/false)
*/
class GeometryUpdatesBlocker class GeometryUpdatesBlocker
{ {
public: public:
@ -544,23 +561,27 @@ class GeometryUpdatesBlocker
: cl( c ) { cl->blockGeometryUpdates( true ); } : cl( c ) { cl->blockGeometryUpdates( true ); }
~GeometryUpdatesBlocker() ~GeometryUpdatesBlocker()
{ cl->blockGeometryUpdates( false ); } { cl->blockGeometryUpdates( false ); }
private: private:
Client* cl; Client* cl;
}; };
/**
// NET WM Protocol handler class * NET WM Protocol handler class
*/
class WinInfo : public NETWinInfo2 class WinInfo : public NETWinInfo2
{ {
private: private:
typedef KWin::Client Client; // because of NET::Client typedef KWin::Client Client; // Because of NET::Client
public: public:
WinInfo( Client* c, Display * display, Window window, WinInfo( Client* c, Display * display, Window window,
Window rwin, const unsigned long pr[], int pr_size ); Window rwin, const unsigned long pr[], int pr_size );
virtual void changeDesktop(int desktop); virtual void changeDesktop(int desktop);
virtual void changeFullscreenMonitors(NETFullscreenMonitors topology); virtual void changeFullscreenMonitors(NETFullscreenMonitors topology);
virtual void changeState( unsigned long state, unsigned long mask ); virtual void changeState( unsigned long state, unsigned long mask );
void disable(); void disable();
private: private:
Client * m_client; Client * m_client;
}; };
@ -590,7 +611,7 @@ inline bool Client::groupTransient() const
return transient_for_id == rootWindow(); return transient_for_id == rootWindow();
} }
// needed because verifyTransientFor() may set transient_for_id to root window, // Needed because verifyTransientFor() may set transient_for_id to root window,
// if the original value has a problem (window doesn't exist, etc.) // if the original value has a problem (window doesn't exist, etc.)
inline bool Client::wasOriginallyGroupTransient() const inline bool Client::wasOriginallyGroupTransient() const
{ {
@ -617,8 +638,7 @@ inline Group* Client::group()
return in_group; return in_group;
} }
inline inline bool Client::isMinimized() const
bool Client::isMinimized() const
{ {
return minimized; return minimized;
} }
@ -628,26 +648,22 @@ inline bool Client::isActive() const
return active; return active;
} }
inline inline bool Client::isShown( bool shaded_is_shown ) const
bool Client::isShown( bool shaded_is_shown ) const
{ {
return !isMinimized() && ( !isShade() || shaded_is_shown ) && !hidden; return !isMinimized() && ( !isShade() || shaded_is_shown ) && !hidden;
} }
inline inline bool Client::isHiddenInternal() const
bool Client::isHiddenInternal() const
{ {
return hidden; return hidden;
} }
inline inline bool Client::isShade() const
bool Client::isShade() const
{ {
return shade_mode == ShadeNormal; return shade_mode == ShadeNormal;
} }
inline inline ShadeMode Client::shadeMode() const
ShadeMode Client::shadeMode() const
{ {
return shade_mode; return shade_mode;
} }
@ -747,7 +763,7 @@ inline void Client::setGeometry( const QRect& r, ForceGeometry_t force )
setGeometry( r.x(), r.y(), r.width(), r.height(), force ); setGeometry( r.x(), r.y(), r.width(), r.height(), force );
} }
inline void Client::move( const QPoint & p, ForceGeometry_t force ) inline void Client::move( const QPoint& p, ForceGeometry_t force )
{ {
move( p.x(), p.y(), force ); move( p.x(), p.y(), force );
} }
@ -766,7 +782,7 @@ inline bool Client::hasUserTimeSupport() const
{ {
return info->userTime() != -1U; return info->userTime() != -1U;
} }
inline bool Client::ignoreFocusStealing() const inline bool Client::ignoreFocusStealing() const
{ {
return ignore_focus_stealing; return ignore_focus_stealing;

File diff suppressed because it is too large Load diff

View file

@ -39,6 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <X11/Xlib.h> #include <X11/Xlib.h>
// TODO: Cleanup the order of things in this .h file
class QMenu; class QMenu;
class KConfig; class KConfig;
class KActionCollection; class KActionCollection;
@ -67,21 +69,21 @@ class Workspace : public QObject, public KDecorationDefines
Workspace( bool restore = false ); Workspace( bool restore = false );
virtual ~Workspace(); virtual ~Workspace();
static Workspace * self() { return _self; } static Workspace* self() { return _self; }
bool workspaceEvent( XEvent * ); bool workspaceEvent( XEvent* );
bool workspaceEvent( QEvent * ); bool workspaceEvent( QEvent* );
KDecoration* createDecoration( KDecorationBridge* bridge ); KDecoration* createDecoration( KDecorationBridge* bridge );
bool hasClient( const Client * ); bool hasClient( const Client* );
template< typename T > Client* findClient( T predicate ) const; template<typename T> Client* findClient( T predicate ) const;
template< typename T1, typename T2 > void forEachClient( T1 procedure, T2 predicate ); template<typename T1, typename T2> void forEachClient( T1 procedure, T2 predicate );
template< typename T > void forEachClient( T procedure ); template<typename T> void forEachClient( T procedure );
template< typename T > Unmanaged* findUnmanaged( T predicate ) const; template<typename T> Unmanaged* findUnmanaged( T predicate ) const;
template< typename T1, typename T2 > void forEachUnmanaged( T1 procedure, T2 predicate ); template<typename T1, typename T2> void forEachUnmanaged( T1 procedure, T2 predicate );
template< typename T > void forEachUnmanaged( T procedure ); template<typename T> void forEachUnmanaged( T procedure );
QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const; QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
QRect clientArea( clientAreaOption, const Client* c ) const; QRect clientArea( clientAreaOption, const Client* c ) const;
@ -92,7 +94,8 @@ class Workspace : public QObject, public KDecorationDefines
*/ */
void killWindowId( Window window); void killWindowId( Window window);
void killWindow() { slotKillWindow(); } void killWindow()
{ slotKillWindow(); }
bool initializing() const; bool initializing() const;
@ -101,32 +104,36 @@ class Workspace : public QObject, public KDecorationDefines
* if no client has the focus) * if no client has the focus)
*/ */
Client* activeClient() const; Client* activeClient() const;
// Client that was activated, but it's not yet really activeClient(), because /**
// we didn't process yet the matching FocusIn event. Used mostly in focus * Client that was activated, but it's not yet really activeClient(), because
// stealing prevention code. * we didn't process yet the matching FocusIn event. Used mostly in focus
* stealing prevention code.
*/
Client* mostRecentlyActivatedClient() const; Client* mostRecentlyActivatedClient() const;
void activateClient( Client*, bool force = false ); void activateClient( Client*, bool force = false );
void requestFocus( Client* c, bool force = false ); void requestFocus( Client* c, bool force = false );
void takeActivity( Client* c, int flags, bool handled ); // flags are ActivityFlags void takeActivity( Client* c, int flags, bool handled ); // Flags are ActivityFlags
void handleTakeActivity( Client* c, Time timestamp, int flags ); // flags are ActivityFlags void handleTakeActivity( Client* c, Time timestamp, int flags ); // Flags are ActivityFlags
bool allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false, bool ignore_desktop = false ); bool allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false,
bool ignore_desktop = false );
void restoreFocus(); void restoreFocus();
void gotFocusIn( const Client* ); void gotFocusIn( const Client* );
void setShouldGetFocus( Client* ); void setShouldGetFocus( Client* );
bool fakeRequestedActivity( Client* c ); bool fakeRequestedActivity( Client* c );
void unfakeActivity( Client* c ); void unfakeActivity( Client* c );
bool activateNextClient( Client* c ); bool activateNextClient( Client* c );
bool focusChangeEnabled() { return block_focus == 0; } bool focusChangeEnabled()
{ return block_focus == 0; }
void updateColormap(); void updateColormap();
/** /**
* Indicates that the client c is being moved around by the user. * Indicates that the client c is being moved around by the user.
*/ */
void setClientIsMoving( Client *c ); void setClientIsMoving( Client* c );
void place( Client *c, QRect& area ); void place( Client* c, QRect& area );
void placeSmart( Client* c, const QRect& area ); void placeSmart( Client* c, const QRect& area );
QPoint adjustClientPosition( Client* c, QPoint pos, bool unrestricted ); QPoint adjustClientPosition( Client* c, QPoint pos, bool unrestricted );
@ -137,15 +144,15 @@ class Workspace : public QObject, public KDecorationDefines
void lowerClientRequest( Client* c, NET::RequestSource src, Time timestamp ); void lowerClientRequest( Client* c, NET::RequestSource src, Time timestamp );
void restackClientUnderActive( Client* ); void restackClientUnderActive( Client* );
void updateClientLayer( Client* c ); void updateClientLayer( Client* c );
void raiseOrLowerClient( Client * ); void raiseOrLowerClient( Client* );
void restoreSessionStackingOrder( Client* c ); void restoreSessionStackingOrder( Client* c );
void updateStackingOrder( bool propagate_new_clients = false ); void updateStackingOrder( bool propagate_new_clients = false );
void forceRestacking(); void forceRestacking();
void clientHidden( Client* ); void clientHidden( Client* );
void clientAttentionChanged( Client* c, bool set ); void clientAttentionChanged( Client* c, bool set );
void checkElectricBorder(const QPoint &pos, Time time); void checkElectricBorder(const QPoint& pos, Time time);
void reserveElectricBorder( ElectricBorder border ); void reserveElectricBorder( ElectricBorder border );
void unreserveElectricBorder( ElectricBorder border ); void unreserveElectricBorder( ElectricBorder border );
void reserveElectricBorderSwitching( bool reserve ); void reserveElectricBorderSwitching( bool reserve );
@ -159,7 +166,7 @@ class Workspace : public QObject, public KDecorationDefines
*/ */
int numberOfDesktops() const; int numberOfDesktops() const;
void setNumberOfDesktops( int n ); void setNumberOfDesktops( int n );
void calcDesktopLayout(int* x, int* y, Qt::Orientation* orientation) const; void calcDesktopLayout( int* x, int* y, Qt::Orientation* orientation ) const;
int desktopToRight( int desktop, bool wrap ) const; int desktopToRight( int desktop, bool wrap ) const;
int desktopToLeft( int desktop, bool wrap ) const; int desktopToLeft( int desktop, bool wrap ) const;
int desktopUp( int desktop, bool wrap ) const; int desktopUp( int desktop, bool wrap ) const;
@ -168,21 +175,21 @@ class Workspace : public QObject, public KDecorationDefines
int activeScreen() const; int activeScreen() const;
int numScreens() const; int numScreens() const;
void checkActiveScreen( const Client* c ); void checkActiveScreen( const Client* c );
void setActiveScreenMouse( const QPoint &mousepos ); void setActiveScreenMouse( const QPoint& mousepos );
QRect screenGeometry( int screen ) const; QRect screenGeometry( int screen ) const;
int screenNumber( const QPoint &pos ) const; int screenNumber( const QPoint& pos ) const;
// for TabBox // Tab box
Client* currentTabBoxClient() const; Client* currentTabBoxClient() const;
ClientList currentTabBoxClientList() const; ClientList currentTabBoxClientList() const;
int currentTabBoxDesktop() const; int currentTabBoxDesktop() const;
QList< int > currentTabBoxDesktopList() const; QList<int> currentTabBoxDesktopList() const;
void setTabBoxClient(Client*); void setTabBoxClient( Client* );
void setTabBoxDesktop(int); void setTabBoxDesktop( int );
Client* nextClientFocusChain(Client*) const; Client* nextClientFocusChain( Client* ) const;
Client* previousClientFocusChain(Client*) const; Client* previousClientFocusChain( Client* ) const;
Client* nextClientStatic(Client*) const; Client* nextClientStatic( Client* ) const;
Client* previousClientStatic(Client*) const; Client* previousClientStatic( Client* ) const;
int nextDesktopFocusChain( int iDesktop ) const; int nextDesktopFocusChain( int iDesktop ) const;
int previousDesktopFocusChain( int iDesktop ) const; int previousDesktopFocusChain( int iDesktop ) const;
int nextDesktopStatic( int iDesktop ) const; int nextDesktopStatic( int iDesktop ) const;
@ -191,7 +198,7 @@ class Workspace : public QObject, public KDecorationDefines
void unrefTabBox(); void unrefTabBox();
void closeTabBox(); void closeTabBox();
/** /**
* Returns the list of clients sorted in stacking order, with topmost client * Returns the list of clients sorted in stacking order, with topmost client
* at the last position * at the last position
*/ */
@ -199,14 +206,15 @@ class Workspace : public QObject, public KDecorationDefines
ToplevelList xStackingOrder() const; ToplevelList xStackingOrder() const;
ClientList ensureStackingOrder( const ClientList& clients ) const; ClientList ensureStackingOrder( const ClientList& clients ) const;
Client* topClientOnDesktop( int desktop, int screen, bool unconstrained = false, bool only_normal = true ) const; Client* topClientOnDesktop( int desktop, int screen, bool unconstrained = false,
bool only_normal = true ) const;
Client* findDesktop( bool topmost, int desktop ) const; Client* findDesktop( bool topmost, int desktop ) const;
void sendClientToDesktop( Client* c, int desktop, bool dont_activate ); void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
void windowToPreviousDesktop( Client* c ); void windowToPreviousDesktop( Client* c );
void windowToNextDesktop( Client* c ); void windowToNextDesktop( Client* c );
void sendClientToScreen( Client* c, int screen ); void sendClientToScreen( Client* c, int screen );
// KDE4 remove me - and it's also in the DCOP interface :( // KDE4 remove me - And it's also in the DCOP interface :(
void showWindowMenuAt( unsigned long id, int x, int y ); void showWindowMenuAt( unsigned long id, int x, int y );
void loadEffect( const QString& name ); void loadEffect( const QString& name );
@ -219,13 +227,13 @@ class Workspace : public QObject, public KDecorationDefines
/** /**
* Shows the menu operations menu for the client and makes it active if * Shows the menu operations menu for the client and makes it active if
* it's not already. * it's not already.
*/
void showWindowMenu( const QRect& pos, Client* cl );
/**
* Backwards compatibility.
*/ */
void showWindowMenu( const QRect &pos, Client* cl );
/**
* Backwards compatibility.
*/
void showWindowMenu( int x, int y, Client* cl ); void showWindowMenu( int x, int y, Client* cl );
void showWindowMenu( QPoint pos, Client* cl ); void showWindowMenu( QPoint pos, Client* cl );
@ -252,18 +260,18 @@ class Workspace : public QObject, public KDecorationDefines
double decorationShadowBrightness( ShadowType type ) const; double decorationShadowBrightness( ShadowType type ) const;
double decorationShadowSaturation( ShadowType type ) const; double decorationShadowSaturation( ShadowType type ) const;
// dcop interface // D-Bus interface
void cascadeDesktop(); void cascadeDesktop();
void unclutterDesktop(); void unclutterDesktop();
void doNotManage( const QString & ); void doNotManage( const QString& );
QList< int > decorationSupportedColors() const; QList<int> decorationSupportedColors() const;
bool setCurrentDesktop( int new_desktop ); bool setCurrentDesktop( int new_desktop );
void nextDesktop(); void nextDesktop();
void previousDesktop(); void previousDesktop();
void circulateDesktopApplications(); void circulateDesktopApplications();
bool compositingActive(); bool compositingActive();
bool waitForCompositingSetup(); bool waitForCompositingSetup();
void setCurrentScreen( int new_screen ); void setCurrentScreen( int new_screen );
QString desktopName( int desk ) const; QString desktopName( int desk ) const;
@ -272,26 +280,31 @@ class Workspace : public QObject, public KDecorationDefines
void resetShowingDesktop( bool keep_hidden ); void resetShowingDesktop( bool keep_hidden );
bool showingDesktop() const; bool showingDesktop() const;
bool isNotManaged( const QString& title ); // ### setter or getter ? bool isNotManaged( const QString& title ); // TODO: Setter or getter?
void sendPingToWindow( Window w, Time timestamp ); // called from Client::pingWindow() void sendPingToWindow( Window w, Time timestamp ); // Called from Client::pingWindow()
void sendTakeActivity( Client* c, Time timestamp, long flags ); // called from Client::takeActivity() void sendTakeActivity( Client* c, Time timestamp, long flags ); // Called from Client::takeActivity()
void removeClient( Client*, allowed_t ); // only called from Client::destroyClient() or Client::releaseWindow() void removeClient( Client*, allowed_t ); // Only called from Client::destroyClient() or Client::releaseWindow()
void setActiveClient( Client*, allowed_t ); void setActiveClient( Client*, allowed_t );
Group* findGroup( Window leader ) const; Group* findGroup( Window leader ) const;
void addGroup( Group* group, allowed_t ); void addGroup( Group* group, allowed_t );
void removeGroup( Group* group, allowed_t ); void removeGroup( Group* group, allowed_t );
Group* findClientLeaderGroup( const Client* c ) const; Group* findClientLeaderGroup( const Client* c ) const;
void removeUnmanaged( Unmanaged*, allowed_t ); // only called from Unmanaged::release() void removeUnmanaged( Unmanaged*, allowed_t ); // Only called from Unmanaged::release()
void removeDeleted( Deleted*, allowed_t ); void removeDeleted( Deleted*, allowed_t );
void addDeleted( Deleted*, allowed_t ); void addDeleted( Deleted*, allowed_t );
bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data ); bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
void focusToNull(); // SELI public? void focusToNull(); // SELI TODO: Public?
enum FocusChainChange { FocusChainMakeFirst, FocusChainMakeLast, FocusChainUpdate }; enum FocusChainChange
{
FocusChainMakeFirst,
FocusChainMakeLast,
FocusChainUpdate
};
void updateFocusChains( Client* c, FocusChainChange change ); void updateFocusChains( Client* c, FocusChainChange change );
bool forcedGlobalMouseGrab() const; bool forcedGlobalMouseGrab() const;
@ -331,14 +344,14 @@ class Workspace : public QObject, public KDecorationDefines
void addRepaint( const QRect& r ); void addRepaint( const QRect& r );
void addRepaint( const QRegion& r ); void addRepaint( const QRegion& r );
void addRepaint( int x, int y, int w, int h ); void addRepaint( int x, int y, int w, int h );
// creates XComposite overlay window, call initOverlay() afterwards /// Creates XComposite overlay window, call initOverlay() afterwards
bool createOverlay(); bool createOverlay();
// init overlay and the destination window in it /// Init overlay and the destination window in it
void setupOverlay( Window window ); void setupOverlay( Window window );
void showOverlay(); void showOverlay();
void hideOverlay(); // hides and resets overlay window void hideOverlay(); // hides and resets overlay window
void setOverlayShape( const QRegion& reg ); void setOverlayShape( const QRegion& reg );
// destroys XComposite overlay window /// Destroys XComposite overlay window
void destroyOverlay(); void destroyOverlay();
Window overlayWindow(); Window overlayWindow();
void checkUnredirect( bool force = false ); void checkUnredirect( bool force = false );
@ -347,7 +360,8 @@ class Workspace : public QObject, public KDecorationDefines
public slots: public slots:
void addRepaintFull(); void addRepaintFull();
void refresh(); void refresh();
// keybindings
// Keybindings
void slotSwitchDesktopNext(); void slotSwitchDesktopNext();
void slotSwitchDesktopPrevious(); void slotSwitchDesktopPrevious();
void slotSwitchDesktopRight(); void slotSwitchDesktopRight();
@ -376,7 +390,7 @@ class Workspace : public QObject, public KDecorationDefines
void slotSwitchToDesktop18() { return slotSwitchToDesktop( 18 ); } void slotSwitchToDesktop18() { return slotSwitchToDesktop( 18 ); }
void slotSwitchToDesktop19() { return slotSwitchToDesktop( 19 ); } void slotSwitchToDesktop19() { return slotSwitchToDesktop( 19 ); }
void slotSwitchToDesktop20() { return slotSwitchToDesktop( 20 ); } void slotSwitchToDesktop20() { return slotSwitchToDesktop( 20 ); }
//void slotSwitchToWindow( int ); //void slotSwitchToWindow( int );
void slotWindowToDesktop( int ); void slotWindowToDesktop( int );
void slotWindowToDesktop1() { return slotWindowToDesktop( 1 ); } void slotWindowToDesktop1() { return slotWindowToDesktop( 1 ); }
void slotWindowToDesktop2() { return slotWindowToDesktop( 2 ); } void slotWindowToDesktop2() { return slotWindowToDesktop( 2 ); }
@ -398,7 +412,7 @@ class Workspace : public QObject, public KDecorationDefines
void slotWindowToDesktop18() { return slotWindowToDesktop( 18 ); } void slotWindowToDesktop18() { return slotWindowToDesktop( 18 ); }
void slotWindowToDesktop19() { return slotWindowToDesktop( 19 ); } void slotWindowToDesktop19() { return slotWindowToDesktop( 19 ); }
void slotWindowToDesktop20() { return slotWindowToDesktop( 20 ); } void slotWindowToDesktop20() { return slotWindowToDesktop( 20 ); }
//void slotWindowToListPosition( int ); //void slotWindowToListPosition( int );
void slotSwitchToScreen( int ); void slotSwitchToScreen( int );
void slotSwitchToScreen0() { return slotSwitchToScreen( 0 ); } void slotSwitchToScreen0() { return slotSwitchToScreen( 0 ); }
void slotSwitchToScreen1() { return slotSwitchToScreen( 1 ); } void slotSwitchToScreen1() { return slotSwitchToScreen( 1 ); }
@ -534,7 +548,7 @@ class Workspace : public QObject, public KDecorationDefines
bool establishTabBoxGrab(); bool establishTabBoxGrab();
void removeTabBoxGrab(); void removeTabBoxGrab();
void propagateClients( bool propagate_new_clients ); // called only from updateStackingOrder void propagateClients( bool propagate_new_clients ); // Called only from updateStackingOrder
ClientList constrainedStackingOrder(); ClientList constrainedStackingOrder();
void raiseClientWithinApplication( Client* c ); void raiseClientWithinApplication( Client* c );
void lowerClientWithinApplication( Client* c ); void lowerClientWithinApplication( Client* c );
@ -547,7 +561,7 @@ class Workspace : public QObject, public KDecorationDefines
void updateTopMenuGeometry( Client* c = NULL ); void updateTopMenuGeometry( Client* c = NULL );
void updateToolWindows( bool also_hide ); void updateToolWindows( bool also_hide );
// this is the right way to create a new client /// This is the right way to create a new client
Client* createClient( Window w, bool is_mapped ); Client* createClient( Window w, bool is_mapped );
void addClient( Client* c, allowed_t ); void addClient( Client* c, allowed_t );
Unmanaged* createUnmanaged( Window w ); Unmanaged* createUnmanaged( Window w );
@ -555,28 +569,28 @@ class Workspace : public QObject, public KDecorationDefines
Window findSpecialEventWindow( XEvent* e ); Window findSpecialEventWindow( XEvent* e );
void randomPlacement(Client* c); void randomPlacement( Client* c );
void smartPlacement(Client* c); void smartPlacement( Client* c );
void cascadePlacement(Client* c, bool re_init = false); void cascadePlacement( Client* c, bool re_init = false );
// desktop names and number of desktops // Desktop names and number of desktops
void loadDesktopSettings(); void loadDesktopSettings();
void saveDesktopSettings(); void saveDesktopSettings();
// mouse emulation // Mouse emulation
WId getMouseEmulationWindow(); WId getMouseEmulationWindow();
enum MouseEmulation { EmuPress, EmuRelease, EmuMove }; enum MouseEmulation { EmuPress, EmuRelease, EmuMove };
unsigned int sendFakedMouseEvent( const QPoint &pos, WId win, MouseEmulation type, int button, unsigned int state ); // returns the new state unsigned int sendFakedMouseEvent( const QPoint& pos, WId win, MouseEmulation type, int button, unsigned int state ); // returns the new state
void tabBoxKeyPress( int key ); void tabBoxKeyPress( int key );
void tabBoxKeyRelease( const XKeyEvent& ev ); void tabBoxKeyRelease( const XKeyEvent& ev );
// electric borders // Electric borders
void destroyElectricBorders(); void destroyElectricBorders();
bool electricBorderEvent(XEvent * e); bool electricBorderEvent(XEvent * e);
void electricBorderSwitchDesktop( ElectricBorder border, const QPoint& pos ); void electricBorderSwitchDesktop( ElectricBorder border, const QPoint& pos );
// ------------------ //---------------------------------------------------------------------
void helperDialog( const QString& message, const Client* c ); void helperDialog( const QString& message, const Client* c );
@ -612,12 +626,12 @@ class Workspace : public QObject, public KDecorationDefines
Client* active_client; Client* active_client;
Client* last_active_client; Client* last_active_client;
Client* most_recently_raised; // used _only_ by raiseOrLowerClient() Client* most_recently_raised; // Used ONLY by raiseOrLowerClient()
Client* movingClient; Client* movingClient;
Client* pending_take_activity; Client* pending_take_activity;
int active_screen; int active_screen;
// delay(ed) window focus timer and client // Delay(ed) window focus timer and client
QTimer* delayFocusTimer; QTimer* delayFocusTimer;
Client* delayfocus_client; Client* delayfocus_client;
QPoint focusMousePos; QPoint focusMousePos;
@ -627,14 +641,14 @@ class Workspace : public QObject, public KDecorationDefines
UnmanagedList unmanaged; UnmanagedList unmanaged;
DeletedList deleted; DeletedList deleted;
ClientList unconstrained_stacking_order; // topmost last ClientList unconstrained_stacking_order; // Topmost last
ClientList stacking_order; // topmost last ClientList stacking_order; // Topmost last
bool force_restacking; bool force_restacking;
mutable ToplevelList x_stacking; // from XQueryTree() mutable ToplevelList x_stacking; // From XQueryTree()
mutable bool x_stacking_dirty; mutable bool x_stacking_dirty;
QVector< ClientList > focus_chain; // currently ative last QVector< ClientList > focus_chain; // Currently ative last
ClientList global_focus_chain; // this one is only for things like tabbox's MRU ClientList global_focus_chain; // This one is only for things like tabbox's MRU
ClientList should_get_focus; // last is most recent ClientList should_get_focus; // Last is most recent
ClientList attention_chain; ClientList attention_chain;
bool showing_desktop; bool showing_desktop;
@ -650,9 +664,9 @@ class Workspace : public QObject, public KDecorationDefines
bool control_grab; bool control_grab;
bool tab_grab; bool tab_grab;
//KKeyNative walkThroughDesktopsKeycode, walkBackThroughDesktopsKeycode; //KKeyNative walkThroughDesktopsKeycode, walkBackThroughDesktopsKeycode;
//KKeyNative walkThroughDesktopListKeycode, walkBackThroughDesktopListKeycode; //KKeyNative walkThroughDesktopListKeycode, walkBackThroughDesktopListKeycode;
//KKeyNative walkThroughWindowsKeycode, walkBackThroughWindowsKeycode; //KKeyNative walkThroughWindowsKeycode, walkBackThroughWindowsKeycode;
KShortcut cutWalkThroughDesktops, cutWalkThroughDesktopsReverse; KShortcut cutWalkThroughDesktops, cutWalkThroughDesktopsReverse;
KShortcut cutWalkThroughDesktopList, cutWalkThroughDesktopListReverse; KShortcut cutWalkThroughDesktopList, cutWalkThroughDesktopListReverse;
KShortcut cutWalkThroughWindows, cutWalkThroughWindowsReverse; KShortcut cutWalkThroughWindows, cutWalkThroughWindowsReverse;
@ -664,56 +678,56 @@ class Workspace : public QObject, public KDecorationDefines
TabBox* tab_box; TabBox* tab_box;
PopupInfo* popupinfo; PopupInfo* popupinfo;
QMenu *popup; QMenu* popup;
QMenu *advanced_popup; QMenu* advanced_popup;
QMenu *trans_popup; QMenu* trans_popup;
QMenu *desk_popup; QMenu* desk_popup;
void modalActionsSwitch( bool enabled ); void modalActionsSwitch( bool enabled );
KActionCollection *keys; KActionCollection* keys;
KActionCollection *client_keys; KActionCollection* client_keys;
QAction *mResizeOpAction; QAction* mResizeOpAction;
QAction *mMoveOpAction; QAction* mMoveOpAction;
QAction *mMaximizeOpAction; QAction* mMaximizeOpAction;
QAction *mShadeOpAction; QAction* mShadeOpAction;
QAction *mKeepAboveOpAction; QAction* mKeepAboveOpAction;
QAction *mKeepBelowOpAction; QAction* mKeepBelowOpAction;
QAction *mFullScreenOpAction; QAction* mFullScreenOpAction;
QAction *mNoBorderOpAction; QAction* mNoBorderOpAction;
QAction *mMinimizeOpAction; QAction* mMinimizeOpAction;
QAction *mCloseOpAction; QAction* mCloseOpAction;
ShortcutDialog* client_keys_dialog; ShortcutDialog* client_keys_dialog;
Client* client_keys_client; Client* client_keys_client;
KActionCollection *disable_shortcuts_keys; KActionCollection* disable_shortcuts_keys;
bool global_shortcuts_disabled; bool global_shortcuts_disabled;
bool global_shortcuts_disabled_for_client; bool global_shortcuts_disabled_for_client;
PluginMgr *mgr; PluginMgr* mgr;
RootInfo *rootInfo; RootInfo* rootInfo;
QWidget* supportWindow; QWidget* supportWindow;
// swallowing // Swallowing
QStringList doNotManageList; QStringList doNotManageList;
// colormap handling // Colormap handling
Colormap default_colormap; Colormap default_colormap;
Colormap installed_colormap; Colormap installed_colormap;
// Timer to collect requests for 'reconfigure' // Timer to collect requests for 'reconfigure'
QTimer reconfigureTimer; QTimer reconfigureTimer;
QTimer updateToolWindowsTimer; QTimer updateToolWindowsTimer;
static Workspace *_self; static Workspace* _self;
bool workspaceInit; bool workspaceInit;
KStartupInfo* startup; KStartupInfo* startup;
ElectricBorder electric_current_border; ElectricBorder electric_current_border;
Window electric_windows[ ELECTRIC_COUNT ]; Window electric_windows[ELECTRIC_COUNT];
int electricLeft; int electricLeft;
int electricRight; int electricRight;
int electricTop; int electricTop;
@ -721,27 +735,27 @@ class Workspace : public QObject, public KDecorationDefines
Time electric_time_first; Time electric_time_first;
Time electric_time_last; Time electric_time_last;
QPoint electric_push_point; QPoint electric_push_point;
int electric_reserved[ ELECTRIC_COUNT ]; // corners/edges used by something int electric_reserved[ELECTRIC_COUNT]; // Corners/edges used by something
Qt::Orientation layoutOrientation; Qt::Orientation layoutOrientation;
int layoutX; int layoutX;
int layoutY; int layoutY;
Placement *initPositioning; Placement* initPositioning;
QVector< QRect > workarea; // array of workareas for virtual desktops QVector<QRect> workarea; // Array of workareas for virtual desktops
QVector< QVector< QRect > > screenarea; // array of workareas per xinerama screen for all virtual desktops QVector< QVector<QRect> > screenarea; // Array of workareas per xinerama screen for all virtual desktops
bool managing_topmenus; bool managing_topmenus;
KSelectionOwner* topmenu_selection; KSelectionOwner* topmenu_selection;
KSelectionWatcher* topmenu_watcher; KSelectionWatcher* topmenu_watcher;
ClientList topmenus; // doesn't own them ClientList topmenus; // Doesn't own them
mutable int topmenu_height; mutable int topmenu_height;
QWidget* topmenu_space; QWidget* topmenu_space;
int set_active_client_recursion; int set_active_client_recursion;
int block_stacking_updates; // when >0, stacking updates are temporarily disabled int block_stacking_updates; // When > 0, stacking updates are temporarily disabled
bool blocked_propagating_new_clients; // propagate also new clients after enabling stacking updates? bool blocked_propagating_new_clients; // Propagate also new clients after enabling stacking updates?
Window null_focus_window; Window null_focus_window;
bool forced_global_mouse_grab; bool forced_global_mouse_grab;
friend class StackingUpdatesBlocker; friend class StackingUpdatesBlocker;
@ -755,10 +769,10 @@ class Workspace : public QObject, public KDecorationDefines
QRegion repaints_region; QRegion repaints_region;
Window overlay; // XComposite overlay window Window overlay; // XComposite overlay window
bool overlay_visible; bool overlay_visible;
bool overlay_shown; // for showOverlay() bool overlay_shown; // For showOverlay()
QRegion overlay_shape; QRegion overlay_shape;
QSlider *transSlider; QSlider* transSlider;
QPushButton *transButton; QPushButton* transButton;
QTimer unredirectTimer; QTimer unredirectTimer;
bool forceUnredirectCheck; bool forceUnredirectCheck;
QList< int > composite_paint_times; QList< int > composite_paint_times;
@ -767,7 +781,9 @@ class Workspace : public QObject, public KDecorationDefines
friend bool performTransiencyCheck(); friend bool performTransiencyCheck();
}; };
// helper for Workspace::blockStackingUpdates() being called in pairs (true/false) /**
* Helper for Workspace::blockStackingUpdates() being called in pairs (True/false)
*/
class StackingUpdatesBlocker class StackingUpdatesBlocker
{ {
public: public:
@ -775,28 +791,35 @@ class StackingUpdatesBlocker
: ws( w ) { ws->blockStackingUpdates( true ); } : ws( w ) { ws->blockStackingUpdates( true ); }
~StackingUpdatesBlocker() ~StackingUpdatesBlocker()
{ ws->blockStackingUpdates( false ); } { ws->blockStackingUpdates( false ); }
private: private:
Workspace* ws; Workspace* ws;
}; };
// NET WM Protocol handler class /**
* NET WM Protocol handler class
*/
class RootInfo : public NETRootInfo class RootInfo : public NETRootInfo
{ {
private: private:
typedef KWin::Client Client; // because of NET::Client typedef KWin::Client Client; // Because of NET::Client
public: public:
RootInfo( Workspace* ws, Display *dpy, Window w, const char *name, unsigned long pr[], int pr_num, int scr= -1); RootInfo( Workspace* ws, Display* dpy, Window w, const char* name, unsigned long pr[],
int pr_num, int scr= -1 );
protected: protected:
virtual void changeNumberOfDesktops(int n); virtual void changeNumberOfDesktops( int n );
virtual void changeCurrentDesktop(int d); virtual void changeCurrentDesktop( int d );
virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp, Window active_window); virtual void changeActiveWindow( Window w,NET::RequestSource src, Time timestamp, Window active_window );
virtual void closeWindow(Window w); virtual void closeWindow( Window w );
virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction); virtual void moveResize( Window w, int x_root, int y_root, unsigned long direction );
virtual void moveResizeWindow(Window w, int flags, int x, int y, int width, int height ); virtual void moveResizeWindow( Window w, int flags, int x, int y, int width, int height );
virtual void gotPing(Window w, Time timestamp); virtual void gotPing( Window w, Time timestamp );
virtual void restackWindow(Window w, RequestSource source, Window above, int detail, Time timestamp); virtual void restackWindow( Window w, RequestSource source, Window above, int detail, Time timestamp );
virtual void gotTakeActivity(Window w, Time timestamp, long flags ); virtual void gotTakeActivity( Window w, Time timestamp, long flags );
virtual void changeShowingDesktop( bool showing ); virtual void changeShowingDesktop( bool showing );
private: private:
Workspace* workspace; Workspace* workspace;
}; };
@ -839,34 +862,31 @@ inline void Workspace::removeGroup( Group* group, allowed_t )
inline const ClientList& Workspace::stackingOrder() const inline const ClientList& Workspace::stackingOrder() const
{ {
// TODO Q_ASSERT( block_stacking_updates == 0 ); // TODO: Q_ASSERT( block_stacking_updates == 0 );
return stacking_order; return stacking_order;
} }
inline void Workspace::showWindowMenu(QPoint pos, Client* cl) inline void Workspace::showWindowMenu( QPoint pos, Client* cl )
{ {
showWindowMenu(QRect(pos, pos), cl); showWindowMenu( QRect( pos, pos ), cl );
} }
inline void Workspace::showWindowMenu(int x, int y, Client* cl) inline void Workspace::showWindowMenu( int x, int y, Client* cl )
{ {
showWindowMenu(QRect(QPoint(x, y), QPoint(x, y)), cl); showWindowMenu( QRect( QPoint( x, y ), QPoint( x, y )), cl );
} }
inline inline void Workspace::setWasUserInteraction()
void Workspace::setWasUserInteraction()
{ {
was_user_interaction = true; was_user_interaction = true;
} }
inline inline bool Workspace::wasUserInteraction() const
bool Workspace::wasUserInteraction() const
{ {
return was_user_interaction; return was_user_interaction;
} }
inline inline bool Workspace::managingTopMenus() const
bool Workspace::managingTopMenus() const
{ {
return managing_topmenus; return managing_topmenus;
} }
@ -906,27 +926,23 @@ inline Window Workspace::overlayWindow()
return overlay; return overlay;
} }
inline inline bool Workspace::rulesUpdatesDisabled() const
bool Workspace::rulesUpdatesDisabled() const
{ {
return rules_updates_disabled; return rules_updates_disabled;
} }
inline inline void Workspace::forceRestacking()
void Workspace::forceRestacking()
{ {
force_restacking = true; force_restacking = true;
StackingUpdatesBlocker blocker( this ); // do restacking if not blocked StackingUpdatesBlocker blocker( this ); // Do restacking if not blocked
} }
inline inline void Workspace::updateFocusMousePosition( const QPoint& pos )
void Workspace::updateFocusMousePosition( const QPoint& pos )
{ {
focusMousePos = pos; focusMousePos = pos;
} }
inline inline QPoint Workspace::focusMousePosition() const
QPoint Workspace::focusMousePosition() const
{ {
return focusMousePos; return focusMousePos;
} }
@ -944,18 +960,18 @@ inline Client* Workspace::findClient( T predicate ) const
template< typename T1, typename T2 > template< typename T1, typename T2 >
inline void Workspace::forEachClient( T1 procedure, T2 predicate ) inline void Workspace::forEachClient( T1 procedure, T2 predicate )
{ {
for ( ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it) for( ClientList::ConstIterator it = clients.constBegin(); it != clients.constEnd(); ++it )
if ( predicate( const_cast< const Client* >( *it))) if( predicate( const_cast<const Client*>( *it )))
procedure( *it ); procedure( *it );
for ( ClientList::ConstIterator it = desktops.constBegin(); it != desktops.constEnd(); ++it) for( ClientList::ConstIterator it = desktops.constBegin(); it != desktops.constEnd(); ++it )
if ( predicate( const_cast< const Client* >( *it))) if( predicate( const_cast<const Client*>( *it )))
procedure( *it ); procedure( *it );
} }
template< typename T > template< typename T >
inline void Workspace::forEachClient( T procedure ) inline void Workspace::forEachClient( T procedure )
{ {
return forEachClient( procedure, TruePredicate()); return forEachClient( procedure, TruePredicate() );
} }
template< typename T > template< typename T >
@ -967,80 +983,73 @@ inline Unmanaged* Workspace::findUnmanaged( T predicate ) const
template< typename T1, typename T2 > template< typename T1, typename T2 >
inline void Workspace::forEachUnmanaged( T1 procedure, T2 predicate ) inline void Workspace::forEachUnmanaged( T1 procedure, T2 predicate )
{ {
for ( UnmanagedList::ConstIterator it = unmanaged.constBegin(); it != unmanaged.constEnd(); ++it) for( UnmanagedList::ConstIterator it = unmanaged.constBegin(); it != unmanaged.constEnd(); ++it )
if ( predicate( const_cast< const Unmanaged* >( *it))) if( predicate( const_cast<const Unmanaged*>( *it )))
procedure( *it ); procedure( *it );
} }
template< typename T > template< typename T >
inline void Workspace::forEachUnmanaged( T procedure ) inline void Workspace::forEachUnmanaged( T procedure )
{ {
return forEachUnmanaged( procedure, TruePredicate()); return forEachUnmanaged( procedure, TruePredicate() );
} }
KWIN_COMPARE_PREDICATE( ClientMatchPredicate, Client, const Client*, cl == value ); KWIN_COMPARE_PREDICATE( ClientMatchPredicate, Client, const Client*, cl == value );
inline bool Workspace::hasClient( const Client* c ) inline bool Workspace::hasClient( const Client* c )
{ {
return findClient( ClientMatchPredicate( c )); return findClient( ClientMatchPredicate( c ));
} }
inline inline void Workspace::checkCompositeTimer()
void Workspace::checkCompositeTimer()
{ {
if( !compositeTimer.isActive()) if( !compositeTimer.isActive() )
setCompositeTimer(); setCompositeTimer();
} }
inline inline bool Workspace::hasDecorationShadows() const
bool Workspace::hasDecorationShadows() const
{ {
return mgr->factory()->supports( AbilityCompositingShadow ); return mgr->factory()->supports( AbilityCompositingShadow );
} }
inline inline QList< QList<QImage> > Workspace::decorationShadowTextures()
QList< QList<QImage> > Workspace::decorationShadowTextures()
{ {
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() )) if( KDecorationFactoryUnstable* factory = dynamic_cast<KDecorationFactoryUnstable*>( mgr->factory() ))
return factory->shadowTextures(); return factory->shadowTextures();
return QList< QList<QImage> >(); return QList< QList<QImage> >();
} }
inline inline int Workspace::decorationShadowTextureList( ShadowType type ) const
int Workspace::decorationShadowTextureList( ShadowType type ) const
{ {
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() )) if( KDecorationFactoryUnstable* factory = dynamic_cast<KDecorationFactoryUnstable*>( mgr->factory() ))
return factory->shadowTextureList( type ); return factory->shadowTextureList( type );
return -1; return -1;
} }
inline inline QList<QRect> Workspace::decorationShadowQuads( ShadowType type, QSize size ) const
QList<QRect> Workspace::decorationShadowQuads( ShadowType type, QSize size ) const
{ {
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() )) if( KDecorationFactoryUnstable* factory = dynamic_cast<KDecorationFactoryUnstable*>( mgr->factory() ))
return factory->shadowQuads( type, size ); return factory->shadowQuads( type, size );
return QList<QRect>(); return QList<QRect>();
} }
inline inline double Workspace::decorationShadowOpacity( ShadowType type ) const
double Workspace::decorationShadowOpacity( ShadowType type ) const
{ {
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() )) if( KDecorationFactoryUnstable* factory = dynamic_cast<KDecorationFactoryUnstable*>( mgr->factory() ))
return factory->shadowOpacity( type ); return factory->shadowOpacity( type );
return 1.0; return 1.0;
} }
inline inline double Workspace::decorationShadowBrightness( ShadowType type ) const
double Workspace::decorationShadowBrightness( ShadowType type ) const
{ {
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() )) if( KDecorationFactoryUnstable* factory = dynamic_cast<KDecorationFactoryUnstable*>( mgr->factory() ))
return factory->shadowBrightness( type ); return factory->shadowBrightness( type );
return 1.0; return 1.0;
} }
inline inline double Workspace::decorationShadowSaturation( ShadowType type ) const
double Workspace::decorationShadowSaturation( ShadowType type ) const
{ {
if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable* >( mgr->factory() )) if( KDecorationFactoryUnstable* factory = dynamic_cast< KDecorationFactoryUnstable*>( mgr->factory() ))
return factory->shadowSaturation( type ); return factory->shadowSaturation( type );
return 1.0; return 1.0;
} }