X11Atoms.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. // Permission is hereby granted, free of charge, to any person obtaining
  2. // a copy of this software and associated documentation files (the
  3. // "Software"), to deal in the Software without restriction, including
  4. // without limitation the rights to use, copy, modify, merge, publish,
  5. // distribute, sublicense, and/or sell copies of the Software, and to
  6. // permit persons to whom the Software is furnished to do so, subject to
  7. // the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be
  10. // included in all copies or substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  16. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  17. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  18. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. //
  20. // Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
  21. //
  22. //
  23. using System;
  24. using System.Windows.Forms;
  25. namespace System.Windows.Forms.X11Internal {
  26. internal class X11Atoms {
  27. // Our atoms
  28. public readonly IntPtr AnyPropertyType = (IntPtr)0;
  29. public readonly IntPtr XA_PRIMARY = (IntPtr)1;
  30. public readonly IntPtr XA_SECONDARY = (IntPtr)2;
  31. public readonly IntPtr XA_ARC = (IntPtr)3;
  32. public readonly IntPtr XA_ATOM = (IntPtr)4;
  33. public readonly IntPtr XA_BITMAP = (IntPtr)5;
  34. public readonly IntPtr XA_CARDINAL = (IntPtr)6;
  35. public readonly IntPtr XA_COLORMAP = (IntPtr)7;
  36. public readonly IntPtr XA_CURSOR = (IntPtr)8;
  37. public readonly IntPtr XA_CUT_BUFFER0 = (IntPtr)9;
  38. public readonly IntPtr XA_CUT_BUFFER1 = (IntPtr)10;
  39. public readonly IntPtr XA_CUT_BUFFER2 = (IntPtr)11;
  40. public readonly IntPtr XA_CUT_BUFFER3 = (IntPtr)12;
  41. public readonly IntPtr XA_CUT_BUFFER4 = (IntPtr)13;
  42. public readonly IntPtr XA_CUT_BUFFER5 = (IntPtr)14;
  43. public readonly IntPtr XA_CUT_BUFFER6 = (IntPtr)15;
  44. public readonly IntPtr XA_CUT_BUFFER7 = (IntPtr)16;
  45. public readonly IntPtr XA_DRAWABLE = (IntPtr)17;
  46. public readonly IntPtr XA_FONT = (IntPtr)18;
  47. public readonly IntPtr XA_INTEGER = (IntPtr)19;
  48. public readonly IntPtr XA_PIXMAP = (IntPtr)20;
  49. public readonly IntPtr XA_POINT = (IntPtr)21;
  50. public readonly IntPtr XA_RECTANGLE = (IntPtr)22;
  51. public readonly IntPtr XA_RESOURCE_MANAGER = (IntPtr)23;
  52. public readonly IntPtr XA_RGB_COLOR_MAP = (IntPtr)24;
  53. public readonly IntPtr XA_RGB_BEST_MAP = (IntPtr)25;
  54. public readonly IntPtr XA_RGB_BLUE_MAP = (IntPtr)26;
  55. public readonly IntPtr XA_RGB_DEFAULT_MAP = (IntPtr)27;
  56. public readonly IntPtr XA_RGB_GRAY_MAP = (IntPtr)28;
  57. public readonly IntPtr XA_RGB_GREEN_MAP = (IntPtr)29;
  58. public readonly IntPtr XA_RGB_RED_MAP = (IntPtr)30;
  59. public readonly IntPtr XA_STRING = (IntPtr)31;
  60. public readonly IntPtr XA_VISUALID = (IntPtr)32;
  61. public readonly IntPtr XA_WINDOW = (IntPtr)33;
  62. public readonly IntPtr XA_WM_COMMAND = (IntPtr)34;
  63. public readonly IntPtr XA_WM_HINTS = (IntPtr)35;
  64. public readonly IntPtr XA_WM_CLIENT_MACHINE = (IntPtr)36;
  65. public readonly IntPtr XA_WM_ICON_NAME = (IntPtr)37;
  66. public readonly IntPtr XA_WM_ICON_SIZE = (IntPtr)38;
  67. public readonly IntPtr XA_WM_NAME = (IntPtr)39;
  68. public readonly IntPtr XA_WM_NORMAL_HINTS = (IntPtr)40;
  69. public readonly IntPtr XA_WM_SIZE_HINTS = (IntPtr)41;
  70. public readonly IntPtr XA_WM_ZOOM_HINTS = (IntPtr)42;
  71. public readonly IntPtr XA_MIN_SPACE = (IntPtr)43;
  72. public readonly IntPtr XA_NORM_SPACE = (IntPtr)44;
  73. public readonly IntPtr XA_MAX_SPACE = (IntPtr)45;
  74. public readonly IntPtr XA_END_SPACE = (IntPtr)46;
  75. public readonly IntPtr XA_SUPERSCRIPT_X = (IntPtr)47;
  76. public readonly IntPtr XA_SUPERSCRIPT_Y = (IntPtr)48;
  77. public readonly IntPtr XA_SUBSCRIPT_X = (IntPtr)49;
  78. public readonly IntPtr XA_SUBSCRIPT_Y = (IntPtr)50;
  79. public readonly IntPtr XA_UNDERLINE_POSITION = (IntPtr)51;
  80. public readonly IntPtr XA_UNDERLINE_THICKNESS = (IntPtr)52;
  81. public readonly IntPtr XA_STRIKEOUT_ASCENT = (IntPtr)53;
  82. public readonly IntPtr XA_STRIKEOUT_DESCENT = (IntPtr)54;
  83. public readonly IntPtr XA_ITALIC_ANGLE = (IntPtr)55;
  84. public readonly IntPtr XA_X_HEIGHT = (IntPtr)56;
  85. public readonly IntPtr XA_QUAD_WIDTH = (IntPtr)57;
  86. public readonly IntPtr XA_WEIGHT = (IntPtr)58;
  87. public readonly IntPtr XA_POINT_SIZE = (IntPtr)59;
  88. public readonly IntPtr XA_RESOLUTION = (IntPtr)60;
  89. public readonly IntPtr XA_COPYRIGHT = (IntPtr)61;
  90. public readonly IntPtr XA_NOTICE = (IntPtr)62;
  91. public readonly IntPtr XA_FONT_NAME = (IntPtr)63;
  92. public readonly IntPtr XA_FAMILY_NAME = (IntPtr)64;
  93. public readonly IntPtr XA_FULL_NAME = (IntPtr)65;
  94. public readonly IntPtr XA_CAP_HEIGHT = (IntPtr)66;
  95. public readonly IntPtr XA_WM_CLASS = (IntPtr)67;
  96. public readonly IntPtr XA_WM_TRANSIENT_FOR = (IntPtr)68;
  97. public readonly IntPtr WM_PROTOCOLS;
  98. public readonly IntPtr WM_DELETE_WINDOW;
  99. public readonly IntPtr WM_TAKE_FOCUS;
  100. public readonly IntPtr _NET_SUPPORTED;
  101. public readonly IntPtr _NET_CLIENT_LIST;
  102. public readonly IntPtr _NET_NUMBER_OF_DESKTOPS;
  103. public readonly IntPtr _NET_DESKTOP_GEOMETRY;
  104. public readonly IntPtr _NET_DESKTOP_VIEWPORT;
  105. public readonly IntPtr _NET_CURRENT_DESKTOP;
  106. public readonly IntPtr _NET_DESKTOP_NAMES;
  107. public readonly IntPtr _NET_ACTIVE_WINDOW;
  108. public readonly IntPtr _NET_WORKAREA;
  109. public readonly IntPtr _NET_SUPPORTING_WM_CHECK;
  110. public readonly IntPtr _NET_VIRTUAL_ROOTS;
  111. public readonly IntPtr _NET_DESKTOP_LAYOUT;
  112. public readonly IntPtr _NET_SHOWING_DESKTOP;
  113. public readonly IntPtr _NET_CLOSE_WINDOW;
  114. public readonly IntPtr _NET_MOVERESIZE_WINDOW;
  115. public readonly IntPtr _NET_WM_MOVERESIZE;
  116. public readonly IntPtr _NET_RESTACK_WINDOW;
  117. public readonly IntPtr _NET_REQUEST_FRAME_EXTENTS;
  118. public readonly IntPtr _NET_WM_NAME;
  119. public readonly IntPtr _NET_WM_VISIBLE_NAME;
  120. public readonly IntPtr _NET_WM_ICON_NAME;
  121. public readonly IntPtr _NET_WM_VISIBLE_ICON_NAME;
  122. public readonly IntPtr _NET_WM_DESKTOP;
  123. public readonly IntPtr _NET_WM_WINDOW_TYPE;
  124. public readonly IntPtr _NET_WM_STATE;
  125. public readonly IntPtr _NET_WM_ALLOWED_ACTIONS;
  126. public readonly IntPtr _NET_WM_STRUT;
  127. public readonly IntPtr _NET_WM_STRUT_PARTIAL;
  128. public readonly IntPtr _NET_WM_ICON_GEOMETRY;
  129. public readonly IntPtr _NET_WM_ICON;
  130. public readonly IntPtr _NET_WM_PID;
  131. public readonly IntPtr _NET_WM_HANDLED_ICONS;
  132. public readonly IntPtr _NET_WM_USER_TIME;
  133. public readonly IntPtr _NET_FRAME_EXTENTS;
  134. public readonly IntPtr _NET_WM_PING;
  135. public readonly IntPtr _NET_WM_SYNC_REQUEST;
  136. public readonly IntPtr _NET_SYSTEM_TRAY_S;
  137. public readonly IntPtr _NET_SYSTEM_TRAY_ORIENTATION;
  138. public readonly IntPtr _NET_SYSTEM_TRAY_OPCODE;
  139. public readonly IntPtr _NET_WM_STATE_MAXIMIZED_HORZ;
  140. public readonly IntPtr _NET_WM_STATE_MAXIMIZED_VERT;
  141. public readonly IntPtr _XEMBED;
  142. public readonly IntPtr _XEMBED_INFO;
  143. public readonly IntPtr _MOTIF_WM_HINTS;
  144. public readonly IntPtr _NET_WM_STATE_SKIP_TASKBAR;
  145. public readonly IntPtr _NET_WM_STATE_ABOVE;
  146. public readonly IntPtr _NET_WM_STATE_MODAL;
  147. public readonly IntPtr _NET_WM_STATE_HIDDEN;
  148. public readonly IntPtr _NET_WM_CONTEXT_HELP;
  149. public readonly IntPtr _NET_WM_WINDOW_OPACITY;
  150. public readonly IntPtr _NET_WM_WINDOW_TYPE_DESKTOP;
  151. public readonly IntPtr _NET_WM_WINDOW_TYPE_DOCK;
  152. public readonly IntPtr _NET_WM_WINDOW_TYPE_TOOLBAR;
  153. public readonly IntPtr _NET_WM_WINDOW_TYPE_MENU;
  154. public readonly IntPtr _NET_WM_WINDOW_TYPE_UTILITY;
  155. public readonly IntPtr _NET_WM_WINDOW_TYPE_SPLASH;
  156. public readonly IntPtr _NET_WM_WINDOW_TYPE_DIALOG;
  157. public readonly IntPtr _NET_WM_WINDOW_TYPE_NORMAL;
  158. public readonly IntPtr CLIPBOARD;
  159. public readonly IntPtr PRIMARY;
  160. public readonly IntPtr DIB;
  161. public readonly IntPtr OEMTEXT;
  162. public readonly IntPtr UNICODETEXT;
  163. public readonly IntPtr TARGETS;
  164. public readonly IntPtr PostAtom;
  165. public readonly IntPtr AsyncAtom;
  166. public X11Atoms (X11Display display) {
  167. // make sure this array stays in sync with the statements below
  168. string [] atom_names = new string[] {
  169. "WM_PROTOCOLS",
  170. "WM_DELETE_WINDOW",
  171. "WM_TAKE_FOCUS",
  172. "_NET_SUPPORTED",
  173. "_NET_CLIENT_LIST",
  174. "_NET_NUMBER_OF_DESKTOPS",
  175. "_NET_DESKTOP_GEOMETRY",
  176. "_NET_DESKTOP_VIEWPORT",
  177. "_NET_CURRENT_DESKTOP",
  178. "_NET_DESKTOP_NAMES",
  179. "_NET_ACTIVE_WINDOW",
  180. "_NET_WORKAREA",
  181. "_NET_SUPPORTING_WM_CHECK",
  182. "_NET_VIRTUAL_ROOTS",
  183. "_NET_DESKTOP_LAYOUT",
  184. "_NET_SHOWING_DESKTOP",
  185. "_NET_CLOSE_WINDOW",
  186. "_NET_MOVERESIZE_WINDOW",
  187. "_NET_WM_MOVERESIZE",
  188. "_NET_RESTACK_WINDOW",
  189. "_NET_REQUEST_FRAME_EXTENTS",
  190. "_NET_WM_NAME",
  191. "_NET_WM_VISIBLE_NAME",
  192. "_NET_WM_ICON_NAME",
  193. "_NET_WM_VISIBLE_ICON_NAME",
  194. "_NET_WM_DESKTOP",
  195. "_NET_WM_WINDOW_TYPE",
  196. "_NET_WM_STATE",
  197. "_NET_WM_ALLOWED_ACTIONS",
  198. "_NET_WM_STRUT",
  199. "_NET_WM_STRUT_PARTIAL",
  200. "_NET_WM_ICON_GEOMETRY",
  201. "_NET_WM_ICON",
  202. "_NET_WM_PID",
  203. "_NET_WM_HANDLED_ICONS",
  204. "_NET_WM_USER_TIME",
  205. "_NET_FRAME_EXTENTS",
  206. "_NET_WM_PING",
  207. "_NET_WM_SYNC_REQUEST",
  208. "_NET_SYSTEM_TRAY_OPCODE",
  209. "_NET_SYSTEM_TRAY_ORIENTATION",
  210. "_NET_WM_STATE_MAXIMIZED_HORZ",
  211. "_NET_WM_STATE_MAXIMIZED_VERT",
  212. "_NET_WM_STATE_HIDDEN",
  213. "_XEMBED",
  214. "_XEMBED_INFO",
  215. "_MOTIF_WM_HINTS",
  216. "_NET_WM_STATE_SKIP_TASKBAR",
  217. "_NET_WM_STATE_ABOVE",
  218. "_NET_WM_STATE_MODAL",
  219. "_NET_WM_CONTEXT_HELP",
  220. "_NET_WM_WINDOW_OPACITY",
  221. "_NET_WM_WINDOW_TYPE_DESKTOP",
  222. "_NET_WM_WINDOW_TYPE_DOCK",
  223. "_NET_WM_WINDOW_TYPE_TOOLBAR",
  224. "_NET_WM_WINDOW_TYPE_MENU",
  225. "_NET_WM_WINDOW_TYPE_UTILITY",
  226. "_NET_WM_WINDOW_TYPE_DIALOG",
  227. "_NET_WM_WINDOW_TYPE_SPLASH",
  228. "_NET_WM_WINDOW_TYPE_NORMAL",
  229. "CLIPBOARD",
  230. "PRIMARY",
  231. "COMPOUND_TEXT",
  232. "UTF8_STRING",
  233. "TARGETS",
  234. "_SWF_AsyncAtom",
  235. "_SWF_PostMessageAtom",
  236. "_SWF_HoverAtom" };
  237. IntPtr[] atoms = new IntPtr [atom_names.Length];;
  238. Xlib.XInternAtoms (display.Handle, atom_names, atom_names.Length, false, atoms);
  239. int off = 0;
  240. WM_PROTOCOLS = atoms [off++];
  241. WM_DELETE_WINDOW = atoms [off++];
  242. WM_TAKE_FOCUS = atoms [off++];
  243. _NET_SUPPORTED = atoms [off++];
  244. _NET_CLIENT_LIST = atoms [off++];
  245. _NET_NUMBER_OF_DESKTOPS = atoms [off++];
  246. _NET_DESKTOP_GEOMETRY = atoms [off++];
  247. _NET_DESKTOP_VIEWPORT = atoms [off++];
  248. _NET_CURRENT_DESKTOP = atoms [off++];
  249. _NET_DESKTOP_NAMES = atoms [off++];
  250. _NET_ACTIVE_WINDOW = atoms [off++];
  251. _NET_WORKAREA = atoms [off++];
  252. _NET_SUPPORTING_WM_CHECK = atoms [off++];
  253. _NET_VIRTUAL_ROOTS = atoms [off++];
  254. _NET_DESKTOP_LAYOUT = atoms [off++];
  255. _NET_SHOWING_DESKTOP = atoms [off++];
  256. _NET_CLOSE_WINDOW = atoms [off++];
  257. _NET_MOVERESIZE_WINDOW = atoms [off++];
  258. _NET_WM_MOVERESIZE = atoms [off++];
  259. _NET_RESTACK_WINDOW = atoms [off++];
  260. _NET_REQUEST_FRAME_EXTENTS = atoms [off++];
  261. _NET_WM_NAME = atoms [off++];
  262. _NET_WM_VISIBLE_NAME = atoms [off++];
  263. _NET_WM_ICON_NAME = atoms [off++];
  264. _NET_WM_VISIBLE_ICON_NAME = atoms [off++];
  265. _NET_WM_DESKTOP = atoms [off++];
  266. _NET_WM_WINDOW_TYPE = atoms [off++];
  267. _NET_WM_STATE = atoms [off++];
  268. _NET_WM_ALLOWED_ACTIONS = atoms [off++];
  269. _NET_WM_STRUT = atoms [off++];
  270. _NET_WM_STRUT_PARTIAL = atoms [off++];
  271. _NET_WM_ICON_GEOMETRY = atoms [off++];
  272. _NET_WM_ICON = atoms [off++];
  273. _NET_WM_PID = atoms [off++];
  274. _NET_WM_HANDLED_ICONS = atoms [off++];
  275. _NET_WM_USER_TIME = atoms [off++];
  276. _NET_FRAME_EXTENTS = atoms [off++];
  277. _NET_WM_PING = atoms [off++];
  278. _NET_WM_SYNC_REQUEST = atoms [off++];
  279. _NET_SYSTEM_TRAY_OPCODE = atoms [off++];
  280. _NET_SYSTEM_TRAY_ORIENTATION = atoms [off++];
  281. _NET_WM_STATE_MAXIMIZED_HORZ = atoms [off++];
  282. _NET_WM_STATE_MAXIMIZED_VERT = atoms [off++];
  283. _NET_WM_STATE_HIDDEN = atoms [off++];
  284. _XEMBED = atoms [off++];
  285. _XEMBED_INFO = atoms [off++];
  286. _MOTIF_WM_HINTS = atoms [off++];
  287. _NET_WM_STATE_SKIP_TASKBAR = atoms [off++];
  288. _NET_WM_STATE_ABOVE = atoms [off++];
  289. _NET_WM_STATE_MODAL = atoms [off++];
  290. _NET_WM_CONTEXT_HELP = atoms [off++];
  291. _NET_WM_WINDOW_OPACITY = atoms [off++];
  292. _NET_WM_WINDOW_TYPE_DESKTOP = atoms [off++];
  293. _NET_WM_WINDOW_TYPE_DOCK = atoms [off++];
  294. _NET_WM_WINDOW_TYPE_TOOLBAR = atoms [off++];
  295. _NET_WM_WINDOW_TYPE_MENU = atoms [off++];
  296. _NET_WM_WINDOW_TYPE_UTILITY = atoms [off++];
  297. _NET_WM_WINDOW_TYPE_DIALOG = atoms [off++];
  298. _NET_WM_WINDOW_TYPE_SPLASH = atoms [off++];
  299. _NET_WM_WINDOW_TYPE_NORMAL = atoms [off++];
  300. CLIPBOARD = atoms [off++];
  301. PRIMARY = atoms [off++];
  302. OEMTEXT = atoms [off++];
  303. UNICODETEXT = atoms [off++];
  304. TARGETS = atoms [off++];
  305. AsyncAtom = atoms [off++];
  306. PostAtom = atoms [off++];
  307. display.HoverState.Atom = atoms [off++];
  308. DIB = XA_PIXMAP;
  309. // XXX multi screen stuff here
  310. _NET_SYSTEM_TRAY_S = Xlib.XInternAtom (display.Handle, "_NET_SYSTEM_TRAY_S" + display.DefaultScreen.ToString(), false);
  311. }
  312. }
  313. }