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
|
|
|
|
2006-05-11 08:04:23 +00:00
|
|
|
#include <QTimer>
|
2006-05-13 16:33:18 +00:00
|
|
|
#include <QVector>
|
2001-12-29 04:19:24 +00:00
|
|
|
#include <kshortcut.h>
|
2006-05-13 16:33:18 +00:00
|
|
|
#include <QCursor>
|
2003-09-16 19:28:03 +00:00
|
|
|
#include <netwm.h>
|
2004-06-11 15:10:09 +00:00
|
|
|
#include <kxmessages.h>
|
2007-01-15 18:03:04 +00:00
|
|
|
#include <qdatetime.h>
|
|
|
|
#include <kmanagerselection.h>
|
2003-09-16 19:28:03 +00:00
|
|
|
|
|
|
|
#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>
|
|
|
|
|
2005-11-30 21:17:50 +00:00
|
|
|
class QMenu;
|
2001-02-20 01:20:38 +00:00
|
|
|
class KConfig;
|
2006-04-10 11:57:13 +00:00
|
|
|
class KActionCollection;
|
2005-01-10 09:56:21 +00:00
|
|
|
class KShortcutDialog;
|
2003-09-16 19:28:03 +00:00
|
|
|
class KStartupInfo;
|
2004-05-26 09:24:14 +00:00
|
|
|
class KStartupInfoId;
|
2003-09-16 19:28:03 +00:00
|
|
|
class KStartupInfoData;
|
2005-01-15 17:07:48 +00:00
|
|
|
class QSlider;
|
|
|
|
class QPushButton;
|
|
|
|
class KProcess;
|
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;
|
2004-06-18 08:57:42 +00:00
|
|
|
class Rules;
|
2004-05-28 13:51:11 +00:00
|
|
|
class WindowRules;
|
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
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
typedef QList<SystemTrayWindow> SystemTrayWindowList;
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2006-06-07 09:05:46 +00:00
|
|
|
class Workspace : public QObject, public KDecorationDefines
|
2003-09-16 19:28:03 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2006-02-19 01:33:48 +00:00
|
|
|
Workspace( bool restore = false );
|
2003-09-16 19:28:03 +00:00
|
|
|
virtual ~Workspace();
|
1999-11-07 08:46:36 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
static Workspace * self() { return _self; }
|
2007-01-15 18:03:04 +00:00
|
|
|
|
2003-10-02 12:33:51 +00:00
|
|
|
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 );
|
2007-01-15 18:03:04 +00: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-19 23:26:42 +00:00
|
|
|
|
2003-10-10 12:58:38 +00:00
|
|
|
QRect clientArea( clientAreaOption, const QPoint& p, int desktop ) const;
|
|
|
|
QRect clientArea( clientAreaOption, const Client* c ) const;
|
2003-09-16 19:28:03 +00: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 17:52:10 +00: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 19:28:03 +00:00
|
|
|
|
2006-02-19 01:33:48 +00:00
|
|
|
void activateClient( Client*, bool force = false );
|
|
|
|
void requestFocus( Client* c, bool force = false );
|
2004-04-16 10:23:42 +00:00
|
|
|
void takeActivity( Client* c, int flags, bool handled ); // flags are ActivityFlags
|
2004-04-22 12:30:57 +00:00
|
|
|
void handleTakeActivity( Client* c, Time timestamp, int flags ); // flags are ActivityFlags
|
2004-06-11 15:13:08 +00:00
|
|
|
bool allowClientActivation( const Client* c, Time time = -1U, bool focus_in = false );
|
2003-09-16 19:28:03 +00:00
|
|
|
void restoreFocus();
|
|
|
|
void gotFocusIn( const Client* );
|
2004-04-16 10:23:42 +00:00
|
|
|
void setShouldGetFocus( Client* );
|
2003-09-16 19:28:03 +00:00
|
|
|
bool fakeRequestedActivity( Client* c );
|
|
|
|
void unfakeActivity( Client* c );
|
2004-11-22 11:34:09 +00:00
|
|
|
bool activateNextClient( Client* c );
|
2004-01-09 17:35:21 +00:00
|
|
|
bool focusChangeEnabled() { return block_focus == 0; }
|
2003-09-16 19:28:03 +00:00
|
|
|
|
|
|
|
void updateColormap();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates that the client c is being moved around by the user.
|
|
|
|
*/
|
|
|
|
void setClientIsMoving( Client *c );
|
|
|
|
|
2004-01-10 15:13:23 +00:00
|
|
|
void place( Client *c, QRect& area );
|
|
|
|
void placeSmart( Client* c, const QRect& area );
|
2003-09-16 19:28:03 +00:00
|
|
|
|
|
|
|
QPoint adjustClientPosition( Client* c, QPoint pos );
|
2004-06-03 12:36:57 +00:00
|
|
|
QRect adjustClientSize( Client* c, QRect moveResizeGeom, int mode );
|
2003-09-16 19:28:03 +00:00
|
|
|
void raiseClient( Client* c );
|
|
|
|
void lowerClient( Client* c );
|
2004-04-16 09:43:53 +00:00
|
|
|
void raiseClientRequest( Client* c, NET::RequestSource src, Time timestamp );
|
|
|
|
void lowerClientRequest( Client* c, NET::RequestSource src, Time timestamp );
|
2003-09-16 19:28:03 +00:00
|
|
|
void restackClientUnderActive( Client* );
|
|
|
|
void updateClientLayer( Client* c );
|
|
|
|
void raiseOrLowerClient( Client * );
|
2006-04-20 14:57:10 +00:00
|
|
|
void restoreSessionStackingOrder( Client* c );
|
2003-09-16 19:28:03 +00:00
|
|
|
void reconfigure();
|
|
|
|
|
|
|
|
void clientHidden( Client* );
|
|
|
|
void clientAttentionChanged( Client* c, bool set );
|
|
|
|
|
2003-10-10 12:48:09 +00:00
|
|
|
void clientMoved(const QPoint &pos, Time time);
|
2003-09-16 19:28:03 +00: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 09:24:57 +00:00
|
|
|
void closeTabBox();
|
2003-09-16 19:28:03 +00: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;
|
|
|
|
|
2007-01-15 18:03:04 +00:00
|
|
|
Client* topClientOnDesktop( int desktop, bool unconstrained = false ) const;
|
2003-09-16 19:28:03 +00:00
|
|
|
Client* findDesktop( bool topmost, int desktop ) const;
|
|
|
|
void sendClientToDesktop( Client* c, int desktop, bool dont_activate );
|
2005-05-06 15:20:49 +00:00
|
|
|
void windowToPreviousDesktop( Client* c );
|
|
|
|
void windowToNextDesktop( Client* c );
|
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
|
|
|
/**
|
2004-06-02 09:47:36 +00:00
|
|
|
* Shows the menu operations menu for the client and makes it active if
|
|
|
|
* it's not already.
|
2003-09-16 19:28:03 +00:00
|
|
|
*/
|
2004-06-02 09:47:36 +00:00
|
|
|
void showWindowMenu( const QRect &pos, Client* cl );
|
|
|
|
/**
|
|
|
|
* Backwards compatibility.
|
|
|
|
*/
|
2003-09-16 19:28:03 +00:00
|
|
|
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* );
|
2004-06-18 08:57:42 +00:00
|
|
|
WindowRules findWindowRules( const Client*, bool );
|
2004-06-11 15:12:29 +00:00
|
|
|
void rulesUpdated();
|
2005-06-07 15:31:15 +00:00
|
|
|
void discardUsedWindowRules( Client* c, bool withdraw );
|
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);
|
2005-05-13 08:57:21 +00:00
|
|
|
void setShowingDesktop( bool showing );
|
|
|
|
void resetShowingDesktop( bool keep_hidden );
|
|
|
|
bool showingDesktop() const;
|
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()
|
2004-04-22 12:30:57 +00:00
|
|
|
void sendTakeActivity( Client* c, Time timestamp, long flags ); // called from Client::takeActivity()
|
2006-09-11 08:25:29 +00:00
|
|
|
|
2007-01-15 18:03:04 +00:00
|
|
|
void removeClient( Client*, allowed_t ); // only called from Client::destroyClient() or Client::releaseWindow()
|
2004-04-16 10:23:42 +00: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-19 23:26:42 +00:00
|
|
|
|
2007-01-15 18:03:04 +00:00
|
|
|
void removeUnmanaged( Unmanaged*, allowed_t ); // only called from Unmanaged::release()
|
2007-01-22 22:51:30 +00:00
|
|
|
void removeDeleted( Deleted*, allowed_t );
|
|
|
|
void addDeleted( Deleted*, allowed_t );
|
2007-01-15 18:03:04 +00:00
|
|
|
|
2004-05-26 09:24:14 +00:00
|
|
|
bool checkStartupNotification( Window w, KStartupInfoId& id, KStartupInfoData& data );
|
2000-07-11 11:41:52 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void focusToNull(); // SELI public?
|
2006-04-11 14:52:27 +00:00
|
|
|
enum FocusChainChange { FocusChainMakeFirst, FocusChainMakeLast, FocusChainUpdate };
|
|
|
|
void updateFocusChains( Client* c, FocusChainChange change );
|
2006-09-11 08:25:29 +00:00
|
|
|
|
2004-02-10 09:24:57 +00:00
|
|
|
bool forcedGlobalMouseGrab() const;
|
2005-01-10 09:56:21 +00:00
|
|
|
void clientShortcutUpdated( Client* c );
|
2005-01-17 15:53:14 +00:00
|
|
|
bool shortcutAvailable( const KShortcut& cut, Client* ignore = NULL ) const;
|
2005-08-02 13:25:20 +00:00
|
|
|
bool globalShortcutsDisabled() const;
|
|
|
|
void disableGlobalShortcuts( bool disable );
|
|
|
|
void disableGlobalShortcutsForClient( bool disable );
|
1999-08-19 23:26:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void sessionSaveStarted();
|
|
|
|
void sessionSaveDone();
|
|
|
|
void setWasUserInteraction();
|
2004-06-11 15:13:08 +00:00
|
|
|
bool wasUserInteraction() const;
|
2003-09-16 19:28:03 +00:00
|
|
|
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;
|
2004-07-27 13:13:52 +00:00
|
|
|
void updateCurrentTopMenu();
|
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
|
|
|
|
2004-03-18 13:18:41 +00:00
|
|
|
static QStringList configModules(bool controlCenter);
|
|
|
|
|
2004-05-28 08:53:44 +00:00
|
|
|
void cancelDelayFocus();
|
|
|
|
void requestDelayFocus( Client* );
|
2006-09-11 08:25:29 +00:00
|
|
|
|
2005-01-15 17:07:48 +00:00
|
|
|
void toggleTopDockShadows(bool on);
|
2007-01-15 18:03:04 +00:00
|
|
|
|
|
|
|
void addDamage( const QRect& r );
|
|
|
|
void addDamage( int x, int y, int w, int h );
|
|
|
|
void addDamageFull();
|
|
|
|
// creates XComposite overlay window, cal initOverlay() afterwards
|
|
|
|
bool createOverlay();
|
|
|
|
// init overlay and the destination window in it
|
|
|
|
void setupOverlay( Window window );
|
|
|
|
// destroys XComposite overlay window
|
|
|
|
void destroyOverlay();
|
|
|
|
Window overlayWindow();
|
2004-05-28 08:53:44 +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 );
|
2006-09-30 15:47:41 +00: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 19:28:03 +00:00
|
|
|
//void slotSwitchToWindow( int );
|
|
|
|
void slotWindowToDesktop( int );
|
2006-09-30 15:47:41 +00: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 19:28:03 +00:00
|
|
|
//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();
|
2004-09-22 16:49:41 +00:00
|
|
|
void slotWindowToDesktopRight();
|
|
|
|
void slotWindowToDesktopLeft();
|
|
|
|
void slotWindowToDesktopUp();
|
|
|
|
void slotWindowToDesktopDown();
|
2003-09-16 19:28:03 +00:00
|
|
|
|
|
|
|
void slotMouseEmulation();
|
2005-08-02 13:25:20 +00:00
|
|
|
void slotDisableGlobalShortcuts();
|
2003-09-16 19:28:03 +00:00
|
|
|
|
|
|
|
void slotSettingsChanged( int category );
|
|
|
|
|
|
|
|
void slotReconfigure();
|
|
|
|
|
|
|
|
void slotKillWindow();
|
|
|
|
|
|
|
|
void slotGrabWindow();
|
|
|
|
void slotGrabDesktop();
|
|
|
|
|
2005-01-10 09:56:21 +00:00
|
|
|
void slotSetupWindowShortcut();
|
|
|
|
void setupWindowShortcutDone( bool );
|
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void updateClientArea();
|
2006-09-11 08:25:29 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
private slots:
|
|
|
|
void desktopPopupAboutToShow();
|
|
|
|
void clientPopupAboutToShow();
|
2006-04-12 15:13:31 +00:00
|
|
|
void slotSendToDesktop( QAction* );
|
|
|
|
void clientPopupActivated( QAction* );
|
2003-09-16 19:28:03 +00:00
|
|
|
void configureWM();
|
|
|
|
void desktopResized();
|
|
|
|
void slotUpdateToolWindows();
|
|
|
|
void lostTopMenuSelection();
|
|
|
|
void lostTopMenuOwner();
|
2004-05-28 08:53:44 +00:00
|
|
|
void delayFocus();
|
2004-06-11 15:10:09 +00:00
|
|
|
void gotTemporaryRulesMessage( const QString& );
|
|
|
|
void cleanupTemporaryRules();
|
2004-06-11 15:12:29 +00:00
|
|
|
void writeWindowRules();
|
2006-09-11 08:25:29 +00:00
|
|
|
void slotBlockShortcuts(int data);
|
2007-01-15 18:03:04 +00:00
|
|
|
void setPopupClientOpacity( QAction* action );
|
|
|
|
void setupCompositing();
|
|
|
|
void performCompositing();
|
|
|
|
void lostCMSelection();
|
2003-09-16 19:28:03 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool keyPressMouseEmulation( XKeyEvent& ev );
|
|
|
|
bool netCheck( XEvent* e );
|
|
|
|
|
|
|
|
private:
|
|
|
|
void init();
|
|
|
|
void initShortcuts();
|
|
|
|
void readShortcuts();
|
|
|
|
void initDesktopPopup();
|
2005-01-10 09:56:21 +00:00
|
|
|
void setupWindowShortcut( Client* c );
|
2003-09-16 19:28:03 +00: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 09:24:57 +00:00
|
|
|
bool establishTabBoxGrab();
|
|
|
|
void removeTabBoxGrab();
|
2004-09-22 16:49:41 +00:00
|
|
|
int desktopToRight( int desktop ) const;
|
|
|
|
int desktopToLeft( int desktop ) const;
|
|
|
|
int desktopUp( int desktop ) const;
|
|
|
|
int desktopDown( int desktop ) const;
|
2003-09-16 19:28:03 +00:00
|
|
|
|
|
|
|
void updateStackingOrder( bool propagate_new_clients = false );
|
|
|
|
void propagateClients( bool propagate_new_clients ); // called only from updateStackingOrder
|
|
|
|
ClientList constrainedStackingOrder();
|
2003-09-30 12:49:23 +00:00
|
|
|
void raiseClientWithinApplication( Client* c );
|
|
|
|
void lowerClientWithinApplication( Client* c );
|
2004-04-16 09:43:53 +00:00
|
|
|
bool allowFullClientRaising( const Client* c, Time timestamp );
|
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 );
|
2003-11-10 18:08:04 +00:00
|
|
|
void addTopMenu( Client* c );
|
|
|
|
void removeTopMenu( Client* c );
|
2003-11-12 09:47:13 +00:00
|
|
|
void setupTopMenuHandling();
|
2003-11-13 14:34:05 +00:00
|
|
|
void updateTopMenuGeometry( Client* c = NULL );
|
2003-09-16 19:28:03 +00:00
|
|
|
void updateToolWindows( bool also_hide );
|
|
|
|
|
|
|
|
// this is the right way to create a new client
|
2003-11-24 15:05:50 +00:00
|
|
|
Client* createClient( Window w, bool is_mapped );
|
2003-09-16 19:28:03 +00:00
|
|
|
void addClient( Client* c, allowed_t );
|
2007-01-15 18:03:04 +00:00
|
|
|
Unmanaged* createUnmanaged( Window w );
|
|
|
|
void addUnmanaged( Unmanaged* c, allowed_t );
|
2003-09-16 19:28:03 +00:00
|
|
|
|
2003-10-02 12:33:51 +00:00
|
|
|
Window findSpecialEventWindow( XEvent* e );
|
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void randomPlacement(Client* c);
|
|
|
|
void smartPlacement(Client* c);
|
|
|
|
void cascadePlacement(Client* c, bool re_init = false);
|
|
|
|
|
|
|
|
bool addSystemTrayWin( WId w );
|
2003-10-30 10:10:54 +00:00
|
|
|
bool removeSystemTrayWin( WId w, bool check );
|
2003-09-16 19:28:03 +00:00
|
|
|
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
|
|
|
|
2006-04-10 11:57:13 +00:00
|
|
|
void tabBoxKeyPress( int key );
|
2003-09-16 19:28:03 +00:00
|
|
|
void tabBoxKeyRelease( const XKeyEvent& ev );
|
1999-11-29 02:06:41 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// electric borders
|
2004-11-02 15:19:01 +00:00
|
|
|
void checkElectricBorders( bool force = false );
|
2003-09-16 19:28:03 +00:00
|
|
|
void createBorderWindows();
|
|
|
|
void destroyBorderWindows();
|
2004-11-09 15:38:33 +00:00
|
|
|
bool electricBorder(XEvent * e);
|
2003-09-16 19:28:03 +00:00
|
|
|
void raiseElectricBorders();
|
2000-04-06 18:29:04 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
// ------------------
|
2006-09-11 08:25:29 +00:00
|
|
|
|
2003-10-13 16:22:39 +00:00
|
|
|
void helperDialog( const QString& message, const Client* c );
|
2000-05-26 13:54:50 +00:00
|
|
|
|
2004-09-22 16:49:41 +00:00
|
|
|
void calcDesktopLayout(int &x, int &y) const;
|
2000-05-26 13:54:50 +00:00
|
|
|
|
2005-11-30 21:17:50 +00:00
|
|
|
QMenu* clientPopup();
|
2005-01-10 09:56:21 +00:00
|
|
|
void closeActivePopup();
|
2000-06-21 17:43:44 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
void updateClientArea( bool force );
|
2007-01-15 18:03:04 +00:00
|
|
|
|
|
|
|
void finishCompositing();
|
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;
|
2005-07-28 14:59:42 +00:00
|
|
|
QVector<int> desktop_focus_chain;
|
1999-11-29 02:06:41 +00:00
|
|
|
|
2005-01-10 09:56:21 +00:00
|
|
|
QWidget* active_popup;
|
|
|
|
Client* active_popup_client;
|
2001-06-10 04:10:42 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
QWidget* desktop_widget;
|
2000-07-14 19:56:47 +00:00
|
|
|
|
2004-05-28 13:51:11 +00:00
|
|
|
void loadSessionInfo();
|
|
|
|
void loadWindowRules();
|
2005-08-16 17:46:42 +00:00
|
|
|
void editWindowRules( Client* c, bool whole_app );
|
2004-05-28 13:51:11 +00:00
|
|
|
|
2005-07-28 14:59:42 +00:00
|
|
|
QList<SessionInfo*> session;
|
|
|
|
QList<Rules*> rules;
|
2004-06-11 15:10:09 +00:00
|
|
|
KXMessages temporaryRulesMessages;
|
2004-06-11 15:12:29 +00:00
|
|
|
QTimer rulesUpdatedTimer;
|
2003-09-16 19:28:03 +00:00
|
|
|
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;
|
2004-04-22 12:30:57 +00:00
|
|
|
Client* pending_take_activity;
|
2001-08-27 05:42:32 +00:00
|
|
|
|
2004-05-28 08:53:44 +00:00
|
|
|
// delay(ed) window focus timer and client
|
|
|
|
QTimer* delayFocusTimer;
|
|
|
|
Client* delayfocus_client;
|
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
ClientList clients;
|
|
|
|
ClientList desktops;
|
2007-01-15 18:03:04 +00:00
|
|
|
UnmanagedList unmanaged;
|
2007-01-22 22:51:30 +00:00
|
|
|
DeletedList deleted;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2007-01-15 18:03:04 +00:00
|
|
|
ClientList unconstrained_stacking_order;
|
|
|
|
ClientList stacking_order;
|
|
|
|
QVector< ClientList > focus_chain;
|
2006-04-11 14:14:38 +00:00
|
|
|
ClientList global_focus_chain; // this one is only for things like tabbox's MRU
|
2003-09-16 19:28:03 +00:00
|
|
|
ClientList should_get_focus; // last is most recent
|
|
|
|
ClientList attention_chain;
|
2006-09-11 08:25:29 +00:00
|
|
|
|
2005-05-13 08:57:21 +00:00
|
|
|
bool showing_desktop;
|
|
|
|
ClientList showing_desktop_clients;
|
|
|
|
int block_showing_desktop;
|
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;
|
2004-01-09 17:35:21 +00:00
|
|
|
int block_focus;
|
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
|
|
|
|
2005-11-30 21:17:50 +00:00
|
|
|
QMenu *popup;
|
|
|
|
QMenu *advanced_popup;
|
2007-01-15 18:03:04 +00:00
|
|
|
QMenu *trans_popup;
|
2005-11-30 21:17:50 +00:00
|
|
|
QMenu *desk_popup;
|
2003-09-16 19:28:03 +00:00
|
|
|
int desk_popup_index;
|
2000-05-04 23:12:29 +00:00
|
|
|
|
2006-04-10 11:57:13 +00:00
|
|
|
KActionCollection *keys;
|
|
|
|
KActionCollection *client_keys;
|
2006-04-12 15:13:31 +00:00
|
|
|
QAction *mResizeOpAction;
|
|
|
|
QAction *mMoveOpAction;
|
|
|
|
QAction *mMaximizeOpAction;
|
|
|
|
QAction *mShadeOpAction;
|
|
|
|
QAction *mKeepAboveOpAction;
|
|
|
|
QAction *mKeepBelowOpAction;
|
|
|
|
QAction *mFullScreenOpAction;
|
|
|
|
QAction *mNoBorderOpAction;
|
|
|
|
QAction *mMinimizeOpAction;
|
|
|
|
QAction *mCloseOpAction;
|
2005-02-02 18:57:21 +00:00
|
|
|
ShortcutDialog* client_keys_dialog;
|
2005-01-10 09:56:21 +00:00
|
|
|
Client* client_keys_client;
|
2006-04-10 11:57:13 +00:00
|
|
|
KActionCollection *disable_shortcuts_keys;
|
2005-08-02 13:25:20 +00:00
|
|
|
bool global_shortcuts_disabled;
|
|
|
|
bool global_shortcuts_disabled_for_client;
|
2005-01-10 09:56:21 +00:00
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
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
|
2004-02-17 17:34:00 +00:00
|
|
|
QRect** screenarea; // array of workareas per xinerama screen for all 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;
|
2003-11-12 09:47:13 +00:00
|
|
|
QWidget* topmenu_space;
|
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?
|
2004-02-02 14:17:01 +00:00
|
|
|
Window null_focus_window;
|
2004-02-10 09:24:57 +00:00
|
|
|
bool forced_global_mouse_grab;
|
2003-09-16 19:28:03 +00:00
|
|
|
friend class StackingUpdatesBlocker;
|
2006-11-08 15:08:20 +00:00
|
|
|
|
2007-01-15 18:03:04 +00:00
|
|
|
KSelectionOwner* cm_selection;
|
|
|
|
QTimer compositeTimer;
|
|
|
|
QTime lastCompositePaint;
|
|
|
|
int compositeRate;
|
|
|
|
QRegion damage_region;
|
|
|
|
Window overlay; // XComposite overlay window
|
2005-01-15 17:07:48 +00:00
|
|
|
QSlider *transSlider;
|
|
|
|
QPushButton *transButton;
|
2003-09-16 19:28:03 +00:00
|
|
|
};
|
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
|
2005-05-13 08:57:21 +00:00
|
|
|
class RootInfo : public NETRootInfo4
|
2003-09-16 19:28:03 +00: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 12:16:30 +00:00
|
|
|
virtual void changeActiveWindow(Window w,NET::RequestSource src, Time timestamp, Window active_window);
|
2003-09-16 19:28:03 +00:00
|
|
|
virtual void closeWindow(Window w);
|
|
|
|
virtual void moveResize(Window w, int x_root, int y_root, unsigned long direction);
|
2003-10-01 12:08:53 +00:00
|
|
|
virtual void moveResizeWindow(Window w, int flags, int x, int y, int width, int height );
|
2003-09-16 19:28:03 +00:00
|
|
|
virtual void gotPing(Window w, Time timestamp);
|
2004-04-16 09:43:53 +00:00
|
|
|
virtual void restackWindow(Window w, RequestSource source, Window above, int detail, Time timestamp);
|
2004-04-22 12:30:57 +00:00
|
|
|
virtual void gotTakeActivity(Window w, Time timestamp, long flags );
|
2005-05-13 08:57:21 +00:00
|
|
|
virtual void changeShowingDesktop( bool showing );
|
2003-09-16 19:28:03 +00:00
|
|
|
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
|
|
|
|
2003-12-02 17:52:10 +00:00
|
|
|
inline Client* Workspace::mostRecentlyActivatedClient() const
|
|
|
|
{
|
|
|
|
return should_get_focus.count() > 0 ? should_get_focus.last() : active_client;
|
|
|
|
}
|
|
|
|
|
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 )
|
|
|
|
{
|
2006-03-06 14:30:06 +00:00
|
|
|
groups.removeAll( group );
|
2003-09-16 19:28:03 +00:00
|
|
|
}
|
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
|
|
|
{
|
2004-06-02 09:47:36 +00: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 19:28:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
|
|
|
void Workspace::setWasUserInteraction()
|
|
|
|
{
|
|
|
|
was_user_interaction = true;
|
|
|
|
}
|
|
|
|
|
2004-06-11 15:13:08 +00:00
|
|
|
inline
|
|
|
|
bool Workspace::wasUserInteraction() const
|
|
|
|
{
|
|
|
|
return was_user_interaction;
|
|
|
|
}
|
|
|
|
|
2003-09-16 19:28:03 +00: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 09:24:57 +00:00
|
|
|
inline bool Workspace::forcedGlobalMouseGrab() const
|
|
|
|
{
|
|
|
|
return forced_global_mouse_grab;
|
|
|
|
}
|
|
|
|
|
2005-05-13 08:57:21 +00:00
|
|
|
inline bool Workspace::showingDesktop() const
|
|
|
|
{
|
|
|
|
return showing_desktop;
|
|
|
|
}
|
|
|
|
|
2005-08-02 13:25:20 +00:00
|
|
|
inline bool Workspace::globalShortcutsDisabled() const
|
|
|
|
{
|
|
|
|
return global_shortcuts_disabled || global_shortcuts_disabled_for_client;
|
|
|
|
}
|
|
|
|
|
2007-01-15 18:03:04 +00:00
|
|
|
inline Window Workspace::overlayWindow()
|
|
|
|
{
|
|
|
|
return overlay;
|
|
|
|
}
|
|
|
|
|
2003-09-16 19:28:03 +00:00
|
|
|
template< typename T >
|
|
|
|
inline Client* Workspace::findClient( T predicate )
|
|
|
|
{
|
2004-01-08 16:18:07 +00:00
|
|
|
if( Client* ret = findClientInList( clients, predicate ))
|
|
|
|
return ret;
|
|
|
|
if( Client* ret = findClientInList( desktops, predicate ))
|
|
|
|
return ret;
|
2003-09-16 19:28:03 +00: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());
|
|
|
|
}
|
|
|
|
|
2007-01-15 18:03:04 +00: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 19:28:03 +00:00
|
|
|
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
|