2000-03-24 22:23:02 +00:00
|
|
|
/*****************************************************************
|
2003-09-16 19:28:03 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2000-04-06 18:29:04 +00:00
|
|
|
|
2000-03-24 22:23:02 +00:00
|
|
|
Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org>
|
2003-09-16 19:28:03 +00: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-24 22:23:02 +00:00
|
|
|
******************************************************************/
|
2003-09-16 19:28:03 +00:00
|
|
|
|
2002-07-26 20:30:36 +00:00
|
|
|
#ifndef KWIN_WORKSPACE_H
|
|
|
|
#define KWIN_WORKSPACE_H
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2001-01-25 19:17:17 +00:00
|
|
|
#include <qtimer.h>
|
2001-12-29 04:19:24 +00:00
|
|
|
#include <kshortcut.h>
|
2002-02-28 00:43:23 +00:00
|
|
|
#include <qcursor.h>
|
2003-09-16 19:28:03 +00:00
|
|
|
#include <netwm.h>
|
|
|
|
|
|
|
|
#include "KWinInterface.h"
|
|
|
|
#include "utils.h"
|
|
|
|
#include "kdecoration.h"
|
2003-09-19 11:07:46 +00:00
|
|
|
#include "sm.h"
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2000-06-08 17:05:51 +00:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
class QPopupMenu;
|
2001-02-20 01:20:38 +00:00
|
|
|
class KConfig;
|
|
|
|
class KGlobalAccel;
|
2003-09-16 19:28:03 +00:00
|
|
|
class KStartupInfo;
|
|
|
|
class KStartupInfoData;
|
2001-02-20 01:20:38 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
namespace KWinInternal
|
|
|
|
{
|
2003-04-09 14:20:55 +00:00
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
class Client;
|
|
|
|
class TabBox;
|
2002-04-01 02:54:00 +00:00
|
|
|
class PopupInfo;
|
2000-06-08 17:05:51 +00:00
|
|
|
class RootInfo;
|
2001-02-20 01:20:38 +00:00
|
|
|
class PluginMgr;
|
2003-09-16 19:28:03 +00:00
|
|
|
class Placement;
|
1999-11-14 06:34:28 +00:00
|
|
|
|
2000-06-28 07:51:45 +00:00
|
|
|
class SystemTrayWindow
|
2003-09-16 19:28:03 +00: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 06:34:28 +00:00
|
|
|
|
2000-06-28 07:51:45 +00:00
|
|
|
typedef QValueList<SystemTrayWindow> SystemTrayWindowList;
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2000-03-24 22:23:02 +00:00
|
|
|
struct SessionInfo
|
2003-09-16 19:28:03 +00:00
|
|
|
{
|
2000-03-24 22:23:02 +00:00
|
|
|
QCString sessionId;
|
|
|
|
QCString windowRole;
|
2001-03-19 15:35:07 +00:00
|
|
|
QCString wmCommand;
|
|
|
|
QCString wmClientMachine;
|
|
|
|
QCString resourceName;
|
2001-01-14 20:16:04 +00:00
|
|
|
QCString resourceClass;
|
|
|
|
|
2000-08-30 14:27:30 +00:00
|
|
|
QRect geometry;
|
|
|
|
QRect restore;
|
2003-09-16 19:28:03 +00:00
|
|
|
QRect fsrestore;
|
|
|
|
int maximized;
|
|
|
|
int fullscreen;
|
2000-03-24 22:23:02 +00:00
|
|
|
int desktop;
|
2003-09-16 19:28:03 +00:00
|
|
|
bool minimized;
|
|
|
|
bool onAllDesktops;
|
2000-08-30 14:27:30 +00:00
|
|
|
bool shaded;
|
2003-09-16 19:28:03 +00:00
|
|
|
bool keepAbove;
|
|
|
|
bool keepBelow;
|
2001-03-12 21:32:13 +00:00
|
|
|
bool skipTaskbar;
|
2001-05-02 20:37:30 +00:00
|
|
|
bool skipPager;
|
2003-09-16 19:28:03 +00:00
|
|
|
bool userNoBorder;
|
2002-10-24 16:22:15 +00:00
|
|
|
NET::WindowType windowType;
|
2003-09-16 19:28:03 +00:00
|
|
|
bool active; // means 'was active in the saved session', not used otherwise
|
2002-08-28 15:17:31 +00:00
|
|
|
};
|
2001-04-22 06:51:07 +00:00
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
class Workspace : public QObject, virtual public KWinInterface, public KDecorationDefines
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
Workspace( bool restore = FALSE );
|
|
|
|
virtual ~Workspace();
|
1999-11-07 08:46:36 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
static Workspace * self() { return _self; }
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
virtual bool workspaceEvent( XEvent * );
|
2000-05-26 13:54:50 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
KDecoration* createDecoration( KDecorationBridge* bridge );
|
2001-06-03 09:04:03 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
bool hasClient( const Client * );
|
2001-06-03 09:30:19 +00:00
|
|
|
|
2003-09-16 19:28:03 +00: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 );
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
Group* findGroup( Window leader );
|
|
|
|
void addGroup( Group* group, allowed_t );
|
|
|
|
void removeGroup( Group* group, allowed_t );
|
2001-03-14 09:21:16 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
QRect geometry() const;
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
enum clientAreaOption { PlacementArea, MovementArea, MaximizeArea };
|
2000-05-17 23:02:42 +00:00
|
|
|
|
2000-09-23 14:48:02 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// default is MaximizeArea
|
|
|
|
QRect clientArea(clientAreaOption, const QPoint& p, int desktop) const;
|
|
|
|
QRect clientArea(const QPoint& p, int desktop) const;
|
|
|
|
// KDE4 remove the following 3 methods
|
|
|
|
inline QRect clientArea(clientAreaOption opt) const { return clientArea(opt, QCursor::pos()); }
|
|
|
|
QRect clientArea(clientAreaOption, const QPoint& p) const;
|
|
|
|
QRect clientArea(const QPoint& p) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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;
|
|
|
|
|
|
|
|
void setActiveClient( Client*, allowed_t );
|
|
|
|
void activateClient( Client*, bool force = FALSE );
|
|
|
|
void requestFocus( Client* c, bool force = FALSE );
|
|
|
|
bool allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false,
|
|
|
|
bool session_active = false );
|
|
|
|
void restoreFocus();
|
|
|
|
void gotFocusIn( const Client* );
|
|
|
|
bool fakeRequestedActivity( Client* c );
|
|
|
|
void unfakeActivity( Client* c );
|
|
|
|
|
|
|
|
void updateColormap();
|
|
|
|
|
|
|
|
void setFocusChangeEnabled(bool b) { focus_change = b; } // KDE 3.0: No longer used
|
|
|
|
bool focusChangeEnabled() { return focus_change; } // KDE 3.0: No longer used
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the client c is being moved around by the user.
|
|
|
|
*/
|
|
|
|
void setClientIsMoving( Client *c );
|
|
|
|
|
|
|
|
void place(Client *c);
|
|
|
|
void placeSmart( Client* c );
|
|
|
|
|
|
|
|
QPoint adjustClientPosition( Client* c, QPoint pos );
|
|
|
|
void raiseClient( Client* c );
|
|
|
|
void lowerClient( Client* c );
|
|
|
|
void restackClientUnderActive( Client* );
|
|
|
|
void updateClientLayer( Client* c );
|
|
|
|
void raiseOrLowerClient( Client * );
|
|
|
|
void reconfigure();
|
|
|
|
|
|
|
|
void clientHidden( Client* );
|
|
|
|
void clientAttentionChanged( Client* c, bool set );
|
|
|
|
|
|
|
|
void clientMoved(const QPoint &pos, unsigned long time);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
Client* topClientOnDesktop( int desktop ) const;
|
|
|
|
Client* findDesktop( bool topmost, int desktop ) const;
|
|
|
|
void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// KDE4 remove me - and it's also in the DCOP interface :(
|
|
|
|
void showWindowMenuAt( unsigned long id, int x, int y );
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
/**
|
|
|
|
* Shows the menu operations menu for the client
|
|
|
|
* and makes it active if it's not already.
|
|
|
|
*/
|
|
|
|
void showWindowMenu( int x, int y, Client* cl );
|
|
|
|
void showWindowMenu( QPoint pos, Client* cl );
|
2000-09-11 20:54:00 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void updateMinimizedOfTransients( Client* );
|
|
|
|
void updateOnAllDesktopsOfTransients( Client* );
|
|
|
|
void checkTransients( Window w );
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void performWindowOperation( Client* c, WindowOperation op );
|
2001-08-27 23:56:15 +00:00
|
|
|
|
2003-09-19 11:07:46 +00:00
|
|
|
void storeSession( KConfig* config, SMSavePhase phase );
|
2000-06-02 00:20:41 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
SessionInfo* takeSessionInfo( Client* );
|
2002-06-29 06:31:33 +00:00
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// dcop interface
|
|
|
|
void cascadeDesktop();
|
|
|
|
void unclutterDesktop();
|
|
|
|
void doNotManage(QString);
|
|
|
|
bool setCurrentDesktop( int new_desktop );
|
|
|
|
void nextDesktop();
|
|
|
|
void previousDesktop();
|
|
|
|
void circulateDesktopApplications();
|
2001-06-18 20:18:32 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
QString desktopName( int desk ) const;
|
|
|
|
void setDesktopLayout(int o, int x, int y);
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
bool isNotManaged( const QString& title ); // ### setter or getter ?
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void sendPingToWindow( Window w, Time timestamp ); // called from Client::pingWindow()
|
1999-11-07 01:43:06 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// only called from Client::destroyClient() or Client::releaseWindow()
|
|
|
|
void removeClient( Client*, allowed_t );
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
bool checkStartupNotification( const Client* c, KStartupInfoData& data );
|
2000-07-11 11:41:52 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void focusToNull(); // SELI public?
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void sessionSaveStarted();
|
|
|
|
void sessionSaveDone();
|
|
|
|
void setWasUserInteraction();
|
|
|
|
bool sessionSaving() const;
|
2000-06-23 18:56:59 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
bool managingTopMenus() const;
|
|
|
|
int topMenuHeight() const;
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00: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-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
public slots:
|
|
|
|
void refresh();
|
|
|
|
// keybindings
|
|
|
|
void slotSwitchDesktopNext();
|
|
|
|
void slotSwitchDesktopPrevious();
|
|
|
|
void slotSwitchDesktopRight();
|
|
|
|
void slotSwitchDesktopLeft();
|
|
|
|
void slotSwitchDesktopUp();
|
|
|
|
void slotSwitchDesktopDown();
|
|
|
|
|
|
|
|
void slotSwitchToDesktop( int );
|
|
|
|
//void slotSwitchToWindow( int );
|
|
|
|
void slotWindowToDesktop( int );
|
|
|
|
//void slotWindowToListPosition( int );
|
1999-11-25 16:38:11 +00:00
|
|
|
|
2003-09-16 19:28:03 +00: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 10:57:28 +00:00
|
|
|
void slotWindowNoBorder();
|
2003-09-16 19:28:03 +00:00
|
|
|
|
|
|
|
void slotWindowToNextDesktop();
|
|
|
|
void slotWindowToPreviousDesktop();
|
|
|
|
|
|
|
|
void slotMouseEmulation();
|
|
|
|
|
|
|
|
void slotSettingsChanged( int category );
|
|
|
|
|
|
|
|
void slotReconfigure();
|
|
|
|
|
|
|
|
void slotKillWindow();
|
|
|
|
|
|
|
|
void slotGrabWindow();
|
|
|
|
void slotGrabDesktop();
|
|
|
|
|
|
|
|
void updateClientArea();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void desktopPopupAboutToShow();
|
|
|
|
void clientPopupAboutToShow();
|
|
|
|
void sendToDesktop( int );
|
|
|
|
void clientPopupActivated( int );
|
|
|
|
void configureWM();
|
|
|
|
void desktopResized();
|
|
|
|
void slotUpdateToolWindows();
|
|
|
|
void lostTopMenuSelection();
|
|
|
|
void lostTopMenuOwner();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool keyPressMouseEmulation( XKeyEvent& ev );
|
|
|
|
bool netCheck( XEvent* e );
|
|
|
|
|
|
|
|
private:
|
|
|
|
void init();
|
|
|
|
void initShortcuts();
|
|
|
|
void readShortcuts();
|
|
|
|
void initDesktopPopup();
|
|
|
|
void updateXTime();
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
void updateStackingOrder( bool propagate_new_clients = false );
|
|
|
|
void propagateClients( bool propagate_new_clients ); // called only from updateStackingOrder
|
|
|
|
ClientList constrainedStackingOrder();
|
2003-09-25 12:17:35 +00:00
|
|
|
bool keepTransientAbove( const Client* mainwindow, const Client* transient );
|
2003-09-16 19:28:03 +00:00
|
|
|
void blockStackingUpdates( bool block );
|
|
|
|
void updateCurrentTopMenu();
|
|
|
|
void updateToolWindows( bool also_hide );
|
|
|
|
|
|
|
|
// this is the right way to create a new client
|
|
|
|
Client* createClient( Window w, bool is_mapped );
|
|
|
|
void addClient( Client* c, allowed_t );
|
|
|
|
|
|
|
|
void randomPlacement(Client* c);
|
|
|
|
void smartPlacement(Client* c);
|
|
|
|
void cascadePlacement(Client* c, bool re_init = false);
|
|
|
|
|
|
|
|
bool addSystemTrayWin( WId w );
|
|
|
|
bool removeSystemTrayWin( WId w );
|
|
|
|
void propagateSystemTrayWins();
|
|
|
|
SystemTrayWindow findSystemTrayWin( WId w );
|
2002-08-22 17:16:47 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// desktop names and number of desktops
|
|
|
|
void loadDesktopSettings();
|
|
|
|
void saveDesktopSettings();
|
1999-12-06 00:43:55 +00:00
|
|
|
|
2003-09-16 19:28:03 +00: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 06:34:28 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void tabBoxKeyPress( const KKeyNative& keyX );
|
|
|
|
void tabBoxKeyRelease( const XKeyEvent& ev );
|
1999-11-29 02:06:41 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// electric borders
|
|
|
|
void createBorderWindows();
|
|
|
|
void destroyBorderWindows();
|
|
|
|
void electricBorder(XEvent * e);
|
|
|
|
void raiseElectricBorders();
|
2000-04-06 18:29:04 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// ------------------
|
2000-05-26 13:54:50 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void calcDesktopLayout(int &x, int &y);
|
2000-05-26 13:54:50 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
QPopupMenu* clientPopup();
|
2000-06-21 17:43:44 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void updateClientArea( bool force );
|
2000-07-30 16:15:17 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
SystemTrayWindowList systemTrayWins;
|
2000-07-30 16:15:17 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
int current_desktop;
|
|
|
|
int number_of_desktops;
|
|
|
|
QMemArray<int> desktop_focus_chain;
|
1999-11-29 02:06:41 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
Client* popup_client;
|
2001-06-10 04:10:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void loadSessionInfo();
|
1999-12-06 00:43:55 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
QWidget* desktop_widget;
|
2000-07-14 19:56:47 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
QPtrList<SessionInfo> session;
|
|
|
|
QPtrList<SessionInfo> fakeSession;
|
|
|
|
void loadFakeSessionInfo();
|
|
|
|
void storeFakeSessionInfo( Client* c );
|
|
|
|
void writeFakeSessionInfo();
|
|
|
|
static const char* windowTypeToTxt( NET::WindowType type );
|
|
|
|
static NET::WindowType txtToWindowType( const char* txt );
|
|
|
|
static bool sessionInfoWindowTypeMatch( Client* c, SessionInfo* info );
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
Client* active_client;
|
|
|
|
Client* last_active_client;
|
|
|
|
Client* most_recently_raised; // used _only_ by raiseOrLowerClient()
|
|
|
|
Client* movingClient;
|
2001-08-27 05:42:32 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
ClientList clients;
|
|
|
|
ClientList desktops;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
ClientList unconstrained_stacking_order;
|
|
|
|
ClientList stacking_order;
|
|
|
|
ClientList focus_chain;
|
|
|
|
ClientList should_get_focus; // last is most recent
|
|
|
|
ClientList attention_chain;
|
2001-11-29 23:59:54 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
GroupList groups;
|
2002-12-27 22:57:06 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
bool was_user_interaction;
|
|
|
|
bool session_saving;
|
2003-09-19 11:07:46 +00:00
|
|
|
int session_active_client;
|
|
|
|
int session_desktop;
|
2001-11-29 23:59:54 +00:00
|
|
|
|
2003-09-16 19:28:03 +00: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;
|
|
|
|
bool focus_change;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
TabBox* tab_box;
|
|
|
|
PopupInfo* popupinfo;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
QPopupMenu *popup;
|
2003-09-26 21:32:49 +00:00
|
|
|
QPopupMenu *options_popup;
|
2003-09-16 19:28:03 +00:00
|
|
|
QPopupMenu *desk_popup;
|
|
|
|
int desk_popup_index;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
KGlobalAccel *keys;
|
|
|
|
WId root;
|
2000-05-26 13:54:50 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
PluginMgr *mgr;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
RootInfo *rootInfo;
|
|
|
|
QWidget* supportWindow;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// swallowing
|
|
|
|
QStringList doNotManageList;
|
2000-05-26 13:54:50 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// colormap handling
|
|
|
|
Colormap default_colormap;
|
|
|
|
Colormap installed_colormap;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// Timer to collect requests for 'reconfigure'
|
|
|
|
QTimer reconfigureTimer;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
QTimer updateToolWindowsTimer;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
static Workspace *_self;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
bool workspaceInit;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
KStartupInfo* startup;
|
2000-06-21 17:43:44 +00:00
|
|
|
|
2003-09-16 19:28:03 +00: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 09:06:03 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
Qt::Orientation layoutOrientation;
|
|
|
|
int layoutX;
|
|
|
|
int layoutY;
|
2000-07-30 16:15:17 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
Placement *initPositioning;
|
2000-09-11 20:54:00 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
QRect* workarea; // array of workareas for virtual desktops
|
2001-02-03 12:30:46 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
bool managing_topmenus;
|
|
|
|
KSelectionOwner* topmenu_selection;
|
|
|
|
KSelectionWatcher* topmenu_watcher;
|
|
|
|
ClientList topmenus; // doesn't own them
|
|
|
|
mutable int topmenu_height;
|
2001-02-21 18:29:24 +00:00
|
|
|
|
2003-09-16 19:28:03 +00: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?
|
|
|
|
friend class StackingUpdatesBlocker;
|
|
|
|
};
|
2001-06-04 14:01:00 +00:00
|
|
|
|
2003-09-16 19:28:03 +00: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-18 20:18:32 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// NET WM Protocol handler class
|
|
|
|
class RootInfo : public NETRootInfo2
|
|
|
|
{
|
|
|
|
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
|
|
|
|
virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp);
|
|
|
|
virtual void closeWindow(Window w);
|
|
|
|
virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction);
|
|
|
|
virtual void gotPing(Window w, Time timestamp);
|
|
|
|
private:
|
|
|
|
Workspace* workspace;
|
|
|
|
};
|
2002-03-02 21:03:49 +00:00
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2000-05-05 18:53:37 +00:00
|
|
|
inline WId Workspace::rootWin() const
|
2003-09-16 19:28:03 +00:00
|
|
|
{
|
2000-05-05 18:53:37 +00:00
|
|
|
return root;
|
2003-09-16 19:28:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline bool Workspace::initializing() const
|
|
|
|
{
|
|
|
|
return workspaceInit;
|
|
|
|
}
|
2000-05-05 18:53:37 +00:00
|
|
|
|
|
|
|
inline Client* Workspace::activeClient() const
|
2003-09-16 19:28:03 +00:00
|
|
|
{
|
2000-05-05 18:53:37 +00:00
|
|
|
return active_client;
|
2003-09-16 19:28:03 +00:00
|
|
|
}
|
2000-05-05 18:53:37 +00:00
|
|
|
|
|
|
|
inline int Workspace::currentDesktop() const
|
2003-09-16 19:28:03 +00:00
|
|
|
{
|
2000-05-05 18:53:37 +00:00
|
|
|
return current_desktop;
|
2003-09-16 19:28:03 +00:00
|
|
|
}
|
2000-05-05 18:53:37 +00:00
|
|
|
|
|
|
|
inline int Workspace::numberOfDesktops() const
|
2003-09-16 19:28:03 +00:00
|
|
|
{
|
2000-05-05 18:53:37 +00:00
|
|
|
return number_of_desktops;
|
2003-09-16 19:28:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void Workspace::addGroup( Group* group, allowed_t )
|
|
|
|
{
|
|
|
|
groups.append( group );
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void Workspace::removeGroup( Group* group, allowed_t )
|
|
|
|
{
|
|
|
|
groups.remove( group );
|
|
|
|
}
|
2000-05-05 18:53:37 +00:00
|
|
|
|
|
|
|
inline const ClientList& Workspace::stackingOrder() const
|
2003-09-16 19:28:03 +00:00
|
|
|
{
|
|
|
|
// TODO Q_ASSERT( block_stacking_updates == 0 );
|
2000-05-05 18:53:37 +00:00
|
|
|
return stacking_order;
|
2003-09-16 19:28:03 +00:00
|
|
|
}
|
2000-05-05 18:53:37 +00:00
|
|
|
|
2002-08-27 15:12:14 +00:00
|
|
|
inline void Workspace::showWindowMenu(QPoint pos, Client* cl)
|
2003-09-16 19:28:03 +00:00
|
|
|
{
|
2002-08-27 15:12:14 +00:00
|
|
|
showWindowMenu(pos.x(), pos.y(), cl);
|
2003-09-16 19:28:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
void Workspace::setWasUserInteraction()
|
|
|
|
{
|
|
|
|
was_user_interaction = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
template< typename T >
|
|
|
|
inline Client* Workspace::findClient( T predicate )
|
|
|
|
{
|
|
|
|
for ( ClientList::ConstIterator it = clients.begin(); it != clients.end(); ++it)
|
|
|
|
{
|
|
|
|
if ( predicate( const_cast< const Client* >( *it)))
|
|
|
|
return *it;
|
|
|
|
}
|
|
|
|
for ( ClientList::ConstIterator it = desktops.begin(); it != desktops.end(); ++it)
|
|
|
|
{
|
|
|
|
if ( predicate( const_cast< const Client* >( *it)))
|
|
|
|
return *it;
|
|
|
|
}
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
|
|
|
KWIN_COMPARE_PREDICATE( ClientMatchPredicate, const Client*, cl == value );
|
|
|
|
inline bool Workspace::hasClient( const Client* c )
|
|
|
|
{
|
|
|
|
return findClient( ClientMatchPredicate( c ));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
2000-06-28 13:20:42 +00:00
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
#endif
|