/thirdparty/libqnetwm/libqnetwm/netwm.h

http://github.com/tomahawk-player/tomahawk · C Header · 188 lines · 136 code · 27 blank · 25 comment · 0 complexity · 5a3694656046cd2b922e5816751310d4 MD5 · raw file

  1. /***************************************************************************
  2. * Copyright (C) 2010 by Dmitry 'Krasu' Baryshev *
  3. * ksquirrel.iv@gmail.com *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 3 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  19. ***************************************************************************/
  20. #ifndef NETWM_H
  21. #define NETWM_H
  22. #include <X11/Xlib.h>
  23. #include <X11/Xatom.h>
  24. #include "fixx11h.h"
  25. #include <QStringList>
  26. #include <QString>
  27. #include <QList>
  28. class NETWM
  29. {
  30. public:
  31. struct net_wm_state
  32. {
  33. net_wm_state();
  34. unsigned int modal : 1;
  35. unsigned int sticky : 1;
  36. unsigned int maximized_vert : 1;
  37. unsigned int maximized_horz : 1;
  38. unsigned int shaded : 1;
  39. unsigned int skip_taskbar : 1;
  40. unsigned int skip_pager : 1;
  41. unsigned int hidden : 1;
  42. unsigned int fullscreen : 1;
  43. unsigned int above : 1;
  44. unsigned int below : 1;
  45. unsigned int stays_on_top : 1;
  46. unsigned int stays_on_bottom : 1;
  47. unsigned int demands_attention : 1;
  48. bool valid;
  49. };
  50. struct net_wm_window_type
  51. {
  52. net_wm_window_type();
  53. unsigned int desktop : 1;
  54. unsigned int dock : 1;
  55. unsigned int toolbar : 1;
  56. unsigned int menu : 1;
  57. unsigned int utility : 1;
  58. unsigned int splash : 1;
  59. unsigned int dialog : 1;
  60. unsigned int dropdown : 1;
  61. unsigned int popup : 1;
  62. unsigned int tooltip : 1;
  63. unsigned int notification : 1;
  64. unsigned int combo : 1;
  65. unsigned int dnd : 1;
  66. unsigned int normal : 1;
  67. bool valid;
  68. };
  69. /*************************************************************************/
  70. static void init();
  71. static void transset(Window, double);
  72. #if 0
  73. static bool isComposite();
  74. #endif
  75. static int setProperty(Window, Atom, long, uchar *, int);
  76. static int setPropertySkipTaskbar(Window);
  77. static int setPropertyOnTop(Window);
  78. static void* property(Window win, Atom prop, Atom type, int *nitems = 0, bool *ok = 0);
  79. static bool climsg(Window win, long type, long l0, long l1 = 0, long l2 = 0, long l3 = 0, long l4 = 0);
  80. static bool climsgwm(Window win, Atom type, Atom arg);
  81. // NETWM helper functions
  82. static qint64 netwmPid(Window win);
  83. static QList<Window> netwmWindowList();
  84. static uint netwmDesktopsNumber();
  85. static uint netwmCurrentDesktop();
  86. static int netwmDesktop(Window win);
  87. static net_wm_state netwmState(Window win);
  88. static net_wm_window_type netwmWindowType(Window win);
  89. static bool netwmActivateWindow(Window win);
  90. // ICCCM helper functions
  91. static QString icccmString(Window win, Atom atom);
  92. static QString icccmUtf8String(Window win, Atom atom);
  93. static QString icccmWindowRole(Window win);
  94. static QStringList icccmClass(Window win);
  95. static QString icccmName(Window win);
  96. static QStringList icccmCommand(Window win);
  97. /*************************************************************************/
  98. /********************************* Atoms *********************************/
  99. /*************************************************************************/
  100. static Atom UTF8_STRING;
  101. static Atom XROOTPMAP_ID;
  102. static Atom WM_STATE;
  103. static Atom WM_CLASS;
  104. static Atom WM_NAME;
  105. static Atom WM_DELETE_WINDOW;
  106. static Atom WM_PROTOCOLS;
  107. static Atom WM_CHANGE_STATE;
  108. static Atom WM_WINDOW_ROLE;
  109. static Atom NET_WORKAREA;
  110. static Atom NET_CLIENT_LIST;
  111. static Atom NET_CLIENT_LIST_STACKING;
  112. static Atom NET_NUMBER_OF_DESKTOPS;
  113. static Atom NET_CURRENT_DESKTOP;
  114. static Atom NET_DESKTOP_NAMES;
  115. static Atom NET_ACTIVE_WINDOW;
  116. static Atom NET_CLOSE_WINDOW;
  117. static Atom NET_SUPPORTED;
  118. static Atom NET_WM_DESKTOP;
  119. static Atom NET_SHOWING_DESKTOP;
  120. static Atom NET_WM_STATE;
  121. static Atom NET_WM_STATE_MODAL;
  122. static Atom NET_WM_STATE_STICKY;
  123. static Atom NET_WM_STATE_MAXIMIZED_VERT;
  124. static Atom NET_WM_STATE_MAXIMIZED_HORZ;
  125. static Atom NET_WM_STATE_SHADED;
  126. static Atom NET_WM_STATE_SKIP_TASKBAR;
  127. static Atom NET_WM_STATE_SKIP_PAGER;
  128. static Atom NET_WM_STATE_HIDDEN;
  129. static Atom NET_WM_STATE_FULLSCREEN;
  130. static Atom NET_WM_STATE_ABOVE;
  131. static Atom NET_WM_STATE_BELOW;
  132. static Atom NET_WM_STATE_STAYS_ON_TOP;
  133. static Atom NET_WM_STATE_STAYS_ON_BOTTOM;
  134. static Atom NET_WM_STATE_DEMANDS_ATTENTION;
  135. static Atom NET_WM_WINDOW_TYPE;
  136. static Atom NET_WM_WINDOW_TYPE_DESKTOP;
  137. static Atom NET_WM_WINDOW_TYPE_DOCK;
  138. static Atom MODERRO_WINDOW_TYPE_DOCK;
  139. static Atom NET_WM_WINDOW_TYPE_TOOLBAR;
  140. static Atom NET_WM_WINDOW_TYPE_MENU;
  141. static Atom NET_WM_WINDOW_TYPE_UTILITY;
  142. static Atom NET_WM_WINDOW_TYPE_SPLASH;
  143. static Atom NET_WM_WINDOW_TYPE_DIALOG;
  144. static Atom NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
  145. static Atom NET_WM_WINDOW_TYPE_POPUP_MENU;
  146. static Atom NET_WM_WINDOW_TYPE_TOOLTIP;
  147. static Atom NET_WM_WINDOW_TYPE_NOTIFICATION;
  148. static Atom NET_WM_WINDOW_TYPE_COMBO;
  149. static Atom NET_WM_WINDOW_TYPE_DND;
  150. static Atom NET_WM_WINDOW_TYPE_NORMAL;
  151. static Atom NET_WM_WINDOW_OPACITY;
  152. static Atom NET_WM_NAME;
  153. static Atom NET_WM_VISIBLE_NAME;
  154. static Atom NET_WM_STRUT;
  155. static Atom NET_WM_STRUT_PARTIAL;
  156. static Atom NET_WM_ICON;
  157. static Atom NET_WM_PID;
  158. private:
  159. static void checkInit();
  160. };
  161. #endif