1 2 #ifndef _MANAGER_H_ 3 #define _MANAGER_H_ 4 5 #include "General.h" 6 #include "listmacro2.h" 7 8 class Client; 9 declarePList(ClientList, Client); 10 11 12 class WindowManager { 13 public: 14 WindowManager(); 15 ~WindowManager(); 16 17 void fatal(const char *); 18 19 // for call from Client and within: 20 21 Client *windowToClient(Window, Boolean create = False); activeClient()22 Client *activeClient() { return m_activeClient; } 23 Boolean raiseTransients(Client *); // true if raised any 24 Time timestamp(Boolean reset); 25 void clearFocus(); 26 setActiveClient(Client * const c)27 void setActiveClient(Client *const c) { m_activeClient = c; } 28 29 void addToHiddenList(Client *); 30 void removeFromHiddenList(Client *); 31 void skipInRevert(Client *, Client *); 32 display()33 Display *display() { return m_display; } root()34 Window root() { return m_root; } 35 36 enum RootCursor { 37 NormalCursor, DeleteCursor, DownCursor, RightCursor, DownrightCursor 38 }; 39 40 void installCursor(RootCursor); 41 void installCursorOnWindow(RootCursor, Window); 42 void installColormap(Colormap); 43 unsigned long allocateColour(char *, char *); 44 45 void considerFocusChange(Client *, Window, Time timestamp); 46 void stopConsideringFocus(); 47 48 // shouldn't really be public 49 int attemptGrab(Window, Window, int, int); 50 void releaseGrab(XButtonEvent *); 51 void eventExposure(XExposeEvent *); // for exposures during client grab 52 void showGeometry(int, int); 53 void removeGeometry(); 54 55 private: 56 int loop(); 57 void release(); 58 59 Display *m_display; 60 int m_screenNumber; 61 62 Window m_root; 63 64 Colormap m_defaultColormap; 65 int m_minimumColormaps; 66 67 Cursor m_cursor; 68 Cursor m_xCursor; 69 Cursor m_vCursor; 70 Cursor m_hCursor; 71 Cursor m_vhCursor; 72 73 char *m_terminal; 74 char *m_shell; 75 76 ClientList m_clients; 77 ClientList m_hiddenClients; 78 Client *m_activeClient; 79 80 int m_shapeEvent; 81 int m_currentTime; 82 83 Boolean m_looping; 84 int m_returnCode; 85 86 static Boolean m_initialising; 87 static int errorHandler(Display *, XErrorEvent *); 88 static void sigHandler(int); 89 static int m_signalled; 90 91 void initialiseScreen(); 92 void scanInitialWindows(); 93 94 GC m_menuGC; 95 Window m_menuWindow; 96 XFontStruct *m_menuFont; 97 unsigned long m_menuForegroundPixel; 98 unsigned long m_menuBackgroundPixel; 99 unsigned long m_menuBorderPixel; 100 static const char *const m_menuCreateLabel; 101 const char *const menuLabel(int); 102 void menu(XButtonEvent *); 103 void spawn(); 104 void circulate(Boolean activeFirst); 105 106 Boolean m_focusChanging; // checking times for focus change 107 Client *m_focusCandidate; 108 Window m_focusCandidateWindow; 109 Time m_focusTimestamp; // time of last crossing event 110 Boolean m_focusPointerMoved; 111 Boolean m_focusPointerNowStill; 112 void checkDelaysForFocus(); 113 114 void nextEvent(XEvent *); // return 115 116 void eventButton(XButtonEvent *); 117 void eventMapRequest(XMapRequestEvent *); 118 void eventConfigureRequest(XConfigureRequestEvent *); 119 void eventUnmap(XUnmapEvent *); 120 void eventCreate(XCreateWindowEvent *); 121 void eventDestroy(XDestroyWindowEvent *); 122 void eventClient(XClientMessageEvent *); 123 void eventColormap(XColormapEvent *); 124 void eventProperty(XPropertyEvent *); 125 void eventEnter(XCrossingEvent *); 126 void eventReparent(XReparentEvent *); 127 void eventFocusIn(XFocusInEvent *); 128 }; 129 130 #endif 131 132