2000-03-25 01:23:02 +03:00
|
|
|
/*****************************************************************
|
2003-09-16 23:28:03 +04:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2000-04-06 22:29:04 +04:00
|
|
|
|
2000-03-25 01:23:02 +03:00
|
|
|
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
2003-09-16 23:28:03 +04:00
|
|
|
Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
|
|
|
|
|
|
|
|
You can Freely distribute this program under the GNU General Public
|
|
|
|
License. See the file "COPYING" for the exact licensing terms.
|
2000-03-25 01:23:02 +03:00
|
|
|
******************************************************************/
|
2003-09-16 23:28:03 +04:00
|
|
|
|
2002-07-27 00:30:36 +04:00
|
|
|
#ifndef KWIN_WORKSPACE_H
|
|
|
|
#define KWIN_WORKSPACE_H
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2006-05-11 12:04:23 +04:00
|
|
|
#include <QTimer>
|
2006-05-13 20:33:18 +04:00
|
|
|
#include <QVector>
|
2001-12-29 07:19:24 +03:00
|
|
|
#include <kshortcut.h>
|
2006-05-13 20:33:18 +04:00
|
|
|
#include <QCursor>
|
2003-09-16 23:28:03 +04:00
|
|
|
#include <netwm.h>
|
2004-06-11 19:10:09 +04:00
|
|
|
#include <kxmessages.h>
|
2006-10-24 22:31:33 +04:00
|
|
|
#include <qdatetime.h>
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
#include "utils.h"
|
|
|
|
#include "kdecoration.h"
|
2003-09-19 15:07:46 +04:00
|
|
|
#include "sm.h"
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2000-06-08 21:05:51 +04:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
2005-12-01 00:17:50 +03:00
|
|
|
class QMenu;
|
2001-02-20 04:20:38 +03:00
|
|
|
class KConfig;
|
2006-04-10 15:57:13 +04:00
|
|
|
class KActionCollection;
|
2005-01-10 12:56:21 +03:00
|
|
|
class KShortcutDialog;
|
2003-09-16 23:28:03 +04:00
|
|
|
class KStartupInfo;
|
2004-05-26 13:24:14 +04:00
|
|
|
class KStartupInfoId;
|
2003-09-16 23:28:03 +04:00
|
|
|
class KStartupInfoData;
|
2005-01-15 20:07:48 +03:00
|
|
|
class QSlider;
|
|
|
|
class QPushButton;
|
|
|
|
class KProcess;
|
2001-02-20 04:20:38 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
namespace KWinInternal
|
|
|
|
{
|
2003-04-09 18:20:55 +04:00
|
|
|
|
1999-08-20 03:26:42 +04:00
|
|
|
class Client;
|
|
|
|
class TabBox;
|
2002-04-01 06:54:00 +04:00
|
|
|
class PopupInfo;
|
2000-06-08 21:05:51 +04:00
|
|
|
class RootInfo;
|
2001-02-20 04:20:38 +03:00
|
|
|
class PluginMgr;
|
2003-09-16 23:28:03 +04:00
|
|
|
class Placement;
|
2004-06-18 12:57:42 +04:00
|
|
|
class Rules;
|
2004-05-28 17:51:11 +04:00
|
|
|
class WindowRules;
|
1999-11-14 09:34:28 +03:00
|
|
|
|
2000-06-28 11:51:45 +04:00
|
|
|
class SystemTrayWindow
|
2003-09-16 23:28:03 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SystemTrayWindow()
|
|
|
|
: win(0),winFor(0)
|
|
|
|
{}
|
|
|
|
SystemTrayWindow( WId w )
|
|
|
|
: win(w),winFor(0)
|
|
|
|
{}
|
|
|
|
SystemTrayWindow( WId w, WId wf )
|
|
|
|
: win(w),winFor(wf)
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool operator==( const SystemTrayWindow& other )
|
|
|
|
{ return win == other.win; }
|
|
|
|
WId win;
|
|
|
|
WId winFor;
|
|
|
|
};
|
1999-11-14 09:34:28 +03:00
|
|
|
|
2005-07-28 18:59:42 +04:00
|
|
|
typedef QList<SystemTrayWindow> SystemTrayWindowList;
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2006-06-07 13:05:46 +04:00
|
|
|
class Workspace : public QObject, public KDecorationDefines
|
2003-09-16 23:28:03 +04:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2006-02-19 04:33:48 +03:00
|
|
|
Workspace( bool restore = false );
|
2003-09-16 23:28:03 +04:00
|
|
|
virtual ~Workspace();
|
1999-11-07 11:46:36 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
static Workspace * self() { return _self; }
|
2006-09-19 16:20:19 +04:00
|
|
|
|
2003-10-02 16:33:51 +04:00
|
|
|
bool workspaceEvent( XEvent * );
|
2000-05-26 17:54:50 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
KDecoration* createDecoration( KDecorationBridge* bridge );
|
2001-06-03 13:04:03 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
bool hasClient( const Client * );
|
2001-06-03 13:30:19 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
template< typename T > Client* findClient( T predicate );
|
|
|
|
template< typename T1, typename T2 > void forEachClient( T1 procedure, T2 predicate );
|
|
|
|
template< typename T > void forEachClient( T procedure );
|
2006-09-19 16:20:19 +04:00
|
|
|
template< typename T > Unmanaged* findUnmanaged( T predicate );
|
|
|
|
template< typename T1, typename T2 > void forEachUnmanaged( T1 procedure, T2 predicate );
|
|
|
|
template< typename T > void forEachUnmanaged( T procedure );
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2003-10-10 16:58:38 +04:00
|
|
|
QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
|
|
|
|
QRect clientArea( clientAreaOption, const Client* c ) const;
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
void killWindowId( Window window);
|
|
|
|
|
|
|
|
void killWindow() { slotKillWindow(); }
|
|
|
|
|
|
|
|
WId rootWin() const;
|
|
|
|
|
|
|
|
bool initializing() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the active client, i.e. the client that has the focus (or None
|
|
|
|
* if no client has the focus)
|
|
|
|
*/
|
|
|
|
Client* activeClient() const;
|
2003-12-02 20:52:10 +03:00
|
|
|
// 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
|
|
|
|
// stealing prevention code.
|
|
|
|
Client* mostRecentlyActivatedClient() const;
|
2003-09-16 23:28:03 +04:00
|
|
|
|
2006-02-19 04:33:48 +03:00
|
|
|
void activateClient( Client*, bool force = false );
|
|
|
|
void requestFocus( Client* c, bool force = false );
|
2004-04-16 14:23:42 +04:00
|
|
|
void takeActivity( Client* c, int flags, bool handled ); // flags are ActivityFlags
|
2004-04-22 16:30:57 +04:00
|
|
|
void handleTakeActivity( Client* c, Time timestamp, int flags ); // flags are ActivityFlags
|
2004-06-11 19:13:08 +04:00
|
|
|
bool allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false );
|
2003-09-16 23:28:03 +04:00
|
|
|
void restoreFocus();
|
|
|
|
void gotFocusIn( const Client* );
|
2004-04-16 14:23:42 +04:00
|
|
|
void setShouldGetFocus( Client* );
|
2003-09-16 23:28:03 +04:00
|
|
|
bool fakeRequestedActivity( Client* c );
|
|
|
|
void unfakeActivity( Client* c );
|
2004-11-22 14:34:09 +03:00
|
|
|
bool activateNextClient( Client* c );
|
2004-01-09 20:35:21 +03:00
|
|
|
bool focusChangeEnabled() { return block_focus == 0; }
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
void updateColormap();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the client c is being moved around by the user.
|
|
|
|
*/
|
|
|
|
void setClientIsMoving( Client *c );
|
|
|
|
|
2004-01-10 18:13:23 +03:00
|
|
|
void place( Client *c, QRect& area );
|
|
|
|
void placeSmart( Client* c, const QRect& area );
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
QPoint adjustClientPosition( Client* c, QPoint pos );
|
2004-06-03 16:36:57 +04:00
|
|
|
QRect adjustClientSize( Client* c, QRect moveResizeGeom, int mode );
|
2003-09-16 23:28:03 +04:00
|
|
|
void raiseClient( Client* c );
|
|
|
|
void lowerClient( Client* c );
|
2004-04-16 13:43:53 +04:00
|
|
|
void raiseClientRequest( Client* c, NET::RequestSource src, Time timestamp );
|
|
|
|
void lowerClientRequest( Client* c, NET::RequestSource src, Time timestamp );
|
2003-09-16 23:28:03 +04:00
|
|
|
void restackClientUnderActive( Client* );
|
|
|
|
void updateClientLayer( Client* c );
|
|
|
|
void raiseOrLowerClient( Client * );
|
2006-04-20 18:57:10 +04:00
|
|
|
void restoreSessionStackingOrder( Client* c );
|
2003-09-16 23:28:03 +04:00
|
|
|
void reconfigure();
|
|
|
|
|
|
|
|
void clientHidden( Client* );
|
|
|
|
void clientAttentionChanged( Client* c, bool set );
|
|
|
|
|
2003-10-10 16:48:09 +04:00
|
|
|
void clientMoved(const QPoint &pos, Time time);
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current virtual desktop of this workspace
|
|
|
|
*/
|
|
|
|
int currentDesktop() const;
|
|
|
|
/**
|
|
|
|
* Returns the number of virtual desktops of this workspace
|
|
|
|
*/
|
|
|
|
int numberOfDesktops() const;
|
|
|
|
void setNumberOfDesktops( int n );
|
|
|
|
|
|
|
|
QWidget* desktopWidget();
|
|
|
|
|
|
|
|
// for TabBox
|
|
|
|
Client* nextFocusChainClient(Client*) const;
|
|
|
|
Client* previousFocusChainClient(Client*) const;
|
|
|
|
Client* nextStaticClient(Client*) const;
|
|
|
|
Client* previousStaticClient(Client*) const;
|
|
|
|
int nextDesktopFocusChain( int iDesktop ) const;
|
|
|
|
int previousDesktopFocusChain( int iDesktop ) const;
|
2004-02-10 12:24:57 +03:00
|
|
|
void closeTabBox();
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the list of clients sorted in stacking order, with topmost client
|
|
|
|
* at the last position
|
|
|
|
*/
|
|
|
|
const ClientList& stackingOrder() const;
|
|
|
|
|
|
|
|
ClientList ensureStackingOrder( const ClientList& clients ) const;
|
|
|
|
|
2004-01-19 17:42:52 +03:00
|
|
|
Client* topClientOnDesktop( int desktop, bool unconstrained = false ) const;
|
2003-09-16 23:28:03 +04:00
|
|
|
Client* findDesktop( bool topmost, int desktop ) const;
|
|
|
|
void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
|
2005-05-06 19:20:49 +04:00
|
|
|
void windowToPreviousDesktop( Client* c );
|
|
|
|
void windowToNextDesktop( Client* c );
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// KDE4 remove me - and it's also in the DCOP interface :(
|
|
|
|
void showWindowMenuAt( unsigned long id, int x, int y );
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
/**
|
2004-06-02 13:47:36 +04:00
|
|
|
* Shows the menu operations menu for the client and makes it active if
|
|
|
|
* it's not already.
|
2003-09-16 23:28:03 +04:00
|
|
|
*/
|
2004-06-02 13:47:36 +04:00
|
|
|
void showWindowMenu( const QRect &pos, Client* cl );
|
|
|
|
/**
|
|
|
|
* Backwards compatibility.
|
|
|
|
*/
|
2003-09-16 23:28:03 +04:00
|
|
|
void showWindowMenu( int x, int y, Client* cl );
|
|
|
|
void showWindowMenu( QPoint pos, Client* cl );
|
2000-09-12 00:54:00 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
void updateMinimizedOfTransients( Client* );
|
|
|
|
void updateOnAllDesktopsOfTransients( Client* );
|
|
|
|
void checkTransients( Window w );
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
void performWindowOperation( Client* c, WindowOperation op );
|
2001-08-28 03:56:15 +04:00
|
|
|
|
2003-09-19 15:07:46 +04:00
|
|
|
void storeSession( KConfig* config, SMSavePhase phase );
|
2000-06-02 04:20:41 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
SessionInfo* takeSessionInfo( Client* );
|
2004-06-18 12:57:42 +04:00
|
|
|
WindowRules findWindowRules( const Client*, bool );
|
2004-06-11 19:12:29 +04:00
|
|
|
void rulesUpdated();
|
2005-06-07 19:31:15 +04:00
|
|
|
void discardUsedWindowRules( Client* c, bool withdraw );
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// dcop interface
|
|
|
|
void cascadeDesktop();
|
|
|
|
void unclutterDesktop();
|
|
|
|
void doNotManage(QString);
|
|
|
|
bool setCurrentDesktop( int new_desktop );
|
|
|
|
void nextDesktop();
|
|
|
|
void previousDesktop();
|
|
|
|
void circulateDesktopApplications();
|
2001-06-19 00:18:32 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
QString desktopName( int desk ) const;
|
|
|
|
void setDesktopLayout(int o, int x, int y);
|
2005-05-13 12:57:21 +04:00
|
|
|
void setShowingDesktop( bool showing );
|
|
|
|
void resetShowingDesktop( bool keep_hidden );
|
|
|
|
bool showingDesktop() const;
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
bool isNotManaged( const QString& title ); // ### setter or getter ?
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
void sendPingToWindow( Window w, Time timestamp ); // called from Client::pingWindow()
|
2004-04-22 16:30:57 +04:00
|
|
|
void sendTakeActivity( Client* c, Time timestamp, long flags ); // called from Client::takeActivity()
|
2006-09-11 12:25:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// only called from Client::destroyClient() or Client::releaseWindow()
|
|
|
|
void removeClient( Client*, allowed_t );
|
2004-04-16 14:23:42 +04:00
|
|
|
void setActiveClient( Client*, allowed_t );
|
|
|
|
Group* findGroup( Window leader ) const;
|
|
|
|
void addGroup( Group* group, allowed_t );
|
|
|
|
void removeGroup( Group* group, allowed_t );
|
|
|
|
Group* findClientLeaderGroup( const Client* c ) const;
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2006-09-19 16:20:19 +04:00
|
|
|
// only called from Unmanaged::release()
|
|
|
|
void removeUnmanaged( Unmanaged*, allowed_t );
|
|
|
|
|
2004-05-26 13:24:14 +04:00
|
|
|
bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
|
2000-07-11 15:41:52 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
void focusToNull(); // SELI public?
|
2006-04-11 18:52:27 +04:00
|
|
|
enum FocusChainChange { FocusChainMakeFirst, FocusChainMakeLast, FocusChainUpdate };
|
|
|
|
void updateFocusChains( Client* c, FocusChainChange change );
|
2006-09-11 12:25:29 +04:00
|
|
|
|
2004-02-10 12:24:57 +03:00
|
|
|
bool forcedGlobalMouseGrab() const;
|
2005-01-10 12:56:21 +03:00
|
|
|
void clientShortcutUpdated( Client* c );
|
2005-01-17 18:53:14 +03:00
|
|
|
bool shortcutAvailable( const KShortcut& cut, Client* ignore = NULL ) const;
|
2005-08-02 17:25:20 +04:00
|
|
|
bool globalShortcutsDisabled() const;
|
|
|
|
void disableGlobalShortcuts( bool disable );
|
|
|
|
void disableGlobalShortcutsForClient( bool disable );
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
void sessionSaveStarted();
|
|
|
|
void sessionSaveDone();
|
|
|
|
void setWasUserInteraction();
|
2004-06-11 19:13:08 +04:00
|
|
|
bool wasUserInteraction() const;
|
2003-09-16 23:28:03 +04:00
|
|
|
bool sessionSaving() const;
|
2000-06-23 22:56:59 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
bool managingTopMenus() const;
|
|
|
|
int topMenuHeight() const;
|
2004-07-27 17:13:52 +04:00
|
|
|
void updateCurrentTopMenu();
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
int packPositionLeft( const Client* cl, int oldx, bool left_edge ) const;
|
|
|
|
int packPositionRight( const Client* cl, int oldx, bool right_edge ) const;
|
|
|
|
int packPositionUp( const Client* cl, int oldy, bool top_edge ) const;
|
|
|
|
int packPositionDown( const Client* cl, int oldy, bool bottom_edge ) const;
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2004-03-18 16:18:41 +03:00
|
|
|
static QStringList configModules(bool controlCenter);
|
|
|
|
|
2004-05-28 12:53:44 +04:00
|
|
|
void cancelDelayFocus();
|
|
|
|
void requestDelayFocus( Client* );
|
2006-09-11 12:25:29 +04:00
|
|
|
|
2005-01-15 20:07:48 +03:00
|
|
|
void toggleTopDockShadows(bool on);
|
2006-09-19 16:20:19 +04:00
|
|
|
|
|
|
|
void addDamage( const QRect& r );
|
|
|
|
void addDamage( int x, int y, int w, int h );
|
2006-10-24 23:28:17 +04:00
|
|
|
void addDamageFull();
|
2004-05-28 12:53:44 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
public slots:
|
|
|
|
void refresh();
|
|
|
|
// keybindings
|
|
|
|
void slotSwitchDesktopNext();
|
|
|
|
void slotSwitchDesktopPrevious();
|
|
|
|
void slotSwitchDesktopRight();
|
|
|
|
void slotSwitchDesktopLeft();
|
|
|
|
void slotSwitchDesktopUp();
|
|
|
|
void slotSwitchDesktopDown();
|
|
|
|
|
|
|
|
void slotSwitchToDesktop( int );
|
2006-09-30 19:47:41 +04:00
|
|
|
void slotSwitchToDesktop1() { return slotSwitchToDesktop( 1 ); }
|
|
|
|
void slotSwitchToDesktop2() { return slotSwitchToDesktop( 2 ); }
|
|
|
|
void slotSwitchToDesktop3() { return slotSwitchToDesktop( 3 ); }
|
|
|
|
void slotSwitchToDesktop4() { return slotSwitchToDesktop( 4 ); }
|
|
|
|
void slotSwitchToDesktop5() { return slotSwitchToDesktop( 5 ); }
|
|
|
|
void slotSwitchToDesktop6() { return slotSwitchToDesktop( 6 ); }
|
|
|
|
void slotSwitchToDesktop7() { return slotSwitchToDesktop( 7 ); }
|
|
|
|
void slotSwitchToDesktop8() { return slotSwitchToDesktop( 8 ); }
|
|
|
|
void slotSwitchToDesktop9() { return slotSwitchToDesktop( 9 ); }
|
|
|
|
void slotSwitchToDesktop10() { return slotSwitchToDesktop( 10 ); }
|
|
|
|
void slotSwitchToDesktop11() { return slotSwitchToDesktop( 11 ); }
|
|
|
|
void slotSwitchToDesktop12() { return slotSwitchToDesktop( 12 ); }
|
|
|
|
void slotSwitchToDesktop13() { return slotSwitchToDesktop( 13 ); }
|
|
|
|
void slotSwitchToDesktop14() { return slotSwitchToDesktop( 14 ); }
|
|
|
|
void slotSwitchToDesktop15() { return slotSwitchToDesktop( 15 ); }
|
|
|
|
void slotSwitchToDesktop16() { return slotSwitchToDesktop( 16 ); }
|
|
|
|
void slotSwitchToDesktop17() { return slotSwitchToDesktop( 17 ); }
|
|
|
|
void slotSwitchToDesktop18() { return slotSwitchToDesktop( 18 ); }
|
|
|
|
void slotSwitchToDesktop19() { return slotSwitchToDesktop( 19 ); }
|
|
|
|
void slotSwitchToDesktop20() { return slotSwitchToDesktop( 20 ); }
|
2003-09-16 23:28:03 +04:00
|
|
|
//void slotSwitchToWindow( int );
|
|
|
|
void slotWindowToDesktop( int );
|
2006-09-30 19:47:41 +04:00
|
|
|
void slotWindowToDesktop1() { return slotWindowToDesktop( 1 ); }
|
|
|
|
void slotWindowToDesktop2() { return slotWindowToDesktop( 2 ); }
|
|
|
|
void slotWindowToDesktop3() { return slotWindowToDesktop( 3 ); }
|
|
|
|
void slotWindowToDesktop4() { return slotWindowToDesktop( 4 ); }
|
|
|
|
void slotWindowToDesktop5() { return slotWindowToDesktop( 5 ); }
|
|
|
|
void slotWindowToDesktop6() { return slotWindowToDesktop( 6 ); }
|
|
|
|
void slotWindowToDesktop7() { return slotWindowToDesktop( 7 ); }
|
|
|
|
void slotWindowToDesktop8() { return slotWindowToDesktop( 8 ); }
|
|
|
|
void slotWindowToDesktop9() { return slotWindowToDesktop( 9 ); }
|
|
|
|
void slotWindowToDesktop10() { return slotWindowToDesktop( 10 ); }
|
|
|
|
void slotWindowToDesktop11() { return slotWindowToDesktop( 11 ); }
|
|
|
|
void slotWindowToDesktop12() { return slotWindowToDesktop( 12 ); }
|
|
|
|
void slotWindowToDesktop13() { return slotWindowToDesktop( 13 ); }
|
|
|
|
void slotWindowToDesktop14() { return slotWindowToDesktop( 14 ); }
|
|
|
|
void slotWindowToDesktop15() { return slotWindowToDesktop( 15 ); }
|
|
|
|
void slotWindowToDesktop16() { return slotWindowToDesktop( 16 ); }
|
|
|
|
void slotWindowToDesktop17() { return slotWindowToDesktop( 17 ); }
|
|
|
|
void slotWindowToDesktop18() { return slotWindowToDesktop( 18 ); }
|
|
|
|
void slotWindowToDesktop19() { return slotWindowToDesktop( 19 ); }
|
|
|
|
void slotWindowToDesktop20() { return slotWindowToDesktop( 20 ); }
|
2003-09-16 23:28:03 +04:00
|
|
|
//void slotWindowToListPosition( int );
|
1999-11-25 19:38:11 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
void slotWindowMaximize();
|
|
|
|
void slotWindowMaximizeVertical();
|
|
|
|
void slotWindowMaximizeHorizontal();
|
|
|
|
void slotWindowMinimize();
|
|
|
|
void slotWindowShade();
|
|
|
|
void slotWindowRaise();
|
|
|
|
void slotWindowLower();
|
|
|
|
void slotWindowRaiseOrLower();
|
|
|
|
void slotActivateAttentionWindow();
|
|
|
|
void slotWindowPackLeft();
|
|
|
|
void slotWindowPackRight();
|
|
|
|
void slotWindowPackUp();
|
|
|
|
void slotWindowPackDown();
|
|
|
|
void slotWindowGrowHorizontal();
|
|
|
|
void slotWindowGrowVertical();
|
|
|
|
void slotWindowShrinkHorizontal();
|
|
|
|
void slotWindowShrinkVertical();
|
|
|
|
|
|
|
|
void slotWalkThroughDesktops();
|
|
|
|
void slotWalkBackThroughDesktops();
|
|
|
|
void slotWalkThroughDesktopList();
|
|
|
|
void slotWalkBackThroughDesktopList();
|
|
|
|
void slotWalkThroughWindows();
|
|
|
|
void slotWalkBackThroughWindows();
|
|
|
|
|
|
|
|
void slotWindowOperations();
|
|
|
|
void slotWindowClose();
|
|
|
|
void slotWindowMove();
|
|
|
|
void slotWindowResize();
|
|
|
|
void slotWindowAbove();
|
|
|
|
void slotWindowBelow();
|
|
|
|
void slotWindowOnAllDesktops();
|
|
|
|
void slotWindowFullScreen();
|
2003-09-17 14:57:28 +04:00
|
|
|
void slotWindowNoBorder();
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
void slotWindowToNextDesktop();
|
|
|
|
void slotWindowToPreviousDesktop();
|
2004-09-22 20:49:41 +04:00
|
|
|
void slotWindowToDesktopRight();
|
|
|
|
void slotWindowToDesktopLeft();
|
|
|
|
void slotWindowToDesktopUp();
|
|
|
|
void slotWindowToDesktopDown();
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
void slotMouseEmulation();
|
2005-08-02 17:25:20 +04:00
|
|
|
void slotDisableGlobalShortcuts();
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
void slotSettingsChanged( int category );
|
|
|
|
|
|
|
|
void slotReconfigure();
|
|
|
|
|
|
|
|
void slotKillWindow();
|
|
|
|
|
|
|
|
void slotGrabWindow();
|
|
|
|
void slotGrabDesktop();
|
|
|
|
|
2005-01-10 12:56:21 +03:00
|
|
|
void slotSetupWindowShortcut();
|
|
|
|
void setupWindowShortcutDone( bool );
|
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
void updateClientArea();
|
2006-09-11 12:25:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
private slots:
|
|
|
|
void desktopPopupAboutToShow();
|
|
|
|
void clientPopupAboutToShow();
|
2006-04-12 19:13:31 +04:00
|
|
|
void slotSendToDesktop( QAction* );
|
|
|
|
void clientPopupActivated( QAction* );
|
2003-09-16 23:28:03 +04:00
|
|
|
void configureWM();
|
|
|
|
void desktopResized();
|
|
|
|
void slotUpdateToolWindows();
|
|
|
|
void lostTopMenuSelection();
|
|
|
|
void lostTopMenuOwner();
|
2004-05-28 12:53:44 +04:00
|
|
|
void delayFocus();
|
2004-06-11 19:10:09 +04:00
|
|
|
void gotTemporaryRulesMessage( const QString& );
|
|
|
|
void cleanupTemporaryRules();
|
2004-06-11 19:12:29 +04:00
|
|
|
void writeWindowRules();
|
2006-09-11 12:25:29 +04:00
|
|
|
void slotBlockShortcuts(int data);
|
2005-01-15 20:07:48 +03:00
|
|
|
void setPopupClientOpacity(int v);
|
|
|
|
void resetClientOpacity();
|
|
|
|
void setTransButtonText(int value);
|
2006-09-19 16:20:19 +04:00
|
|
|
void compositeTimeout();
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool keyPressMouseEmulation( XKeyEvent& ev );
|
|
|
|
bool netCheck( XEvent* e );
|
|
|
|
|
|
|
|
private:
|
|
|
|
void init();
|
|
|
|
void initShortcuts();
|
|
|
|
void readShortcuts();
|
|
|
|
void initDesktopPopup();
|
2005-01-10 12:56:21 +03:00
|
|
|
void setupWindowShortcut( Client* c );
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
bool startKDEWalkThroughWindows();
|
|
|
|
bool startWalkThroughDesktops( int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
|
|
|
|
bool startWalkThroughDesktops();
|
|
|
|
bool startWalkThroughDesktopList();
|
|
|
|
void KDEWalkThroughWindows( bool forward );
|
|
|
|
void CDEWalkThroughWindows( bool forward );
|
|
|
|
void walkThroughDesktops( bool forward );
|
|
|
|
void KDEOneStepThroughWindows( bool forward );
|
|
|
|
void oneStepThroughDesktops( bool forward, int mode ); // TabBox::Mode::DesktopMode | DesktopListMode
|
|
|
|
void oneStepThroughDesktops( bool forward );
|
|
|
|
void oneStepThroughDesktopList( bool forward );
|
2004-02-10 12:24:57 +03:00
|
|
|
bool establishTabBoxGrab();
|
|
|
|
void removeTabBoxGrab();
|
2004-09-22 20:49:41 +04:00
|
|
|
int desktopToRight( int desktop ) const;
|
|
|
|
int desktopToLeft( int desktop ) const;
|
|
|
|
int desktopUp( int desktop ) const;
|
|
|
|
int desktopDown( int desktop ) const;
|
2003-09-16 23:28:03 +04:00
|
|
|
|
|
|
|
void updateStackingOrder( bool propagate_new_clients = false );
|
|
|
|
void propagateClients( bool propagate_new_clients ); // called only from updateStackingOrder
|
|
|
|
ClientList constrainedStackingOrder();
|
2003-09-30 16:49:23 +04:00
|
|
|
void raiseClientWithinApplication( Client* c );
|
|
|
|
void lowerClientWithinApplication( Client* c );
|
2004-04-16 13:43:53 +04:00
|
|
|
bool allowFullClientRaising( const Client* c, Time timestamp );
|
2003-09-25 16:17:35 +04:00
|
|
|
bool keepTransientAbove( const Client* mainwindow, const Client* transient );
|
2003-09-16 23:28:03 +04:00
|
|
|
void blockStackingUpdates( bool block );
|
2003-11-10 21:08:04 +03:00
|
|
|
void addTopMenu( Client* c );
|
|
|
|
void removeTopMenu( Client* c );
|
2003-11-12 12:47:13 +03:00
|
|
|
void setupTopMenuHandling();
|
2003-11-13 17:34:05 +03:00
|
|
|
void updateTopMenuGeometry( Client* c = NULL );
|
2003-09-16 23:28:03 +04:00
|
|
|
void updateToolWindows( bool also_hide );
|
|
|
|
|
|
|
|
// this is the right way to create a new client
|
2003-11-24 18:05:50 +03:00
|
|
|
Client* createClient( Window w, bool is_mapped );
|
2003-09-16 23:28:03 +04:00
|
|
|
void addClient( Client* c, allowed_t );
|
2006-09-19 16:20:19 +04:00
|
|
|
Unmanaged* createUnmanaged( Window w );
|
|
|
|
void addUnmanaged( Unmanaged* c, allowed_t );
|
2003-09-16 23:28:03 +04:00
|
|
|
|
2003-10-02 16:33:51 +04:00
|
|
|
Window findSpecialEventWindow( XEvent* e );
|
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
void randomPlacement(Client* c);
|
|
|
|
void smartPlacement(Client* c);
|
|
|
|
void cascadePlacement(Client* c, bool re_init = false);
|
|
|
|
|
|
|
|
bool addSystemTrayWin( WId w );
|
2003-10-30 13:10:54 +03:00
|
|
|
bool removeSystemTrayWin( WId w, bool check );
|
2003-09-16 23:28:03 +04:00
|
|
|
void propagateSystemTrayWins();
|
|
|
|
SystemTrayWindow findSystemTrayWin( WId w );
|
2002-08-22 21:16:47 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// desktop names and number of desktops
|
|
|
|
void loadDesktopSettings();
|
|
|
|
void saveDesktopSettings();
|
1999-12-06 03:43:55 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// mouse emulation
|
|
|
|
WId getMouseEmulationWindow();
|
|
|
|
enum MouseEmulation { EmuPress, EmuRelease, EmuMove };
|
|
|
|
unsigned int sendFakedMouseEvent( QPoint pos, WId win, MouseEmulation type, int button, unsigned int state ); // returns the new state
|
1999-11-14 09:34:28 +03:00
|
|
|
|
2006-04-10 15:57:13 +04:00
|
|
|
void tabBoxKeyPress( int key );
|
2003-09-16 23:28:03 +04:00
|
|
|
void tabBoxKeyRelease( const XKeyEvent& ev );
|
1999-11-29 05:06:41 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// electric borders
|
2004-11-02 18:19:01 +03:00
|
|
|
void checkElectricBorders( bool force = false );
|
2003-09-16 23:28:03 +04:00
|
|
|
void createBorderWindows();
|
|
|
|
void destroyBorderWindows();
|
2004-11-09 18:38:33 +03:00
|
|
|
bool electricBorder(XEvent * e);
|
2003-09-16 23:28:03 +04:00
|
|
|
void raiseElectricBorders();
|
2000-04-06 22:29:04 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// ------------------
|
2006-09-11 12:25:29 +04:00
|
|
|
|
2003-10-13 20:22:39 +04:00
|
|
|
void helperDialog( const QString& message, const Client* c );
|
2000-05-26 17:54:50 +04:00
|
|
|
|
2004-09-22 20:49:41 +04:00
|
|
|
void calcDesktopLayout(int &x, int &y) const;
|
2000-05-26 17:54:50 +04:00
|
|
|
|
2005-12-01 00:17:50 +03:00
|
|
|
QMenu* clientPopup();
|
2005-01-10 12:56:21 +03:00
|
|
|
void closeActivePopup();
|
2000-06-21 21:43:44 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
void updateClientArea( bool force );
|
2006-09-19 16:20:19 +04:00
|
|
|
|
|
|
|
void setupCompositing();
|
|
|
|
void finishCompositing();
|
2000-07-30 20:15:17 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
SystemTrayWindowList systemTrayWins;
|
2000-07-30 20:15:17 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
int current_desktop;
|
|
|
|
int number_of_desktops;
|
2005-07-28 18:59:42 +04:00
|
|
|
QVector<int> desktop_focus_chain;
|
1999-11-29 05:06:41 +03:00
|
|
|
|
2005-01-10 12:56:21 +03:00
|
|
|
QWidget* active_popup;
|
|
|
|
Client* active_popup_client;
|
2001-06-10 08:10:42 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
QWidget* desktop_widget;
|
2000-07-14 23:56:47 +04:00
|
|
|
|
2004-05-28 17:51:11 +04:00
|
|
|
void loadSessionInfo();
|
|
|
|
void loadWindowRules();
|
2005-08-16 21:46:42 +04:00
|
|
|
void editWindowRules( Client* c, bool whole_app );
|
2004-05-28 17:51:11 +04:00
|
|
|
|
2005-07-28 18:59:42 +04:00
|
|
|
QList<SessionInfo*> session;
|
|
|
|
QList<Rules*> rules;
|
2004-06-11 19:10:09 +04:00
|
|
|
KXMessages temporaryRulesMessages;
|
2004-06-11 19:12:29 +04:00
|
|
|
QTimer rulesUpdatedTimer;
|
2003-09-16 23:28:03 +04:00
|
|
|
static const char* windowTypeToTxt( NET::WindowType type );
|
|
|
|
static NET::WindowType txtToWindowType( const char* txt );
|
|
|
|
static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
Client* active_client;
|
|
|
|
Client* last_active_client;
|
|
|
|
Client* most_recently_raised; // used _only_ by raiseOrLowerClient()
|
|
|
|
Client* movingClient;
|
2004-04-22 16:30:57 +04:00
|
|
|
Client* pending_take_activity;
|
2001-08-27 09:42:32 +04:00
|
|
|
|
2004-05-28 12:53:44 +04:00
|
|
|
// delay(ed) window focus timer and client
|
|
|
|
QTimer* delayFocusTimer;
|
|
|
|
Client* delayfocus_client;
|
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
ClientList clients;
|
|
|
|
ClientList desktops;
|
2006-09-19 16:20:19 +04:00
|
|
|
UnmanagedList unmanaged;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
ClientList unconstrained_stacking_order;
|
|
|
|
ClientList stacking_order;
|
2006-02-27 13:13:31 +03:00
|
|
|
QVector< ClientList > focus_chain;
|
2006-04-11 18:14:38 +04:00
|
|
|
ClientList global_focus_chain; // this one is only for things like tabbox's MRU
|
2003-09-16 23:28:03 +04:00
|
|
|
ClientList should_get_focus; // last is most recent
|
|
|
|
ClientList attention_chain;
|
2006-09-11 12:25:29 +04:00
|
|
|
|
2005-05-13 12:57:21 +04:00
|
|
|
bool showing_desktop;
|
|
|
|
ClientList showing_desktop_clients;
|
|
|
|
int block_showing_desktop;
|
2001-11-30 02:59:54 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
GroupList groups;
|
2002-12-28 01:57:06 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
bool was_user_interaction;
|
|
|
|
bool session_saving;
|
2003-09-19 15:07:46 +04:00
|
|
|
int session_active_client;
|
|
|
|
int session_desktop;
|
2001-11-30 02:59:54 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
bool control_grab;
|
|
|
|
bool tab_grab;
|
|
|
|
//KKeyNative walkThroughDesktopsKeycode, walkBackThroughDesktopsKeycode;
|
|
|
|
//KKeyNative walkThroughDesktopListKeycode, walkBackThroughDesktopListKeycode;
|
|
|
|
//KKeyNative walkThroughWindowsKeycode, walkBackThroughWindowsKeycode;
|
|
|
|
KShortcut cutWalkThroughDesktops, cutWalkThroughDesktopsReverse;
|
|
|
|
KShortcut cutWalkThroughDesktopList, cutWalkThroughDesktopListReverse;
|
|
|
|
KShortcut cutWalkThroughWindows, cutWalkThroughWindowsReverse;
|
|
|
|
bool mouse_emulation;
|
|
|
|
unsigned int mouse_emulation_state;
|
|
|
|
WId mouse_emulation_window;
|
2004-01-09 20:35:21 +03:00
|
|
|
int block_focus;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
TabBox* tab_box;
|
|
|
|
PopupInfo* popupinfo;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2005-12-01 00:17:50 +03:00
|
|
|
QMenu *popup;
|
|
|
|
QMenu *advanced_popup;
|
|
|
|
QMenu *desk_popup;
|
2003-09-16 23:28:03 +04:00
|
|
|
int desk_popup_index;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2006-04-10 15:57:13 +04:00
|
|
|
KActionCollection *keys;
|
|
|
|
KActionCollection *client_keys;
|
2006-04-12 19:13:31 +04:00
|
|
|
QAction *mResizeOpAction;
|
|
|
|
QAction *mMoveOpAction;
|
|
|
|
QAction *mMaximizeOpAction;
|
|
|
|
QAction *mShadeOpAction;
|
|
|
|
QAction *mKeepAboveOpAction;
|
|
|
|
QAction *mKeepBelowOpAction;
|
|
|
|
QAction *mFullScreenOpAction;
|
|
|
|
QAction *mNoBorderOpAction;
|
|
|
|
QAction *mMinimizeOpAction;
|
|
|
|
QAction *mCloseOpAction;
|
2005-02-02 21:57:21 +03:00
|
|
|
ShortcutDialog* client_keys_dialog;
|
2005-01-10 12:56:21 +03:00
|
|
|
Client* client_keys_client;
|
2006-04-10 15:57:13 +04:00
|
|
|
KActionCollection *disable_shortcuts_keys;
|
2005-08-02 17:25:20 +04:00
|
|
|
bool global_shortcuts_disabled;
|
|
|
|
bool global_shortcuts_disabled_for_client;
|
2005-01-10 12:56:21 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
WId root;
|
2000-05-26 17:54:50 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
PluginMgr *mgr;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
RootInfo *rootInfo;
|
|
|
|
QWidget* supportWindow;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// swallowing
|
|
|
|
QStringList doNotManageList;
|
2000-05-26 17:54:50 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// colormap handling
|
|
|
|
Colormap default_colormap;
|
|
|
|
Colormap installed_colormap;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// Timer to collect requests for 'reconfigure'
|
|
|
|
QTimer reconfigureTimer;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
QTimer updateToolWindowsTimer;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
static Workspace *_self;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
bool workspaceInit;
|
2000-05-05 03:12:29 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
KStartupInfo* startup;
|
2000-06-21 21:43:44 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
bool electric_have_borders;
|
|
|
|
int electric_current_border;
|
|
|
|
WId electric_top_border;
|
|
|
|
WId electric_bottom_border;
|
|
|
|
WId electric_left_border;
|
|
|
|
WId electric_right_border;
|
|
|
|
int electricLeft;
|
|
|
|
int electricRight;
|
|
|
|
int electricTop;
|
|
|
|
int electricBottom;
|
|
|
|
Time electric_time_first;
|
|
|
|
Time electric_time_last;
|
|
|
|
QPoint electric_push_point;
|
Preliminary support for avoiding covering clients such as kicker
which want to be permanently visible.
I've used an XAtom called '_NET_AVOID_SPEC'. This of course can change
if need be. I think it's correct according to the wm spec, but the
wm spec seems to be empty on gnome.org, so who knows.
Windows can choose to be avoided by setting an XTextProperty
with one value, which can be either 'N', 'S', 'E', or 'W', according
to which screen edge they are anchored to.
kwin then sets its 'clientArea' rect appropriately, so that (in
theory at least) clients will not enter this area in some circumstances,
such as when being mapped for the first time.
You can see that this actually works if you start lots of konsoles. They
don't appear over the panel. I don't know what happens if you move the
panel, but I presume things will be screwed up, because I haven't
looked at that yet.
If you maximise a window, it'll still fill the screen, because the
implementation of maximise in kwin/client.cpp doesn't take account
of the workspace's clientArea rect. This is easy to fix, but I've
been awake for too long, so I'll do it after 42 winks.
svn path=/trunk/kdebase/kwin/; revision=46772
2000-04-16 13:06:03 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
Qt::Orientation layoutOrientation;
|
|
|
|
int layoutX;
|
|
|
|
int layoutY;
|
2000-07-30 20:15:17 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
Placement *initPositioning;
|
2000-09-12 00:54:00 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
QRect* workarea; // array of workareas for virtual desktops
|
2004-02-17 20:34:00 +03:00
|
|
|
QRect** screenarea; // array of workareas per xinerama screen for all virtual desktops
|
2001-02-03 15:30:46 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
bool managing_topmenus;
|
|
|
|
KSelectionOwner* topmenu_selection;
|
|
|
|
KSelectionWatcher* topmenu_watcher;
|
|
|
|
ClientList topmenus; // doesn't own them
|
|
|
|
mutable int topmenu_height;
|
2003-11-12 12:47:13 +03:00
|
|
|
QWidget* topmenu_space;
|
2001-02-21 21:29:24 +03:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
int set_active_client_recursion;
|
|
|
|
int block_stacking_updates; // when >0, stacking updates are temporarily disabled
|
|
|
|
bool blocked_propagating_new_clients; // propagate also new clients after enabling stacking updates?
|
2004-02-02 17:17:01 +03:00
|
|
|
Window null_focus_window;
|
2004-02-10 12:24:57 +03:00
|
|
|
bool forced_global_mouse_grab;
|
2003-09-16 23:28:03 +04:00
|
|
|
friend class StackingUpdatesBlocker;
|
2006-09-19 16:20:19 +04:00
|
|
|
QTimer compositeTimer;
|
2006-10-24 22:31:33 +04:00
|
|
|
QTime lastCompositePaint;
|
2006-09-30 19:40:03 +04:00
|
|
|
QRegion damage_region;
|
2005-01-15 20:07:48 +03:00
|
|
|
QSlider *transSlider;
|
|
|
|
QPushButton *transButton;
|
2003-09-16 23:28:03 +04:00
|
|
|
};
|
2001-06-04 18:01:00 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// helper for Workspace::blockStackingUpdates() being called in pairs (true/false)
|
|
|
|
class StackingUpdatesBlocker
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
StackingUpdatesBlocker( Workspace* w )
|
|
|
|
: ws( w ) { ws->blockStackingUpdates( true ); }
|
|
|
|
~StackingUpdatesBlocker()
|
|
|
|
{ ws->blockStackingUpdates( false ); }
|
|
|
|
private:
|
|
|
|
Workspace* ws;
|
|
|
|
};
|
2001-06-19 00:18:32 +04:00
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
// NET WM Protocol handler class
|
2005-05-13 12:57:21 +04:00
|
|
|
class RootInfo : public NETRootInfo4
|
2003-09-16 23:28:03 +04:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
typedef KWinInternal::Client Client; // because of NET::Client
|
|
|
|
public:
|
|
|
|
RootInfo( Workspace* ws, Display *dpy, Window w, const char *name, unsigned long pr[], int pr_num, int scr= -1);
|
|
|
|
protected:
|
|
|
|
virtual void changeNumberOfDesktops(int n);
|
|
|
|
virtual void changeCurrentDesktop(int d);
|
|
|
|
// virtual void changeActiveWindow(Window w); the extended version is used
|
2003-12-18 15:16:30 +03:00
|
|
|
virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp, Window active_window);
|
2003-09-16 23:28:03 +04:00
|
|
|
virtual void closeWindow(Window w);
|
|
|
|
virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction);
|
2003-10-01 16:08:53 +04:00
|
|
|
virtual void moveResizeWindow(Window w, int flags, int x, int y, int width, int height );
|
2003-09-16 23:28:03 +04:00
|
|
|
virtual void gotPing(Window w, Time timestamp);
|
2004-04-16 13:43:53 +04:00
|
|
|
virtual void restackWindow(Window w, RequestSource source, Window above, int detail, Time timestamp);
|
2004-04-22 16:30:57 +04:00
|
|
|
virtual void gotTakeActivity(Window w, Time timestamp, long flags );
|
2005-05-13 12:57:21 +04:00
|
|
|
virtual void changeShowingDesktop( bool showing );
|
2003-09-16 23:28:03 +04:00
|
|
|
private:
|
|
|
|
Workspace* workspace;
|
|
|
|
};
|
2002-03-03 00:03:49 +03:00
|
|
|
|
1999-08-20 03:26:42 +04:00
|
|
|
|
2000-05-05 22:53:37 +04:00
|
|
|
inline WId Workspace::rootWin() const
|
2003-09-16 23:28:03 +04:00
|
|
|
{
|
2000-05-05 22:53:37 +04:00
|
|
|
return root;
|
2003-09-16 23:28:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline bool Workspace::initializing() const
|
|
|
|
{
|
|
|
|
return workspaceInit;
|
|
|
|
}
|
2000-05-05 22:53:37 +04:00
|
|
|
|
|
|
|
inline Client* Workspace::activeClient() const
|
2003-09-16 23:28:03 +04:00
|
|
|
{
|
2000-05-05 22:53:37 +04:00
|
|
|
return active_client;
|
2003-09-16 23:28:03 +04:00
|
|
|
}
|
2000-05-05 22:53:37 +04:00
|
|
|
|
2003-12-02 20:52:10 +03:00
|
|
|
inline Client* Workspace::mostRecentlyActivatedClient() const
|
|
|
|
{
|
|
|
|
return should_get_focus.count() > 0 ? should_get_focus.last() : active_client;
|
|
|
|
}
|
|
|
|
|
2000-05-05 22:53:37 +04:00
|
|
|
inline int Workspace::currentDesktop() const
|
2003-09-16 23:28:03 +04:00
|
|
|
{
|
2000-05-05 22:53:37 +04:00
|
|
|
return current_desktop;
|
2003-09-16 23:28:03 +04:00
|
|
|
}
|
2000-05-05 22:53:37 +04:00
|
|
|
|
|
|
|
inline int Workspace::numberOfDesktops() const
|
2003-09-16 23:28:03 +04:00
|
|
|
{
|
2000-05-05 22:53:37 +04:00
|
|
|
return number_of_desktops;
|
2003-09-16 23:28:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Workspace::addGroup( Group* group, allowed_t )
|
|
|
|
{
|
|
|
|
groups.append( group );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Workspace::removeGroup( Group* group, allowed_t )
|
|
|
|
{
|
2006-03-06 17:30:06 +03:00
|
|
|
groups.removeAll( group );
|
2003-09-16 23:28:03 +04:00
|
|
|
}
|
2000-05-05 22:53:37 +04:00
|
|
|
|
|
|
|
inline const ClientList& Workspace::stackingOrder() const
|
2003-09-16 23:28:03 +04:00
|
|
|
{
|
|
|
|
// TODO Q_ASSERT( block_stacking_updates == 0 );
|
2000-05-05 22:53:37 +04:00
|
|
|
return stacking_order;
|
2003-09-16 23:28:03 +04:00
|
|
|
}
|
2000-05-05 22:53:37 +04:00
|
|
|
|
2002-08-27 19:12:14 +04:00
|
|
|
inline void Workspace::showWindowMenu(QPoint pos, Client* cl)
|
2003-09-16 23:28:03 +04:00
|
|
|
{
|
2004-06-02 13:47:36 +04:00
|
|
|
showWindowMenu(QRect(pos, pos), cl);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Workspace::showWindowMenu(int x, int y, Client* cl)
|
|
|
|
{
|
|
|
|
showWindowMenu(QRect(QPoint(x, y), QPoint(x, y)), cl);
|
2003-09-16 23:28:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
void Workspace::setWasUserInteraction()
|
|
|
|
{
|
|
|
|
was_user_interaction = true;
|
|
|
|
}
|
|
|
|
|
2004-06-11 19:13:08 +04:00
|
|
|
inline
|
|
|
|
bool Workspace::wasUserInteraction() const
|
|
|
|
{
|
|
|
|
return was_user_interaction;
|
|
|
|
}
|
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
inline
|
|
|
|
bool Workspace::managingTopMenus() const
|
|
|
|
{
|
|
|
|
return managing_topmenus;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Workspace::sessionSaveStarted()
|
|
|
|
{
|
|
|
|
session_saving = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Workspace::sessionSaveDone()
|
|
|
|
{
|
|
|
|
session_saving = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool Workspace::sessionSaving() const
|
|
|
|
{
|
|
|
|
return session_saving;
|
|
|
|
}
|
|
|
|
|
2004-02-10 12:24:57 +03:00
|
|
|
inline bool Workspace::forcedGlobalMouseGrab() const
|
|
|
|
{
|
|
|
|
return forced_global_mouse_grab;
|
|
|
|
}
|
|
|
|
|
2005-05-13 12:57:21 +04:00
|
|
|
inline bool Workspace::showingDesktop() const
|
|
|
|
{
|
|
|
|
return showing_desktop;
|
|
|
|
}
|
|
|
|
|
2005-08-02 17:25:20 +04:00
|
|
|
inline bool Workspace::globalShortcutsDisabled() const
|
|
|
|
{
|
|
|
|
return global_shortcuts_disabled || global_shortcuts_disabled_for_client;
|
|
|
|
}
|
|
|
|
|
2003-09-16 23:28:03 +04:00
|
|
|
template< typename T >
|
|
|
|
inline Client* Workspace::findClient( T predicate )
|
|
|
|
{
|
2004-01-08 19:18:07 +03:00
|
|
|
if( Client* ret = findClientInList( clients, predicate ))
|
|
|
|
return ret;
|
|
|
|
if( Client* ret = findClientInList( desktops, predicate ))
|
|
|
|
return ret;
|
2003-09-16 23:28:03 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename T1, typename T2 >
|
|
|
|
inline void Workspace::forEachClient( T1 procedure, T2 predicate )
|
|
|
|
{
|
|
|
|
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
|
|
|
|
if ( predicate( const_cast< const Client* >( *it)))
|
|
|
|
procedure( *it );
|
|
|
|
for ( ClientList::ConstIterator it = desktops.begin(); it != desktops.end(); ++it)
|
|
|
|
if ( predicate( const_cast< const Client* >( *it)))
|
|
|
|
procedure( *it );
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename T >
|
|
|
|
inline void Workspace::forEachClient( T procedure )
|
|
|
|
{
|
|
|
|
return forEachClient( procedure, TruePredicate());
|
|
|
|
}
|
|
|
|
|
2006-09-19 16:20:19 +04:00
|
|
|
template< typename T >
|
|
|
|
inline Unmanaged* Workspace::findUnmanaged( T predicate )
|
|
|
|
{
|
|
|
|
return findUnmanagedInList( unmanaged, predicate );
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename T1, typename T2 >
|
|
|
|
inline void Workspace::forEachUnmanaged( T1 procedure, T2 predicate )
|
|
|
|
{
|
|
|
|
for ( UnmanagedList::ConstIterator it = unmanaged.begin(); it != unmanaged.end(); ++it)
|
|
|
|
if ( predicate( const_cast< const Unmanaged* >( *it)))
|
|
|
|
procedure( *it );
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename T >
|
|
|
|
inline void Workspace::forEachUnmanaged( T procedure )
|
|
|
|
{
|
|
|
|
return forEachUnmanaged( procedure, TruePredicate());
|
|
|
|
}
|
|
|
|
|
|
|
|
KWIN_COMPARE_PREDICATE( ClientMatchPredicate, Client, const Client*, cl == value );
|
2003-09-16 23:28:03 +04:00
|
|
|
inline bool Workspace::hasClient( const Client* c )
|
|
|
|
{
|
|
|
|
return findClient( ClientMatchPredicate( c ));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
2000-06-28 17:20:42 +04:00
|
|
|
|
1999-08-20 03:26:42 +04:00
|
|
|
#endif
|