x11 0.0.1a2 → 0.0.1a3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. data/lib/X11/X.rb +14 -9
  2. data/lib/X11/X/c.rb +21 -20
  3. data/lib/X11/XKBlib.rb +29 -0
  4. data/lib/X11/Xatom.rb +152 -136
  5. data/lib/X11/Xatom/c.rb +15 -15
  6. data/lib/X11/Xdefs.rb +7 -7
  7. data/lib/X11/Xdefs/c.rb +20 -20
  8. data/lib/X11/Xlib.rb +19 -7
  9. data/lib/X11/Xlib/c.rb +21 -8
  10. data/lib/X11/Xlib/c/functions.rb +373 -27
  11. data/lib/X11/Xlib/c/type/any_event.rb +13 -13
  12. data/lib/X11/Xlib/c/type/button_event.rb +23 -23
  13. data/lib/X11/Xlib/c/type/circulate_event.rb +15 -15
  14. data/lib/X11/Xlib/c/type/circulate_request_event.rb +15 -15
  15. data/lib/X11/Xlib/c/type/client_message_event.rb +22 -22
  16. data/lib/X11/Xlib/c/type/colormap_event.rb +16 -16
  17. data/lib/X11/Xlib/c/type/configure_event.rb +21 -21
  18. data/lib/X11/Xlib/c/type/configure_request_event.rb +22 -22
  19. data/lib/X11/Xlib/c/type/create_window_event.rb +20 -20
  20. data/lib/X11/Xlib/c/type/crossing_event.rb +25 -25
  21. data/lib/X11/Xlib/c/type/destroy_window_event.rb +14 -14
  22. data/lib/X11/Xlib/c/type/display.rb +52 -52
  23. data/lib/X11/Xlib/c/type/error_event.rb +15 -15
  24. data/lib/X11/Xlib/c/type/event.rb +43 -43
  25. data/lib/X11/Xlib/c/type/expose_event.rb +18 -18
  26. data/lib/X11/Xlib/c/type/focus_change_event.rb +15 -15
  27. data/lib/X11/Xlib/c/type/gc.rb +10 -10
  28. data/lib/X11/Xlib/c/type/gc_values.rb +54 -0
  29. data/lib/X11/Xlib/c/type/generic_event.rb +14 -14
  30. data/lib/X11/Xlib/c/type/generic_event_cookie.rb +16 -16
  31. data/lib/X11/Xlib/c/type/graphics_expose_event.rb +21 -21
  32. data/lib/X11/Xlib/c/type/gravity_event.rb +16 -16
  33. data/lib/X11/Xlib/c/type/image.rb +56 -0
  34. data/lib/X11/Xlib/c/type/key_event.rb +23 -23
  35. data/lib/X11/Xlib/c/type/key_sym.rb +15 -15
  36. data/lib/X11/Xlib/c/type/keymap_event.rb +14 -14
  37. data/lib/X11/Xlib/c/type/map_event.rb +15 -15
  38. data/lib/X11/Xlib/c/type/map_request_event.rb +18 -18
  39. data/lib/X11/Xlib/c/type/mapping_event.rb +16 -16
  40. data/lib/X11/Xlib/c/type/motion_event.rb +23 -23
  41. data/lib/X11/Xlib/c/type/no_expose_event.rb +15 -15
  42. data/lib/X11/Xlib/c/type/point.rb +33 -0
  43. data/lib/X11/Xlib/c/type/property_event.rb +16 -16
  44. data/lib/X11/Xlib/c/type/reparent_event.rb +18 -18
  45. data/lib/X11/Xlib/c/type/resize_request_event.rb +15 -15
  46. data/lib/X11/Xlib/c/type/screen.rb +27 -27
  47. data/lib/X11/Xlib/c/type/selection_clear_event.rb +15 -15
  48. data/lib/X11/Xlib/c/type/selection_event.rb +17 -17
  49. data/lib/X11/Xlib/c/type/selection_request_event.rb +18 -18
  50. data/lib/X11/Xlib/c/type/status.rb +15 -15
  51. data/lib/X11/Xlib/c/type/unmap_event.rb +15 -15
  52. data/lib/X11/Xlib/c/type/visibility_event.rb +14 -14
  53. data/lib/X11/Xlib/c/type/visual.rb +16 -16
  54. data/lib/X11/Xlib/c/type/window_attributes.rb +31 -31
  55. data/lib/X11/Xlib/c/types.rb +9 -7
  56. data/lib/X11/Xlib/display.rb +257 -174
  57. data/lib/X11/Xlib/display/extensions.rb +56 -0
  58. data/lib/X11/Xlib/drawable.rb +48 -0
  59. data/lib/X11/Xlib/error.rb +100 -0
  60. data/lib/X11/Xlib/event.rb +66 -37
  61. data/lib/X11/Xlib/event/any.rb +8 -10
  62. data/lib/X11/Xlib/event/button_press.rb +9 -20
  63. data/lib/X11/Xlib/event/button_release.rb +9 -20
  64. data/lib/X11/Xlib/event/circulate_notify.rb +11 -12
  65. data/lib/X11/Xlib/event/circulate_request.rb +11 -12
  66. data/lib/X11/Xlib/event/client_message.rb +11 -13
  67. data/lib/X11/Xlib/event/colormap_notify.rb +12 -13
  68. data/lib/X11/Xlib/event/configure_notify.rb +17 -18
  69. data/lib/X11/Xlib/event/configure_request.rb +18 -19
  70. data/lib/X11/Xlib/event/create_notify.rb +16 -17
  71. data/lib/X11/Xlib/event/destroy_notify.rb +10 -11
  72. data/lib/X11/Xlib/event/enter_notify.rb +10 -8
  73. data/lib/X11/Xlib/event/expose.rb +15 -16
  74. data/lib/X11/Xlib/event/focus_in.rb +9 -12
  75. data/lib/X11/Xlib/event/focus_out.rb +9 -12
  76. data/lib/X11/Xlib/event/generic.rb +35 -0
  77. data/lib/X11/Xlib/event/generic/button.rb +46 -0
  78. data/lib/X11/Xlib/event/generic/crossing.rb +48 -0
  79. data/lib/X11/Xlib/{window/properties/property/class.rb → event/generic/focus_change.rb} +16 -14
  80. data/lib/X11/Xlib/event/generic/key.rb +46 -0
  81. data/lib/X11/Xlib/event/generic/motion.rb +46 -0
  82. data/lib/X11/Xlib/event/generic_event.rb +12 -14
  83. data/lib/X11/Xlib/event/graphics_expose.rb +15 -14
  84. data/lib/X11/Xlib/event/gravity_notify.rb +12 -13
  85. data/lib/X11/Xlib/event/helper.rb +123 -91
  86. data/lib/X11/Xlib/event/key_press.rb +9 -20
  87. data/lib/X11/Xlib/event/key_release.rb +9 -20
  88. data/lib/X11/Xlib/event/keymap_notify.rb +13 -14
  89. data/lib/X11/Xlib/event/leave_notify.rb +10 -20
  90. data/lib/X11/Xlib/event/map_notify.rb +11 -12
  91. data/lib/X11/Xlib/event/map_request.rb +10 -11
  92. data/lib/X11/Xlib/event/mapping_notify.rb +11 -13
  93. data/lib/X11/Xlib/event/motion_notify.rb +10 -20
  94. data/lib/X11/Xlib/event/no_expose.rb +8 -9
  95. data/lib/X11/Xlib/event/property_notify.rb +12 -13
  96. data/lib/X11/Xlib/event/reparent_notify.rb +14 -15
  97. data/lib/X11/Xlib/event/resize_request.rb +11 -12
  98. data/lib/X11/Xlib/event/selection_clear.rb +10 -12
  99. data/lib/X11/Xlib/event/selection_notify.rb +13 -15
  100. data/lib/X11/Xlib/event/selection_request.rb +14 -16
  101. data/lib/X11/Xlib/event/unmap_notify.rb +11 -12
  102. data/lib/X11/Xlib/event/visibility_notify.rb +10 -11
  103. data/lib/X11/Xlib/events.rb +11 -7
  104. data/lib/X11/Xlib/exceptions.rb +10 -10
  105. data/lib/X11/Xlib/graphic_context.rb +69 -0
  106. data/lib/X11/Xlib/graphic_context/functions.rb +50 -0
  107. data/lib/X11/Xlib/{window/properties/property/command.rb → graphic_context/values.rb} +17 -13
  108. data/lib/X11/Xlib/hints.rb +19 -18
  109. data/lib/X11/Xlib/hints/flags.rb +15 -15
  110. data/lib/X11/Xlib/hints/icon.rb +14 -16
  111. data/lib/X11/Xlib/id.rb +75 -0
  112. data/lib/X11/Xlib/image.rb +64 -0
  113. data/lib/X11/Xlib/keysym.rb +53 -26
  114. data/lib/X11/Xlib/mask.rb +81 -55
  115. data/lib/X11/Xlib/pixmap.rb +60 -0
  116. data/lib/X11/Xlib/planes.rb +50 -0
  117. data/lib/X11/Xlib/revert_to.rb +10 -10
  118. data/lib/X11/Xlib/screen.rb +48 -31
  119. data/lib/X11/Xlib/status.rb +56 -56
  120. data/lib/X11/Xlib/transform.rb +25 -25
  121. data/lib/X11/Xlib/visual.rb +19 -19
  122. data/lib/X11/Xlib/window.rb +399 -188
  123. data/lib/X11/Xlib/window/attributes.rb +74 -41
  124. data/lib/X11/Xlib/window/properties.rb +57 -38
  125. data/lib/X11/Xlib/window/properties/property.rb +135 -70
  126. data/lib/X11/Xlib/window/properties/property/net_virtual_root.rb +13 -13
  127. data/lib/X11/Xlib/window/properties/property/parser.rb +45 -35
  128. data/lib/X11/Xlib/window/properties/property/parser/arc.rb +18 -16
  129. data/lib/X11/Xlib/window/properties/property/parser/atom.rb +14 -10
  130. data/lib/X11/Xlib/window/properties/property/parser/cardinal.rb +14 -9
  131. data/lib/X11/Xlib/window/properties/property/parser/hints.rb +17 -16
  132. data/lib/X11/Xlib/window/properties/property/parser/integer.rb +39 -0
  133. data/lib/X11/Xlib/window/properties/property/parser/state.rb +39 -0
  134. data/lib/X11/Xlib/window/properties/property/parser/string.rb +59 -0
  135. data/lib/X11/Xlib/window/properties/property/parser/window.rb +39 -0
  136. data/lib/X11/Xmd.rb +7 -7
  137. data/lib/X11/Xmd/c.rb +19 -19
  138. data/lib/X11/Xregion.rb +32 -0
  139. data/lib/X11/Xregion/c.rb +29 -0
  140. data/lib/X11/Xregion/c/type/box.rb +35 -0
  141. data/lib/X11/Xregion/c/type/point_block.rb +33 -0
  142. data/lib/X11/Xregion/c/type/rectangle.rb +35 -0
  143. data/lib/X11/Xregion/c/type/region.rb +35 -0
  144. data/lib/X11/Xregion/c/types.rb +32 -0
  145. data/lib/X11/Xutil.rb +12 -17
  146. data/lib/X11/Xutil/c.rb +7 -10
  147. data/lib/X11/Xutil/c/functions.rb +7 -7
  148. data/lib/X11/Xutil/c/type/class_hint.rb +10 -10
  149. data/lib/X11/Xutil/c/type/region.rb +31 -0
  150. data/lib/X11/Xutil/c/type/text_property.rb +12 -12
  151. data/lib/X11/Xutil/c/types.rb +8 -7
  152. data/lib/X11/Xutil/state.rb +43 -0
  153. data/lib/X11/Xutil/window.rb +28 -28
  154. data/lib/X11/cursorfont.rb +7 -7
  155. data/lib/X11/cursorfont/c.rb +8 -8
  156. data/lib/X11/cursorfont/font.rb +113 -113
  157. data/lib/X11/extension.rb +65 -0
  158. data/lib/X11/extensions.rb +105 -126
  159. data/lib/X11/extensions/Xrandr.rb +49 -0
  160. data/lib/X11/extensions/Xrandr/c.rb +30 -0
  161. data/lib/X11/extensions/Xrandr/c/functions.rb +106 -0
  162. data/lib/X11/extensions/Xrandr/c/type/crtc_gamma.rb +35 -0
  163. data/lib/X11/extensions/Xrandr/c/type/crtc_info.rb +43 -0
  164. data/lib/X11/extensions/Xrandr/c/type/crtc_transform_attributes.rb +39 -0
  165. data/lib/X11/extensions/Xrandr/c/type/mode_info.rb +45 -0
  166. data/lib/X11/extensions/Xrandr/c/type/output_info.rb +46 -0
  167. data/lib/X11/extensions/Xrandr/c/type/panning.rb +44 -0
  168. data/lib/X11/extensions/Xrandr/c/type/property_info.rb +36 -0
  169. data/lib/X11/extensions/Xrandr/c/type/screen_resources.rb +39 -0
  170. data/lib/X11/extensions/Xrandr/c/type/screen_size.rb +35 -0
  171. data/lib/X11/extensions/Xrandr/c/types.rb +48 -0
  172. data/lib/X11/extensions/Xrandr/crtc.rb +70 -0
  173. data/lib/X11/extensions/Xrandr/crtc/gamma.rb +100 -0
  174. data/lib/X11/extensions/Xrandr/crtc/info.rb +62 -0
  175. data/lib/X11/extensions/Xrandr/crtc/panning.rb +74 -0
  176. data/lib/X11/extensions/Xrandr/event.rb +29 -0
  177. data/lib/X11/extensions/Xrandr/output.rb +59 -0
  178. data/lib/X11/extensions/Xrandr/output/info.rb +105 -0
  179. data/lib/X11/extensions/Xrandr/output/properties.rb +78 -0
  180. data/lib/X11/extensions/Xrandr/output/properties/property.rb +161 -0
  181. data/lib/X11/extensions/Xrandr/output/properties/property/info.rb +73 -0
  182. data/lib/X11/extensions/Xrandr/output/properties/property/parser.rb +73 -0
  183. data/lib/X11/extensions/Xrandr/output/properties/property/parser/atom.rb +39 -0
  184. data/lib/X11/extensions/Xrandr/output/properties/property/parser/integer.rb +43 -0
  185. data/lib/X11/extensions/Xrandr/screen.rb +49 -0
  186. data/lib/X11/extensions/Xrandr/screen/backlight.rb +76 -0
  187. data/lib/X11/extensions/Xrandr/screen_resources.rb +81 -0
  188. data/lib/X11/extensions/Xrandr/window.rb +41 -0
  189. data/lib/X11/extensions/Xrender.rb +34 -0
  190. data/lib/X11/extensions/Xrender/c.rb +30 -0
  191. data/lib/X11/extensions/Xrender/c/functions.rb +50 -0
  192. data/lib/X11/extensions/Xrender/c/type/anim_cursor.rb +33 -0
  193. data/lib/X11/extensions/Xrender/c/type/circle.rb +34 -0
  194. data/lib/X11/extensions/Xrender/c/type/conical_gradient.rb +33 -0
  195. data/lib/X11/extensions/Xrender/c/type/filters.rb +35 -0
  196. data/lib/X11/extensions/Xrender/c/type/glyph_elt16.rb +36 -0
  197. data/lib/X11/extensions/Xrender/c/type/glyph_elt32.rb +36 -0
  198. data/lib/X11/extensions/Xrender/c/type/glyph_elt8.rb +36 -0
  199. data/lib/X11/extensions/Xrender/c/type/glyph_info.rb +37 -0
  200. data/lib/X11/extensions/Xrender/c/type/index_value.rb +36 -0
  201. data/lib/X11/extensions/Xrender/c/type/line_fixed.rb +33 -0
  202. data/lib/X11/extensions/Xrender/c/type/linear_gradient.rb +33 -0
  203. data/lib/X11/extensions/Xrender/c/type/point_double.rb +33 -0
  204. data/lib/X11/extensions/Xrender/c/type/point_fixed.rb +33 -0
  205. data/lib/X11/extensions/Xrender/c/type/radial_gradient.rb +33 -0
  206. data/lib/X11/extensions/Xrender/c/type/render_color.rb +35 -0
  207. data/lib/X11/extensions/Xrender/c/type/render_direct_format.rb +39 -0
  208. data/lib/X11/extensions/Xrender/c/type/render_pict_format.rb +36 -0
  209. data/lib/X11/extensions/Xrender/c/type/render_picture_attributes.rb +44 -0
  210. data/lib/X11/extensions/Xrender/c/type/span_fix.rb +34 -0
  211. data/lib/X11/extensions/Xrender/c/type/transform.rb +32 -0
  212. data/lib/X11/extensions/Xrender/c/type/trap.rb +33 -0
  213. data/lib/X11/extensions/Xrender/c/type/trapezoid.rb +35 -0
  214. data/lib/X11/extensions/Xrender/c/type/triangle.rb +34 -0
  215. data/lib/X11/extensions/Xrender/c/types.rb +56 -0
  216. data/lib/X11/extensions/Xrender/mask.rb +48 -0
  217. data/lib/X11/extensions/randr.rb +29 -0
  218. data/lib/X11/extensions/randr/c.rb +38 -0
  219. data/lib/X11/extensions/render.rb +29 -0
  220. data/lib/X11/extensions/render/c.rb +34 -0
  221. data/lib/X11/extensions/xf86vmode.rb +42 -0
  222. data/lib/X11/extensions/xf86vmode/c.rb +30 -0
  223. data/lib/X11/extensions/xf86vmode/c/functions.rb +59 -0
  224. data/lib/X11/extensions/xf86vmode/c/type/gamma.rb +34 -0
  225. data/lib/X11/extensions/xf86vmode/c/type/mode_info.rb +44 -0
  226. data/lib/X11/extensions/xf86vmode/c/type/mode_line.rb +43 -0
  227. data/lib/X11/extensions/xf86vmode/c/type/monitor.rb +38 -0
  228. data/lib/X11/extensions/xf86vmode/c/type/sync_range.rb +33 -0
  229. data/lib/X11/extensions/xf86vmode/c/types.rb +36 -0
  230. data/lib/X11/extensions/xf86vmode/screen.rb +53 -0
  231. data/lib/X11/extensions/xf86vmode/screen/gamma.rb +79 -0
  232. data/lib/X11/extensions/xf86vmode/screen/gamma/ramp.rb +86 -0
  233. data/lib/X11/keysym.rb +7 -25
  234. data/lib/X11/misc/temperature.rb +458 -0
  235. data/lib/X11/simple.rb +8 -7
  236. data/lib/X11/simple/display.rb +35 -37
  237. data/lib/X11/simple/window.rb +39 -19
  238. data/lib/X11/window_manager.rb +32 -0
  239. data/lib/X11/window_manager/desktops.rb +82 -0
  240. data/lib/X11/window_manager/desktops/desktop.rb +78 -0
  241. data/lib/X11/window_manager/supports.rb +56 -0
  242. data/lib/X11/window_manager/supports/feature.rb +46 -0
  243. data/lib/X11/window_manager/window.rb +102 -0
  244. data/lib/X11/window_manager/window_manager.rb +73 -0
  245. metadata +216 -66
@@ -1,26 +1,26 @@
1
1
  #--
2
2
  # Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
3
- #
3
+ #
4
4
  # Redistribution and use in source and binary forms, with or without modification, are
5
5
  # permitted provided that the following conditions are met:
6
- #
6
+ #
7
7
  # 1. Redistributions of source code must retain the above copyright notice, this list of
8
8
  # conditions and the following disclaimer.
9
- #
9
+ #
10
10
  # 2. Redistributions in binary form must reproduce the above copyright notice, this list
11
11
  # of conditions and the following disclaimer in the documentation and/or other materials
12
12
  # provided with the distribution.
13
- #
14
- # THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ''AS IS'' AND ANY EXPRESS OR IMPLIED
13
+ #
14
+ # THIS SOFTWARE IS PROVIDED BY meh ''AS IS'' AND ANY EXPRESS OR IMPLIED
15
15
  # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
- # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
16
+ # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL meh OR
17
17
  # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
18
  # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
19
  # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
20
  # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
21
  # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22
22
  # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
- #
23
+ #
24
24
  # The views and conclusions contained in the software and documentation are those of the
25
25
  # authors and should not be interpreted as representing official policies, either expressed
26
26
  # or implied.
@@ -29,119 +29,119 @@
29
29
  module X11; module Cursor
30
30
 
31
31
  class Font
32
- module Shapes
33
- @shapes = {
34
- :num_glyphs => 154,
35
- :X_cursor => 0,
36
- :arrow => 2,
37
- :based_arrow_down => 4,
38
- :based_arrow_up => 6,
39
- :boat => 8,
40
- :bogosity => 10,
41
- :bottom_left_corner => 12,
42
- :bottom_right_corner => 14,
43
- :bottom_side => 16,
44
- :bottom_tee => 18,
45
- :box_spiral => 20,
46
- :center_ptr => 22,
47
- :circle => 24,
48
- :clock => 26,
49
- :coffee_mug => 28,
50
- :cross => 30,
51
- :cross_reverse => 32,
52
- :crosshair => 34,
53
- :diamond_cross => 36,
54
- :dot => 38,
55
- :dotbox => 40,
56
- :double_arrow => 42,
57
- :draft_large => 44,
58
- :draft_small => 46,
59
- :draped_box => 48,
60
- :exchange => 50,
61
- :fleur => 52,
62
- :gobbler => 54,
63
- :gumby => 56,
64
- :hand1 => 58,
65
- :hand2 => 60,
66
- :heart => 62,
67
- :icon => 64,
68
- :iron_cross => 66,
69
- :left_ptr => 68,
70
- :left_side => 70,
71
- :left_tee => 72,
72
- :leftbutton => 74,
73
- :ll_angle => 76,
74
- :lr_angle => 78,
75
- :man => 80,
76
- :middlebutton => 82,
77
- :mouse => 84,
78
- :pencil => 86,
79
- :pirate => 88,
80
- :plus => 90,
81
- :question_arrow => 92,
82
- :right_ptr => 94,
83
- :right_side => 96,
84
- :right_tee => 98,
85
- :rightbutton => 100,
86
- :rtl_logo => 102,
87
- :sailboat => 104,
88
- :sb_down_arrow => 106,
89
- :sb_h_double_arrow => 108,
90
- :sb_left_arrow => 110,
91
- :sb_right_arrow => 112,
92
- :sb_up_arrow => 114,
93
- :sb_v_double_arrow => 116,
94
- :shuttle => 118,
95
- :sizing => 120,
96
- :spider => 122,
97
- :spraycan => 124,
98
- :star => 126,
99
- :target => 128,
100
- :tcross => 130,
101
- :top_left_arrow => 132,
102
- :top_left_corner => 134,
103
- :top_right_corner => 136,
104
- :top_side => 138,
105
- :top_tee => 140,
106
- :trek => 142,
107
- :ul_angle => 144,
108
- :umbrella => 146,
109
- :ur_angle => 148,
110
- :watch => 150,
111
- :xterm => 152
112
- }
32
+ module Shapes
33
+ @shapes = {
34
+ :num_glyphs => 154,
35
+ :X_cursor => 0,
36
+ :arrow => 2,
37
+ :based_arrow_down => 4,
38
+ :based_arrow_up => 6,
39
+ :boat => 8,
40
+ :bogosity => 10,
41
+ :bottom_left_corner => 12,
42
+ :bottom_right_corner => 14,
43
+ :bottom_side => 16,
44
+ :bottom_tee => 18,
45
+ :box_spiral => 20,
46
+ :center_ptr => 22,
47
+ :circle => 24,
48
+ :clock => 26,
49
+ :coffee_mug => 28,
50
+ :cross => 30,
51
+ :cross_reverse => 32,
52
+ :crosshair => 34,
53
+ :diamond_cross => 36,
54
+ :dot => 38,
55
+ :dotbox => 40,
56
+ :double_arrow => 42,
57
+ :draft_large => 44,
58
+ :draft_small => 46,
59
+ :draped_box => 48,
60
+ :exchange => 50,
61
+ :fleur => 52,
62
+ :gobbler => 54,
63
+ :gumby => 56,
64
+ :hand1 => 58,
65
+ :hand2 => 60,
66
+ :heart => 62,
67
+ :icon => 64,
68
+ :iron_cross => 66,
69
+ :left_ptr => 68,
70
+ :left_side => 70,
71
+ :left_tee => 72,
72
+ :leftbutton => 74,
73
+ :ll_angle => 76,
74
+ :lr_angle => 78,
75
+ :man => 80,
76
+ :middlebutton => 82,
77
+ :mouse => 84,
78
+ :pencil => 86,
79
+ :pirate => 88,
80
+ :plus => 90,
81
+ :question_arrow => 92,
82
+ :right_ptr => 94,
83
+ :right_side => 96,
84
+ :right_tee => 98,
85
+ :rightbutton => 100,
86
+ :rtl_logo => 102,
87
+ :sailboat => 104,
88
+ :sb_down_arrow => 106,
89
+ :sb_h_double_arrow => 108,
90
+ :sb_left_arrow => 110,
91
+ :sb_right_arrow => 112,
92
+ :sb_up_arrow => 114,
93
+ :sb_v_double_arrow => 116,
94
+ :shuttle => 118,
95
+ :sizing => 120,
96
+ :spider => 122,
97
+ :spraycan => 124,
98
+ :star => 126,
99
+ :target => 128,
100
+ :tcross => 130,
101
+ :top_left_arrow => 132,
102
+ :top_left_corner => 134,
103
+ :top_right_corner => 136,
104
+ :top_side => 138,
105
+ :top_tee => 140,
106
+ :trek => 142,
107
+ :ul_angle => 144,
108
+ :umbrella => 146,
109
+ :ur_angle => 148,
110
+ :watch => 150,
111
+ :xterm => 152
112
+ }
113
113
 
114
- def self.[] (name)
115
- if name.is_a?(Integer)
116
- @shapes.key(name)
117
- else
118
- @shapes[name.to_s.to_sym]
119
- end
120
- end
114
+ def self.[] (name)
115
+ if name.is_a?(Integer)
116
+ @shapes.key(name)
117
+ else
118
+ @shapes[name.to_s.to_sym]
119
+ end
120
+ end
121
121
 
122
- def self.const_missing (name)
123
- @shapes[name]
124
- end
122
+ def self.const_missing (name)
123
+ @shapes[name]
124
+ end
125
125
 
126
- def self.method_missing (name, *)
127
- @shapes[name]
128
- end
129
- end
126
+ def self.method_missing (name, *)
127
+ @shapes[name]
128
+ end
129
+ end
130
130
 
131
- attr_reader :display
131
+ attr_reader :display
132
132
 
133
- def initialize (display, shape)
134
- @display = display
135
- @shape = shape.is_a?(Integer) ? shape : Shapes[shape]
136
- end
133
+ def initialize (display, shape)
134
+ @display = display
135
+ @shape = shape.is_a?(Integer) ? shape : Shapes[shape]
136
+ end
137
137
 
138
- def to_s
139
- Shapes[@shape].to_s
140
- end
138
+ def to_s
139
+ Shapes[@shape].to_s
140
+ end
141
141
 
142
- def to_ffi
143
- C::XCreateFontCursor(display.to_ffi, @shape)
144
- end
142
+ def to_ffi
143
+ C::XCreateFontCursor(display.to_ffi, @shape)
144
+ end
145
145
  end
146
146
 
147
147
  end; end
@@ -0,0 +1,65 @@
1
+ #--
2
+ # Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
3
+ #
4
+ # Redistribution and use in source and binary forms, with or without modification, are
5
+ # permitted provided that the following conditions are met:
6
+ #
7
+ # 1. Redistributions of source code must retain the above copyright notice, this list of
8
+ # conditions and the following disclaimer.
9
+ #
10
+ # 2. Redistributions in binary form must reproduce the above copyright notice, this list
11
+ # of conditions and the following disclaimer in the documentation and/or other materials
12
+ # provided with the distribution.
13
+ #
14
+ # THIS SOFTWARE IS PROVIDED BY meh ''AS IS'' AND ANY EXPRESS OR IMPLIED
15
+ # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
+ # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL meh OR
17
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
+ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22
+ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+ #
24
+ # The views and conclusions contained in the software and documentation are those of the
25
+ # authors and should not be interpreted as representing official policies, either expressed
26
+ # or implied.
27
+ #++
28
+
29
+ module X11
30
+
31
+ class Extension
32
+ @@extensions = []
33
+
34
+ def self.define (name, &block)
35
+ @@extensions << self.new(name, &block)
36
+ end
37
+
38
+ def self.list
39
+ @@extensions
40
+ end
41
+
42
+ attr_reader :name
43
+
44
+ def initialize (name, &block)
45
+ @name = name
46
+ @block = block
47
+ end
48
+
49
+ def apply (display)
50
+ instance_exec display, &@block
51
+ end
52
+
53
+ def new (data)
54
+ result = dup
55
+
56
+ result.instance_variable_set :@data, data
57
+ result.define_singleton_method :method_missing do |*args, &block|
58
+ @data.__send__ *args, &block
59
+ end
60
+
61
+ result
62
+ end
63
+ end
64
+
65
+ end
@@ -1,148 +1,127 @@
1
1
  #--
2
- # Copyleft shura. [ shura1991@gmail.com ]
2
+ # Copyleft meh. [http://meh.paranoid.pk | meh@paranoici.org]
3
3
  #
4
- # This file is part of sysctl.
4
+ # Redistribution and use in source and binary forms, with or without modification, are
5
+ # permitted provided that the following conditions are met:
5
6
  #
6
- # sysctl is free software: you can redistribute it and/or modify
7
- # it under the terms of the GNU Affero General Public License as published
8
- # by the Free Software Foundation, either version 3 of the License, or
9
- # (at your option) any later version.
7
+ # 1. Redistributions of source code must retain the above copyright notice, this list of
8
+ # conditions and the following disclaimer.
10
9
  #
11
- # sysctl is distributed in the hope that it will be useful,
12
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU Affero General Public License for more details.
10
+ # 2. Redistributions in binary form must reproduce the above copyright notice, this list
11
+ # of conditions and the following disclaimer in the documentation and/or other materials
12
+ # provided with the distribution.
15
13
  #
16
- # You should have received a copy of the GNU Affero General Public License
17
- # along with sysctl. If not, see <http://www.gnu.org/licenses/>.
14
+ # THIS SOFTWARE IS PROVIDED BY meh ''AS IS'' AND ANY EXPRESS OR IMPLIED
15
+ # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
+ # FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL meh OR
17
+ # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
+ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22
+ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+ #
24
+ # The views and conclusions contained in the software and documentation are those of the
25
+ # authors and should not be interpreted as representing official policies, either expressed
26
+ # or implied.
18
27
  #++
19
28
 
20
- require 'ffi' unless defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
21
- require 'memoized'
29
+ require 'forwardable'
30
+ require 'ostruct'
31
+
32
+ require 'require/on'
33
+ require 'ffi'
34
+ require 'ffi/extra'
35
+ require 'versionub'
36
+ require 'call-me/memoize'
37
+ require 'call-me/named'
22
38
  require 'refining'
23
39
  require 'retarded'
24
40
  require 'bitmap'
25
- require 'forwardable'
26
- require 'ostruct'
41
+ require 'with'
27
42
 
28
43
  module Kernel
29
- def with (*args)
30
- yield *args
31
- end
32
-
33
- def suppress_warnings
34
- exception = nil
35
- tmp, $VERBOSE = $VERBOSE, nil
36
-
37
- begin
38
- result = yield
39
- rescue Exception => e
40
- exception = e
41
- end
42
-
43
- $VERBOSE = tmp
44
-
45
- if exception
46
- raise exception
47
- else
48
- result
49
- end
50
- end
44
+ def suppress_warnings
45
+ exception = nil
46
+ tmp, $VERBOSE = $VERBOSE, nil
47
+
48
+ begin
49
+ result = yield
50
+ rescue Exception => e
51
+ exception = e
52
+ end
53
+
54
+ $VERBOSE = tmp
55
+
56
+ if exception
57
+ raise exception
58
+ else
59
+ result
60
+ end
61
+ end
51
62
  end
52
63
 
53
- module FFI
54
- def self.type_size (type)
55
- type = FFI.find_type(type) if type.is_a?(Symbol)
56
-
57
- if type.is_a?(Class) && (type.ancestors.member?(FFI::Struct) && !type.is_a?(FFI::ManagedStruct)) || type.is_a?(Type::Builtin)
58
- type.size
59
- elsif type.respond_to? :from_native
60
- type.native_type.size
61
- else
62
- raise ArgumentError, 'you have to pass a Struct, a Builtin type or a Symbol'
63
- end
64
- end
65
-
66
- module Library
67
- def ffi_lib_add (*names)
68
- ffi_lib *((begin
69
- ffi_libraries
70
- rescue Exception
71
- []
72
- end).map {|lib|
73
- lib.name
74
- } + names).compact.uniq.reject {|lib|
75
- lib == '[current process]'
76
- }
77
- end
78
-
79
- def has_function? (sym, libraries=nil)
80
- libraries ||= ffi_libraries
81
-
82
- libraries.any? {|lib|
83
- if lib.is_a?(DynamicLibrary)
84
- lib
85
- else
86
- DynamicLibrary.new(lib, 0)
87
- end.find_function(sym.to_s) rescue nil
88
- }
89
- end
90
-
91
- def attach_function! (*args, &block)
92
- begin
93
- attach_function(*args, &block)
94
- rescue Exception => e
95
- false
96
- end
97
- end
98
- end
99
-
100
- class Type::Builtin
101
- def name
102
- inspect[/:(\w+) /][1 .. -2]
103
- end
104
- end
105
-
106
- class Pointer
107
- def typecast (type)
108
- type = FFI.find_type(type) if type.is_a?(Symbol)
109
-
110
- if type.is_a?(Class) && type.ancestors.member?(FFI::Struct) && !type.is_a?(FFI::ManagedStruct)
111
- type.new(self)
112
- elsif type.is_a?(Type::Builtin)
113
- send "read_#{type.name.downcase}"
114
- elsif type.respond_to? :from_native
115
- type.from_native(typecast(type.native_type), nil)
116
- else
117
- raise ArgumentError, 'you have to pass a Struct, a Builtin type or a Symbol'
118
- end
119
- end
120
-
121
- def read_array_of (type, number)
122
- type = FFI.find_type(type) if type.is_a?(Symbol)
123
- type = type.native_type if type.respond_to? :native_type
124
-
125
- send "read_array_of_#{type.name.downcase}", number
126
- end
127
- end
128
-
129
- find_type(:size_t) rescue typedef(:ulong, :size_t)
64
+ class Object
65
+ def to_bool
66
+ !!self
67
+ end
130
68
  end
131
69
 
132
- class Integer
133
- def to_ffi
134
- self
135
- end
70
+ class Bitmap::Value
71
+ alias to_ffi to_i
136
72
  end
137
73
 
138
- class String
139
- def to_ffi
140
- self
141
- end
74
+ class Array
75
+ def singly
76
+ length == 1 ? first : self
77
+ end
142
78
  end
143
79
 
144
- class Bitmap::Value
145
- alias to_ffi to_i
80
+ module ForwardTo
81
+ def self.included (what)
82
+ what.instance_eval {
83
+ extend Forwardable
84
+
85
+ @__forward_to__ = []
86
+
87
+ def self.forward_to (*what)
88
+ return @__forward_to__ if what.empty?
89
+
90
+ @__forward_to__ << what
91
+ @__forward_to__.flatten!
92
+ @__forward_to__.compact!
93
+ @__forward_to__.uniq!
94
+ end
95
+ }
96
+ end
97
+
98
+ def method_missing (name, *args, &block)
99
+ self.class.forward_to.each {|target|
100
+ target = if target.to_s.start_with?('@')
101
+ instance_variable_get target
102
+ else
103
+ if target.is_a?(Array)
104
+ __send__ target.first, *target[1 .. -1]
105
+ else
106
+ __send__ target
107
+ end
108
+ end
109
+
110
+ if target.respond_to? name
111
+ return target.__send__ name, *args, &block
112
+ end
113
+ }
114
+
115
+ super
116
+ end
117
+ end
118
+
119
+ class Integer
120
+ alias ok? zero?
146
121
  end
147
122
 
148
- module X11; module C; extend FFI::Library; end; end
123
+ module X11; module C
124
+ extend FFI::Library
125
+ end; end
126
+
127
+ require 'X11/extension'