00001 // $Id: manager.h,v 1.2 2005/04/25 11:22:42 rcr_muc Exp $ 00002 // the x event loop and managing functions for rwm 00003 // 2005-04-10 rcr 00004 00005 #ifndef MANAGER_H 00006 #define MANAGER_H 00007 00008 #include <map> 00009 #include <qapplication.h> 00010 #include <qrect.h> 00011 #include "handler.h" 00012 #include "rwm.h" 00013 #include <X11/Xatom.h> 00014 00015 class Toolbar; 00016 00017 class Manager : public QApplication 00018 { 00019 Q_OBJECT 00020 00021 Window grabWindow; 00022 Window extendedHintsWin; 00023 Handler* focusClient; 00024 Cursor rCursor; 00025 int maxDesktops; 00026 int currentDesktop; 00027 Strut* masterStrut; 00028 00029 void setupSignalHandlers(); 00030 void setupDisplay(); 00031 void scanWindows(); 00032 void setExtendedWMHintString( Window, int, char* ); 00033 void setExtendedNetSupported(); 00034 void setExtendedNetDesktopGeometry(); 00035 void setExtendedNetDesktopViewport(); 00036 00037 // functions for x11EventFilter events 00038 bool handleKeyPressEvent( XEvent* ); 00039 bool handleButtonPressEvent( XEvent* ); 00040 bool handleButtonReleaseEvent( XEvent* ); 00041 bool handleConfigureRequestEvent( XEvent* ); 00042 bool handleMotionNotifyEvent( XEvent* ); 00043 bool handleMapRequestEvent( XEvent* ); 00044 bool handleUnmapNotifyEvent( XEvent* ); 00045 bool handleDestroyNotifyEvent( XEvent* ); 00046 bool handleEnterNotifyEvent( XEvent* ); 00047 bool handleLeaveNotifyEvent( XEvent* ); 00048 bool handleFocusInEvent( XEvent* ); 00049 bool handleFocusOutEvent( XEvent* ); 00050 bool handleClientMessageEvent( XEvent* ); 00051 bool handleColormapNotifyEvent( XEvent* ); 00052 bool handlePropertyNotifyEvent( XEvent* ); 00053 bool handleExposeEvent( XEvent* ); 00054 bool handleDefaultEvent( XEvent* ); 00055 00056 public: 00057 Manager( int, char** ); 00058 ~Manager(); 00059 00060 Toolbar* toolBar; 00061 Display* dpy; 00062 Window rootWin; 00063 QRect desktopRect; 00064 00065 std::map<Window, Handler*> Clients; 00066 00067 void quitNicely(); 00068 void restart(); 00069 00070 Strut* getMasterStrut() { return masterStrut; }; 00071 00072 void setExtendedWMHint( Window, int, long ); 00073 00074 // not otherwise found atoms 00075 Atom atomUtf8String; 00076 // ICCCM atoms 00077 Atom atomWmState; 00078 Atom atomWmChangeState; 00079 Atom atomWmProtos; 00080 Atom atomWmDelete; 00081 Atom atomWmCmapwins; 00082 Atom atomWmTakefocus; 00083 00084 // Extended WM Hints; 00085 Atom atomNetSupported; 00086 Atom atomNetClientList; 00087 Atom atomNetClientListStacking; 00088 Atom atomNetNumberOfDesktops; 00089 Atom atomNetDesktopGeometry; 00090 Atom atomNetDesktopViewport; 00091 Atom atomNetCurrentDesktop; 00092 //Atom atomNetDesktopNames; 00093 Atom atomNetActiveWindow; 00094 Atom atomNetWorkarea; 00095 Atom atomNetSupportingWmCheck; 00096 //Atom atomNetVirtualRoots; 00097 Atom atomNetCloseWindow; 00098 //Atom atomNetWmMoveresize; 00099 Atom atomNetWmName; 00100 //Atom atomNetWmVisibleName; 00101 //Atom atomNetWmIconName; 00102 //Atom atomNetWmVisibleIconName; 00103 Atom atomNetWmDesktop; 00104 //Atom atomNetWmWindowType; 00105 //Atom atomNetWmWindowTypeDesktop; 00106 //Atom atomNetWmWindowTypeDock; 00107 //Atom atomNetWmWindowTypeToolbar; 00108 //Atom atomNetWmWindowTypeMenu; 00109 //Atom atomNetWmWindowTypeDialog; 00110 //Atom atomNetWmWindowTypeNormal; 00111 Atom atomNetWmState; 00112 Atom atomNetWmStateModal; 00113 Atom atomNetWmStateSticky; 00114 Atom atomNetWmStateMaximizedVert; 00115 Atom atomNetWmStateMaximizedHorz; 00116 Atom atomNetWmStateShaded; 00117 Atom atomNetWmStateSkipTaskbar; 00118 Atom atomNetWmStateSkipPager; 00119 Atom atomNetWmStrut; 00120 //Atom atomNetWmIconGeometry; 00121 //Atom atomNetWmIcon; 00122 //Atom atomNetWmPid; 00123 //Atom atomNetWmHandledIcons; 00124 //Atom atomNetWmPing; 00125 00126 protected: 00127 bool x11EventFilter( XEvent* ); 00128 }; 00129 00130 #endif // MANAGER_H