1999-08-19 23:26:42 +00:00
|
|
|
#ifndef WORKSPACE_H
|
|
|
|
#define WORKSPACE_H
|
|
|
|
|
|
|
|
#include <qwidget.h>
|
|
|
|
#include <qapplication.h>
|
|
|
|
#include <qpopupmenu.h>
|
1999-11-22 01:57:51 +00:00
|
|
|
#include <qguardedptr.h>
|
1999-08-19 23:26:42 +00:00
|
|
|
#include <qvaluelist.h>
|
|
|
|
#include <X11/Xlib.h>
|
1999-11-29 02:06:41 +00:00
|
|
|
#include "options.h"
|
1999-12-24 01:36:47 +00:00
|
|
|
#include "plugins.h"
|
1999-08-19 23:26:42 +00:00
|
|
|
class Client;
|
|
|
|
class TabBox;
|
1999-11-07 08:46:36 +00:00
|
|
|
|
|
|
|
class KGlobalAccel;
|
1999-08-19 23:26:42 +00:00
|
|
|
|
|
|
|
typedef QValueList<Client*> ClientList;
|
1999-11-14 06:34:28 +00:00
|
|
|
|
|
|
|
class DockWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DockWindow()
|
|
|
|
: dockWin(0),dockFor(0)
|
|
|
|
{}
|
|
|
|
DockWindow( WId w )
|
|
|
|
: dockWin(w),dockFor(0)
|
|
|
|
{}
|
|
|
|
DockWindow( WId w, WId wf )
|
|
|
|
: dockWin(w),dockFor(wf)
|
|
|
|
{}
|
1999-11-15 00:52:05 +00:00
|
|
|
|
1999-11-14 06:34:28 +00:00
|
|
|
bool operator==( const DockWindow& other )
|
|
|
|
{ return dockWin == other.dockWin; }
|
|
|
|
WId dockWin;
|
|
|
|
WId dockFor;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef QValueList<DockWindow> DockWindowList;
|
1999-08-19 23:26:42 +00:00
|
|
|
|
1999-11-12 03:11:19 +00:00
|
|
|
class Shape {
|
|
|
|
public:
|
|
|
|
static bool hasShape( WId w);
|
|
|
|
static int shapeEvent();
|
|
|
|
};
|
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
class Workspace : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
Workspace();
|
|
|
|
Workspace( WId rootwin );
|
|
|
|
virtual ~Workspace();
|
|
|
|
|
|
|
|
virtual bool workspaceEvent( XEvent * );
|
|
|
|
|
1999-11-07 08:46:36 +00:00
|
|
|
bool hasClient(Client *);
|
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
Client* findClient( WId w ) const;
|
|
|
|
|
|
|
|
QRect geometry() const;
|
1999-11-13 01:51:22 +00:00
|
|
|
QRect clientArea() const;
|
1999-08-19 23:26:42 +00:00
|
|
|
|
|
|
|
bool destroyClient( Client* );
|
|
|
|
|
|
|
|
WId rootWin() const;
|
|
|
|
|
|
|
|
Client* activeClient() const;
|
|
|
|
void setActiveClient( Client* );
|
|
|
|
void activateClient( Client* );
|
|
|
|
void requestFocus( Client* c);
|
|
|
|
|
|
|
|
void doPlacement( Client* c );
|
1999-11-25 16:38:11 +00:00
|
|
|
QPoint adjustClientPosition( Client* c, QPoint pos );
|
1999-08-19 23:26:42 +00:00
|
|
|
void raiseClient( Client* c );
|
|
|
|
|
|
|
|
void clientHidden( Client* );
|
|
|
|
|
|
|
|
int currentDesktop() const;
|
|
|
|
int numberOfDesktops() const;
|
1999-11-07 01:43:06 +00:00
|
|
|
void setNumberOfDesktops( int n );
|
|
|
|
|
1999-09-27 16:02:44 +00:00
|
|
|
QWidget* desktopWidget();
|
1999-08-19 23:26:42 +00:00
|
|
|
|
|
|
|
void grabKey(KeySym keysym, unsigned int mod);
|
|
|
|
|
|
|
|
Client* nextClient(Client*) const;
|
|
|
|
Client* previousClient(Client*) const;
|
|
|
|
Client* nextStaticClient(Client*) const;
|
|
|
|
Client* previousStaticClient(Client*) const;
|
|
|
|
|
|
|
|
//#### TODO right layers as default
|
|
|
|
Client* topClientOnDesktop( int fromLayer = 0, int toLayer = 0) const;
|
|
|
|
|
|
|
|
|
1999-11-22 01:57:51 +00:00
|
|
|
QPopupMenu* clientPopup( Client* );
|
1999-11-25 16:38:11 +00:00
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
void setDesktopClient( Client* );
|
|
|
|
|
1999-11-14 06:34:28 +00:00
|
|
|
bool iconifyMeansWithdraw( Client* );
|
1999-11-28 20:10:58 +00:00
|
|
|
void iconifyOrDeiconifyTransientsOf( Client* );
|
2000-01-10 03:47:30 +00:00
|
|
|
void setStickyTransientsOf( Client*, bool sticky );
|
1999-12-06 00:43:55 +00:00
|
|
|
|
1999-11-28 20:55:52 +00:00
|
|
|
bool hasCaption( const QString& caption );
|
1999-11-14 06:34:28 +00:00
|
|
|
|
1999-11-29 02:06:41 +00:00
|
|
|
void performWindowOperation( Client* c, Options::WindowOperation op );
|
|
|
|
|
1999-12-24 01:36:47 +00:00
|
|
|
Client* clientFactory(Workspace *ws, WId w);
|
1999-11-29 02:06:41 +00:00
|
|
|
|
1999-11-14 06:34:28 +00:00
|
|
|
public slots:
|
1999-11-22 01:57:51 +00:00
|
|
|
void setCurrentDesktop( int new_desktop );
|
1999-11-13 01:51:22 +00:00
|
|
|
// keybindings
|
|
|
|
void slotSwitchDesktop1();
|
|
|
|
void slotSwitchDesktop2();
|
|
|
|
void slotSwitchDesktop3();
|
|
|
|
void slotSwitchDesktop4();
|
|
|
|
void slotSwitchDesktop5();
|
|
|
|
void slotSwitchDesktop6();
|
|
|
|
void slotSwitchDesktop7();
|
|
|
|
void slotSwitchDesktop8();
|
1999-11-25 16:38:11 +00:00
|
|
|
|
1999-11-29 02:18:29 +00:00
|
|
|
void slotWindowMaximize();
|
|
|
|
void slotWindowMaximizeVertical();
|
|
|
|
void slotWindowMaximizeHorizontal();
|
|
|
|
void slotWindowIconify();
|
1999-11-29 02:49:20 +00:00
|
|
|
void slotWindowShade();
|
1999-11-29 02:18:29 +00:00
|
|
|
|
1999-11-22 01:57:51 +00:00
|
|
|
void slotWindowOperations();
|
|
|
|
void slotWindowClose();
|
1999-12-06 00:43:55 +00:00
|
|
|
void slotWindowMove();
|
|
|
|
void slotWindowResize();
|
|
|
|
|
|
|
|
void slotMouseEmulation();
|
1999-11-25 16:38:11 +00:00
|
|
|
|
1999-12-24 01:36:47 +00:00
|
|
|
void slotResetAllClients();
|
|
|
|
|
1999-11-22 01:57:51 +00:00
|
|
|
private slots:
|
|
|
|
void desktopPopupAboutToShow();
|
|
|
|
void clientPopupAboutToShow();
|
|
|
|
void sendToDesktop( int );
|
|
|
|
void clientPopupActivated( int );
|
1999-11-07 08:46:36 +00:00
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
protected:
|
|
|
|
bool keyPress( XKeyEvent key );
|
|
|
|
bool keyRelease( XKeyEvent key );
|
1999-12-06 00:43:55 +00:00
|
|
|
bool keyPressMouseEmulation( XKeyEvent key );
|
1999-11-07 01:43:06 +00:00
|
|
|
bool clientMessage( XClientMessageEvent msg );
|
1999-08-19 23:26:42 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void init();
|
1999-11-13 01:51:22 +00:00
|
|
|
KGlobalAccel *keys;
|
|
|
|
void createKeybindings();
|
1999-08-19 23:26:42 +00:00
|
|
|
WId root;
|
|
|
|
ClientList clients;
|
|
|
|
ClientList stacking_order;
|
|
|
|
ClientList focus_chain;
|
|
|
|
Client* active_client;
|
|
|
|
bool control_grab;
|
|
|
|
bool tab_grab;
|
1999-12-06 00:43:55 +00:00
|
|
|
bool mouse_emulation;
|
1999-08-19 23:26:42 +00:00
|
|
|
TabBox* tab_box;
|
|
|
|
void freeKeyboard(bool pass);
|
1999-11-22 01:57:51 +00:00
|
|
|
QGuardedPtr<Client> popup_client;
|
1999-08-19 23:26:42 +00:00
|
|
|
QPopupMenu *popup;
|
1999-11-22 01:57:51 +00:00
|
|
|
QPopupMenu *desk_popup;
|
1999-08-19 23:26:42 +00:00
|
|
|
Client* should_get_focus;
|
|
|
|
|
|
|
|
void raiseTransientsOf( ClientList& safeset, Client* c );
|
|
|
|
void randomPlacement(Client* c);
|
1999-11-16 08:53:02 +00:00
|
|
|
void smartPlacement(Client* c);
|
1999-11-20 06:27:07 +00:00
|
|
|
void cascadePlacement(Client* c, bool re_init = false);
|
1999-08-19 23:26:42 +00:00
|
|
|
|
1999-12-03 21:08:07 +00:00
|
|
|
enum CleanupType { Cascade, Unclutter };
|
|
|
|
void deskCleanup(CleanupType);
|
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
void focusToNull();
|
|
|
|
Client* desktop_client;
|
|
|
|
int current_desktop;
|
1999-11-07 01:43:06 +00:00
|
|
|
int number_of_desktops;
|
1999-11-15 00:52:05 +00:00
|
|
|
Client* findClientWidthId( WId w ) const;
|
1999-08-19 23:26:42 +00:00
|
|
|
|
1999-09-27 16:02:44 +00:00
|
|
|
QWidget* desktop_widget;
|
|
|
|
|
1999-08-19 23:26:42 +00:00
|
|
|
//experimental
|
|
|
|
void setDecoration( int deco );
|
1999-11-07 20:29:26 +00:00
|
|
|
|
1999-11-07 01:43:06 +00:00
|
|
|
void propagateClients( bool onlyStacking = FALSE);
|
1999-11-12 03:11:19 +00:00
|
|
|
|
1999-11-14 06:34:28 +00:00
|
|
|
DockWindowList dockwins;
|
1999-11-11 01:22:41 +00:00
|
|
|
bool addDockwin( WId w );
|
|
|
|
bool removeDockwin( WId w );
|
|
|
|
void propagateDockwins();
|
1999-11-14 06:34:28 +00:00
|
|
|
DockWindow findDockwin( WId w );
|
1999-12-06 00:43:55 +00:00
|
|
|
|
1999-11-20 06:27:07 +00:00
|
|
|
//CT needed for cascading+
|
|
|
|
struct CascadingInfo {
|
|
|
|
QPoint pos;
|
|
|
|
int col;
|
|
|
|
int row;
|
|
|
|
};
|
|
|
|
|
|
|
|
QValueList<CascadingInfo> cci;
|
1999-11-22 01:57:51 +00:00
|
|
|
// -cascading
|
1999-12-03 21:08:07 +00:00
|
|
|
Atom kwm_command;
|
1999-12-24 01:36:47 +00:00
|
|
|
|
|
|
|
PluginMgr mgr;
|
1999-08-19 23:26:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
inline WId Workspace::rootWin() const
|
|
|
|
{
|
|
|
|
return root;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns the active client, i.e. the client that has the focus (or None if no
|
|
|
|
client has the focus)
|
|
|
|
*/
|
|
|
|
inline Client* Workspace::activeClient() const
|
|
|
|
{
|
|
|
|
return active_client;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns the current virtual desktop of this workspace
|
|
|
|
*/
|
|
|
|
inline int Workspace::currentDesktop() const
|
|
|
|
{
|
|
|
|
return current_desktop;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns the number of virtual desktops of this workspace
|
|
|
|
*/
|
|
|
|
inline int Workspace::numberOfDesktops() const
|
|
|
|
{
|
1999-12-05 14:47:12 +00:00
|
|
|
return number_of_desktops;
|
1999-08-19 23:26:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|