1 // 2 // X11Util.hh for pekwm 3 // Copyright (C) 2021 Claes Nästén <pekdon@gmail.com> 4 // 5 // This program is licensed under the GNU GPL. 6 // See the LICENSE file for more information. 7 // 8 9 #ifndef _PEKWM_X11UTIL_HH_ 10 #define _PEKWM_X11UTIL_HH_ 11 12 #include "config.h" 13 14 #include "PWinObj.hh" 15 16 struct MwmHints { 17 ulong flags; 18 ulong functions; 19 ulong decorations; 20 }; 21 22 enum { 23 MWM_HINTS_FUNCTIONS = (1L << 0), 24 MWM_HINTS_DECORATIONS = (1L << 1), 25 MWM_HINTS_NUM = 3 26 }; 27 28 enum { 29 MWM_FUNC_ALL = (1L << 0), 30 MWM_FUNC_RESIZE = (1L << 1), 31 MWM_FUNC_MOVE = (1L << 2), 32 MWM_FUNC_ICONIFY = (1L << 3), 33 MWM_FUNC_MAXIMIZE = (1L << 4), 34 MWM_FUNC_CLOSE = (1L << 5) 35 }; 36 37 enum { 38 MWM_DECOR_ALL = (1L << 0), 39 MWM_DECOR_BORDER = (1L << 1), 40 MWM_DECOR_HANDLE = (1L << 2), 41 MWM_DECOR_TITLE = (1L << 3), 42 MWM_DECOR_MENU = (1L << 4), 43 MWM_DECOR_ICONIFY = (1L << 5), 44 MWM_DECOR_MAXIMIZE = (1L << 6) 45 }; 46 47 // Extended Net Hints stuff 48 class NetWMStates { 49 public: 50 NetWMStates(void); 51 virtual ~NetWMStates(void); 52 53 bool modal; 54 bool sticky; 55 bool max_vert, max_horz; 56 bool shaded; 57 bool skip_taskbar, skip_pager; 58 bool hidden; 59 bool fullscreen; 60 bool above, below; 61 bool demands_attention; 62 }; 63 64 namespace X11Util { 65 Geometry getHeadGeometry(int head); 66 uint getCurrHead(CurrHeadSelector chs); 67 uint getNearestHead(const PWinObj& wo); 68 69 void grabButton(int button, int mod, int mask, Window win, 70 int mode=GrabModeAsync); 71 72 bool readMwmHints(Window win, MwmHints &hints); 73 bool readEwmhStates(Window win, NetWMStates &win_states); 74 } 75 76 #ifndef PEKWM_HAVE_XUTF8 77 78 void Xutf8SetWMProperties(Display *dpy, Window win, 79 const char* window_name, const char* icon_name, 80 char** argv, int argc, 81 XSizeHints* normal_hints, XWMHints* wm_hints, 82 XClassHint* class_hints); 83 84 #endif // PEKWM_HAVE_XUTF8 85 86 #endif // _PEKWM_X11UTIL_HH_ 87