1 /* treewm - an X11 window manager. 2 * Copyright (c) 2001-2002 Thomas J�ger <TheHunter2000 at web dot de> 3 * This code is released under the terms of the GNU GPL. 4 * See the included file LICENSE for details. 5 */ 6 7 #ifndef CLIENT_H 8 #define CLIENT_H 9 #include "global.h" 10 #include "menu.h" 11 12 // 1 - 25 13 #define CF_SHADED (1L<< 1) 14 #define CF_IGNOREEXPOSE (1L<< 2) 15 #define CF_FIXEDSIZE (1L<< 3) 16 #define CF_ICONPOSKNOWN (1L<< 4) 17 #define CF_GRABBED (1L<< 5) 18 #define CF_NOCLOSE (1L<< 6) 19 #define CF_NOMINIMIZE (1L<< 7) 20 #define CF_FORCESTATIC (1L<< 8) 21 #define CF_STICKY (1L<< 9) 22 #define CF_HASTITLE (1L<<10) 23 #define CF_HASTBENTRY (1L<<11) 24 #define CF_GRABALTCLICK (1L<<12) 25 #define CF_PASSFIRSTCLICK (1L<<13) 26 #define CF_TITLEBARBUTTONS (1L<<14) 27 #define CF_SNAP (1L<<15) 28 #define CF_ABOVE (1L<<16) 29 #define CF_BELOW (1L<<17) 30 #define CF_RAISEONCLICK (1L<<18) 31 #define CF_RAISEONENTER (1L<<19) 32 #define CF_FOCUSONCLICK (1L<<20) 33 #define CF_FOCUSONENTER (1L<<21) 34 #define CF_AUTOSHADE (1L<<22) 35 #define CF_HIDEMOUSE (1L<<23) 36 37 #define CF_HASBEENSHAPED (1L<<25) 38 39 // 26-31 40 #define DF_FIRST (1L<<26) 41 #define DF_ICONSRAISED (1L<<26) 42 #define DF_AUTOSCROLL (1L<<27) 43 #define DF_TILE (1L<<28) 44 #define DF_AUTORESIZE (1L<<29) 45 #define DF_TASKBARBUTTONS (1L<<30) 46 #define DF_GRABKEYBOARD (1UL<<31) 47 48 #define DEFAULTFLAGS (CF_HASTBENTRY | CF_HASTITLE | CF_GRABALTCLICK | CF_PASSFIRSTCLICK | \ 49 CF_SNAP | CF_TITLEBARBUTTONS | CF_FOCUSONENTER | DF_TASKBARBUTTONS) 50 51 #define DEFAULTMASK (CF_IGNOREEXPOSE | CF_FIXEDSIZE | CF_ICONPOSKNOWN | CF_GRABBED | \ 52 CF_FORCESTATIC | CF_HASBEENSHAPED | TF_ISICON | DF_ICONSRAISED) 53 54 #define CF_ALL 0x00FFFFFE 55 #define DF_ALL 0xFF000000 56 57 #define FLAG_NONE 0 58 #define FLAG_UPDATE 1 59 #define FLAG_SET 2 60 #define FLAG_UNSET 3 61 #define FLAG_TOGGLE 4 62 #define FLAG_REMOVE 5 63 #define FLAG_DSET 6 64 #define FLAG_DUNSET 7 65 #define FLAG_DTOGGLE 8 66 #define FLAG_DREMOVE 9 67 #define FLAG_CSET 10 68 #define FLAG_CUNSET 11 69 #define FLAG_CTOGGLE 12 70 #define FLAG_CREMOVE 13 71 72 #define FLAG_CMIN FLAG_CSET 73 #define FLAG_CMAX FLAG_CREMOVE 74 75 #define R_WITHDRAW 0 76 #define R_REMAP 1 77 #define R_RESTART 2 78 79 #define SPACE 1 80 #define BUTTONWIDTH THeight 81 82 83 // modes for raise 84 85 #define R_PARENT 1 86 #define R_MOVEMOUSE 2 87 #define R_INDIRECT 4 88 #define R_GOTO 8 89 #define R_MAP 16 90 91 #define L_PARENT 1 92 #define L_BOTTOM 2 93 94 #define snap 6 95 96 #define S_LEFT 1 97 #define S_RIGHT 2 98 99 #define S_TOP 4 100 #define S_BOTTOM 8 101 102 // Defines for Maximize 103 #define MAX_UNMAX 0 104 #define MAX_HALF 1 105 #define MAX_FULL 2 106 #define MAX_REMAX 3 107 #define MAX_FULLSCREEN 4 108 #define MAX_HORI 5 109 #define MAX_VERTHALF 6 110 #define MAX_VERTFULL 7 111 112 // Defines for SendWMDelete 113 #define DEL_NORMAL 0 114 #define DEL_FORCE 1 115 #define DEL_RELEASE 2 116 117 // Defines for MH->type 118 #define T_B1 1 119 #define T_B2 2 120 #define T_B3 3 121 #define T_DC 8 // Doubleclick 122 #define T_SDC 16 // Strange doubleclick 123 #define T_BAR 32 124 #define T_F1 64 125 #define T_F2 96 126 #define T_SHIFT 128 127 128 #define T_BUTTON (T_BAR|T_F1|T_F2) 129 #define T_MOUSEBUTTON (T_B1|T_B2|T_B3) 130 131 132 class Client : public TWindow { 133 public: 134 Client(Desktop *, Window = 0); 135 virtual void SetClientInfo(ClientInfo *); 136 virtual bool Init(); 137 void GetMWMOptions(); 138 virtual ~Client(); 139 virtual Client* FindPointerClient(); 140 virtual bool GetWindowList(MenuItem *,int &,bool,int,int,int,char *); 141 virtual void RemoveClientReferences(Client *); 142 virtual Desktop *DesktopAbove(); 143 void ChangeName(); 144 void GetFlags(); 145 virtual void UpdateFlags(int, unsigned long); 146 void UpdateName(bool); 147 void ReDrawTBEntry(Client *,bool=true); 148 virtual void SendWMDelete(int); 149 virtual void SendEvent(XAnyEvent &e); 150 virtual void RequestDesktop(bool); 151 void Maximize(int); 152 void Shade(); 153 virtual unsigned long GetRegionMask(int,int,Client * &); 154 virtual void SetWMState(); 155 virtual void GrabButtons(bool = false); 156 void GiveFocus(); 157 virtual void GetFocus(); 158 virtual Client *Focus(); 159 Client* Next(bool); 160 Client* Prev(bool); 161 void MoveRight(); 162 void MoveLeft(); 163 void MoveUp(); 164 void MoveDown(); 165 void Stacking(bool); 166 int GetStacking(); 167 virtual void Raise(int); 168 void Scroll(bool); 169 void Lower(unsigned int); 170 void LowerBelow(Client *); 171 void Map(); 172 void Unmap(bool); 173 long GetWMState(); 174 virtual void SendConfig(); 175 void Configure(XConfigureRequestEvent); 176 void InitPosition(); 177 void Gravitate(int); 178 void Reparent(); 179 virtual void Remove(int); 180 void Hide(); 181 void ToggleHasTitle(); 182 virtual void UpdateTB(); 183 virtual void ReDraw(); 184 void DrawOutline(); 185 void MoveResize(int, bool, int, int, bool = false); 186 void Snap(int); 187 void RecalcSweep(int); 188 virtual void ChangeSize(); 189 void ChangePos(bool); 190 void Clear(); 191 #ifdef SHAPE 192 void MakeHole(bool); 193 void SetShape(); 194 #endif 195 #ifdef DEBUG 196 const char *ShowGrav(); 197 const char *ShowState(); 198 void dump(); 199 #endif 200 unsigned long mask; 201 unsigned long parentmask; // why here???? 202 Client *next; 203 Desktop *parent,*target; 204 char *name, *wmname; 205 bool mapped; // Is the window mapped? 206 bool visible; // Is the window visible? 207 int THeight; 208 Window window, frame, title; 209 210 Client *trans,*transfor; 211 // protected: 212 Sceme *Sc; 213 // ClientInfo *ci; doesn't make sence 214 int TBx, TBy, TBEx, TBEy; 215 216 int MaxX,MaxY,MaxW,MaxH; 217 218 XSizeHints *size; 219 Colormap cmap; 220 int x, y, width, height; 221 int x_root, y_root; 222 int IconX,IconY; 223 224 Icon *icon; 225 RPixmap *iconpm; 226 int ignoreunmap; 227 228 }; 229 230 231 void GetMousePosition(Window , int &, int &); 232 void FetchName(Window , char **); 233 234 #define setmouse(w, x, y) XWarpPointer(dpy, None, w, 0, 0, 0, 0, x, y) 235 #define grabp(w, mask, curs) (XGrabPointer(dpy, w, False, mask, \ 236 GrabModeAsync, GrabModeAsync, None, curs, CurrentTime) == GrabSuccess) 237 238 #define DWidth DisplayWidth(dpy,screen) 239 #define DHeight DisplayHeight(dpy,screen) 240 #ifdef VIDMODE 241 #define VWidth ct->ctVWidth 242 #define VHeight ct->ctVHeight 243 #define VX ct->ctVX 244 #define VY ct->ctVY 245 #else 246 #define VWidth DWidth 247 #define VHeight DHeight 248 #define VX 0 249 #define VY 0 250 #endif 251 252 #endif 253