[go: up one dir, main page]

Menu

[2e2bd2]: / src / wmmgr.h  Maximize  Restore  History

Download this file

260 lines (204 with data), 8.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
#ifndef __WMMGR_H
#define __WMMGR_H
#include <X11/Xproto.h>
#include "ywindow.h"
#include "ymenu.h"
#include "WinMgr.h"
#include "ytimer.h"
#ifdef CONFIG_WM_SESSION
#include "yarray.h"
#define PROC_WM_SESSION "/proc/wm-session"
#endif
#define MAXWORKSPACES 64
#define INVALID_WORKSPACE 0xFFFFFFFF
extern long workspaceCount;
extern char *workspaceNames[MAXWORKSPACES];
extern YAction *workspaceActionActivate[MAXWORKSPACES];
extern YAction *workspaceActionMoveTo[MAXWORKSPACES];
extern YAction *layerActionSet[WinLayerCount];
#ifdef CONFIG_TRAY
extern YAction *trayOptionActionSet[WinTrayOptionCount];
#endif
class YWindowManager;
class YFrameClient;
class YFrameWindow;
class EdgeSwitch: public YWindow, public YTimerListener {
public:
EdgeSwitch(YWindowManager *manager, int delta);
virtual ~EdgeSwitch();
virtual void handleCrossing(const XCrossingEvent &crossing);
virtual bool handleTimer(YTimer *t);
private:
YWindowManager *fManager;
int fDelta;
Cursor cursor;
static YTimer *fEdgeSwitchTimer;
};
class YProxyWindow: public YWindow {
public:
YProxyWindow(YWindow *parent);
virtual ~YProxyWindow();
virtual void handleButton(const XButtonEvent &button);
};
class YWindowManager: public YDesktop {
public:
YWindowManager(YWindow *parent, Window win = 0);
virtual ~YWindowManager();
void grabKeys();
virtual void handleButton(const XButtonEvent &button);
virtual void handleClick(const XButtonEvent &up, int count);
virtual bool handleKey(const XKeyEvent &key);
virtual void handleConfigureRequest(const XConfigureRequestEvent &configureRequest);
virtual void handleMapRequest(const XMapRequestEvent &mapRequest);
virtual void handleUnmap(const XUnmapEvent &unmap);
virtual void handleDestroyWindow(const XDestroyWindowEvent &destroyWindow);
virtual void handleClientMessage(const XClientMessageEvent &message);
virtual void handleProperty(const XPropertyEvent &property);
void manageClients();
void unmanageClients();
Window findWindow(char const * resource);
Window findWindow(Window root, char const * wmInstance,
char const * wmClass);
YFrameWindow *findFrame(Window win);
YFrameClient *findClient(Window win);
YFrameWindow *manageClient(Window win, bool mapClient = false);
void unmanageClient(Window win, bool mapClient = false);
void destroyedClient(Window win);
YFrameWindow *mapClient(Window win);
void setFocus(YFrameWindow *f, bool canWarp = false);
YFrameWindow *getFocus() { return fFocusWin; }
void loseFocus(YFrameWindow *window);
void loseFocus(YFrameWindow *window,
YFrameWindow *next,
YFrameWindow *prev);
void activate(YFrameWindow *frame, bool canWarp = false);
void installColormap(Colormap cmap);
void setColormapWindow(YFrameWindow *frame);
YFrameWindow *colormapWindow() { return fColormapWindow; }
void removeClientFrame(YFrameWindow *frame);
int minX(long layer) const;
int minY(long layer) const;
int maxX(long layer) const;
int maxY(long layer) const;
int maxWidth(long layer) const { return maxX(layer) - minX(layer); }
int maxHeight(long layer) const { return maxY(layer) - minY(layer); }
int minX(YFrameWindow const *frame) const;
int minY(YFrameWindow const *frame) const;
int maxX(YFrameWindow const *frame) const;
int maxY(YFrameWindow const *frame) const;
int maxWidth(YFrameWindow const *frame) const {
return maxX(frame) - minX(frame); }
int maxHeight(YFrameWindow const *frame) const {
return maxY(frame) - minY(frame); }
int calcCoverage(bool down, YFrameWindow *frame, int x, int y, int w, int h);
void tryCover(bool down, YFrameWindow *frame, int x, int y, int w, int h,
int &px, int &py, int &cover);
bool getSmartPlace(bool down, YFrameWindow *frame, int &x, int &y, int w, int h);
void getNewPosition(YFrameWindow *frame, int &x, int &y, int w, int h);
void placeWindow(YFrameWindow *frame, int x, int y, bool newClient, bool &canActivate);
YFrameWindow *top(long layer) const { return fTop[layer]; }
void setTop(long layer, YFrameWindow *top);
YFrameWindow *bottom(long layer) const { return fBottom[layer]; }
void setBottom(long layer, YFrameWindow *bottom) { fBottom[layer] = bottom; }
YFrameWindow *topLayer(long layer = WinLayerCount - 1);
YFrameWindow *bottomLayer(long layer = 0);
void restackWindows(YFrameWindow *win);
void focusTopWindow();
bool focusTop(YFrameWindow *f);
void relocateWindows(int dx, int dy);
void updateClientList();
YMenu *createWindowMenu(YMenu *menu, long workspace);
int windowCount(long workspace);
#ifdef CONFIG_WINMENU
void popupWindowListMenu(int x, int y);
#endif
long activeWorkspace() const { return fActiveWorkspace; }
long lastWorkspace() const { return fLastWorkspace; }
void activateWorkspace(long workspace);
long workspaceCount() const { return ::workspaceCount; }
const char *workspaceName(long workspace) const { return ::workspaceNames[workspace]; }
void announceWorkArea();
void setWinWorkspace(long workspace);
void updateWorkArea();
void resizeWindows();
void getIconPosition(YFrameWindow *frame, int *iconX, int *iconY);
void wmCloseSession();
void exitAfterLastClient(bool shuttingDown);
void checkLogout();
virtual void resetColormap(bool active);
void switchFocusTo(YFrameWindow *frame);
void switchFocusFrom(YFrameWindow *frame);
void popupStartMenu();
#ifdef CONFIG_WINMENU
void popupWindowListMenu();
#endif
void switchToWorkspace(long nw, bool takeCurrent);
void switchToPrevWorkspace(bool takeCurrent);
void switchToNextWorkspace(bool takeCurrent);
void switchToLastWorkspace(bool takeCurrent);
void tilePlace(YFrameWindow *w, int tx, int ty, int tw, int th);
void tileWindows(YFrameWindow **w, int count, bool vertical);
void smartPlace(YFrameWindow **w, int count);
void getCascadePlace(YFrameWindow *frame, int &lastX, int &lastY, int &x, int &y, int w, int h);
void cascadePlace(YFrameWindow **w, int count);
void setWindows(YFrameWindow **w, int count, YAction *action);
void getWindowsToArrange(YFrameWindow ***w, int *count);
void saveArrange(YFrameWindow **w, int count);
void undoArrange();
bool haveClients();
void setupRootProxy();
void setWorkAreaMoveWindows(bool m) { fWorkAreaMoveWindows = m; }
#ifdef CONFIG_WM_SESSION
void setTopLevelProcess(pid_t p);
void removeLRUProcess();
#endif
private:
struct WindowPosState {
int x, y, w, h;
long state;
YFrameWindow *frame;
};
YFrameWindow *fFocusWin;
YFrameWindow *fTop[WinLayerCount];
YFrameWindow *fBottom[WinLayerCount];
long fActiveWorkspace;
long fLastWorkspace;
YFrameWindow *fColormapWindow;
int fMinX, fMinY, fMaxX, fMaxY;
EdgeSwitch *fLeftSwitch, *fRightSwitch;
bool fShuttingDown;
int fArrangeCount;
WindowPosState *fArrangeInfo;
YProxyWindow *rootProxy;
YWindow *fTopWin;
bool fWorkAreaMoveWindows;
#ifdef CONFIG_WM_SESSION
YStackSet<pid_t> fProcessList;
#endif
};
extern YWindowManager *manager;
void dumpZorder(const char *oper, YFrameWindow *w, YFrameWindow *a = 0);
extern Atom _XA_WIN_PROTOCOLS;
extern Atom _XA_WIN_WORKSPACE;
extern Atom _XA_WIN_WORKSPACE_COUNT;
extern Atom _XA_WIN_WORKSPACE_NAMES;
extern Atom _XA_WIN_WORKAREA;
extern Atom _XA_WIN_LAYER;
#ifdef CONFIG_TRAY
extern Atom _XA_WIN_TRAY;
#endif
extern Atom _XA_WIN_ICONS;
extern Atom _XA_WIN_HINTS;
extern Atom _XA_WIN_STATE;
extern Atom _XA_WIN_SUPPORTING_WM_CHECK;
extern Atom _XA_WIN_CLIENT_LIST;
extern Atom _XA_WIN_DESKTOP_BUTTON_PROXY;
extern Atom _XA_WIN_AREA;
extern Atom _XA_WIN_AREA_COUNT;
extern Atom _XA_WM_CLIENT_LEADER;
extern Atom _XA_SM_CLIENT_ID;
/* KDE specific */
extern Atom _XA_KWM_WIN_ICON;
extern Atom XA_IcewmWinOptHint;
extern YIcon *defaultAppIcon;
#endif