00001 // Copyright (c) 2003 - 2004 Anselm R. Garbe <anselmg at t-online.de> 00002 // See ../LICENSE.txt for license details. 00003 // 00004 // $Id: client.h 7 2007-05-24 11:03:53Z eg1981 $ 00005 00006 #ifndef __CLIENT_H 00007 #define __CLIENT_H 00008 00009 extern "C" { 00010 #include <X11/Xlib.h> 00011 #include <X11/Xutil.h> 00012 } 00013 00014 #include <list> 00015 #include <string> 00016 #include "thing.h" 00017 #include "ncwm.h" 00018 00019 // forward declaration 00020 class Client; 00021 class Monitor; 00022 class Workspace; 00023 00024 typedef list<Client *> LClient; 00025 00029 class Client : public Thing 00030 { 00031 00032 public: 00033 00034 enum Mode {FLOAT, MAX, STICKY 00035 #ifdef SLOT_SUPPORT 00036 , SLOT 00037 #endif // SLOT_SUPPORT 00038 }; 00039 00040 Client(Monitor *monitor, Window window, XWindowAttributes *attr); 00041 ~Client(); 00042 00044 void setTransient(Client *client); 00045 Client *transient() const; 00046 00047 long eventMask() const; 00048 00049 string className() const; 00050 00051 string instanceName() const; 00052 00053 string iconName() const; 00054 00055 void sendConfiguration(); 00056 00057 virtual void resize(); 00058 00060 void handleConfigureRequest(XConfigureRequestEvent *event); 00061 void handleMapNotify(XMapEvent *event); 00062 void handlePropertyNotify(XPropertyEvent *event); 00063 void handleUnmapNotify(XUnmapEvent *event); 00064 00065 virtual void show(); 00066 virtual void hide(); 00067 00068 int protocols() const; 00069 00070 bool isCentered() const; 00071 00072 void initICCCM(); 00073 00074 void setMode(Mode mode); 00075 00076 Mode mode() const; 00077 00078 int state() const; 00079 00081 virtual void illuminate(); 00082 00083 virtual bool isFocused(); 00084 00085 virtual void handleButtonPress(XButtonEvent *event); 00086 virtual void handleButtonRelease(XButtonEvent *event); 00087 00088 virtual Cursor cursorForXY(int pointerX, int pointerY); 00089 00090 virtual Window window(); 00091 Window frameWindow() const; 00092 Window clientWindow() const; 00093 00094 void setDestroyed(bool isDestroyed); 00095 bool isDestroyed() const; 00096 00097 void createFrame(); 00098 00099 void reparent(Window parentWindow, int x, int y); 00100 00101 string id(); 00102 00103 Frame *frame() const; 00104 void setFrame(Frame *frame); 00105 00106 Workspace *attached() const; 00107 void setAttached(Workspace *workspace); 00108 00109 bool requestsFocus() const; 00110 void setRequestsFocus(bool requestsFocus); 00111 00116 string hooked() const; 00117 void setHooked(string hooked); 00118 00119 private: 00120 00121 void gravitate(bool invert); 00122 00124 void updateSize(); 00125 00127 void updateTransient(); 00128 00129 Window clientWindow_; 00130 00131 string className_; 00132 string instanceName_; 00133 string iconName_; 00134 string hooked_; 00135 00136 Workspace *workspace_; 00137 Client *transient_; 00138 Frame *frame_; 00139 00140 unsigned int clientBorderWidth_; 00141 00142 int protocols_; 00143 int state_; 00144 long eventMask_; 00145 00146 bool isCentered_; 00147 bool hasFrame_; 00148 bool requestsFocus_; 00149 bool isDestroyed_; 00150 00151 Mode mode_; 00152 string id_; 00153 }; 00154 00155 #endif // __CLIENT_H