x11 0.0.1a1 → 0.0.1a2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/X11/X.rb +3 -0
- data/lib/X11/X/c.rb +16 -15
- data/lib/X11/Xatom.rb +167 -0
- data/lib/X11/Xatom/c.rb +52 -0
- data/lib/X11/Xdefs/c.rb +10 -6
- data/lib/X11/Xlib.rb +6 -0
- data/lib/X11/Xlib/c/functions.rb +15 -0
- data/lib/X11/Xlib/c/type/key_sym.rb +47 -0
- data/lib/X11/Xlib/c/type/status.rb +47 -0
- data/lib/X11/Xlib/c/types.rb +2 -0
- data/lib/X11/Xlib/display.rb +128 -28
- data/lib/X11/Xlib/event.rb +15 -0
- data/lib/X11/Xlib/event/generic_event.rb +1 -1
- data/lib/X11/Xlib/event/helper.rb +19 -13
- data/lib/X11/Xlib/exceptions.rb +37 -0
- data/lib/X11/Xlib/hints.rb +49 -0
- data/lib/X11/Xlib/hints/flags.rb +42 -0
- data/lib/X11/Xlib/hints/icon.rb +44 -0
- data/lib/X11/Xlib/keysym.rb +53 -0
- data/lib/X11/Xlib/mask.rb +52 -40
- data/lib/X11/Xlib/revert_to.rb +37 -0
- data/lib/X11/Xlib/screen.rb +12 -1
- data/lib/X11/Xlib/status.rb +93 -0
- data/lib/X11/Xlib/transform.rb +58 -0
- data/lib/X11/Xlib/window.rb +164 -51
- data/lib/X11/Xlib/window/properties.rb +66 -0
- data/lib/X11/Xlib/window/properties/property.rb +98 -0
- data/lib/X11/Xlib/window/properties/property/class.rb +37 -0
- data/lib/X11/Xlib/window/properties/property/command.rb +37 -0
- data/lib/X11/Xlib/window/properties/property/net_virtual_root.rb +39 -0
- data/lib/X11/Xlib/window/properties/property/parser.rb +69 -0
- data/lib/X11/Xlib/window/properties/property/parser/arc.rb +41 -0
- data/lib/X11/Xlib/window/properties/property/parser/atom.rb +35 -0
- data/lib/X11/Xlib/window/properties/property/parser/cardinal.rb +34 -0
- data/lib/X11/Xlib/window/properties/property/parser/hints.rb +41 -0
- data/lib/X11/Xmd/c.rb +14 -12
- data/lib/X11/Xutil.rb +41 -0
- data/lib/X11/Xutil/c.rb +33 -0
- data/lib/X11/Xutil/c/functions.rb +37 -0
- data/lib/X11/Xutil/c/type/class_hint.rb +33 -0
- data/lib/X11/Xutil/c/type/text_property.rb +35 -0
- data/lib/X11/Xutil/c/types.rb +30 -0
- data/lib/X11/Xutil/window.rb +61 -0
- data/lib/X11/cursorfont.rb +31 -0
- data/lib/X11/cursorfont/c.rb +41 -0
- data/lib/X11/cursorfont/font.rb +147 -0
- data/lib/X11/extensions.rb +81 -16
- data/lib/X11/keysym.rb +47 -0
- data/lib/X11/simple.rb +33 -0
- data/lib/X11/simple/display.rb +64 -0
- data/lib/X11/simple/window.rb +45 -0
- metadata +63 -5
data/lib/X11/X.rb
CHANGED
data/lib/X11/X/c.rb
CHANGED
@@ -26,23 +26,24 @@
|
|
26
26
|
# or implied.
|
27
27
|
#++
|
28
28
|
|
29
|
-
require 'X11/
|
29
|
+
require 'X11/Xatom'
|
30
30
|
|
31
31
|
module X11; module C
|
32
32
|
|
33
|
-
|
34
|
-
typedef :ulong, :
|
35
|
-
typedef :ulong, :
|
36
|
-
typedef :ulong, :VisualID
|
37
|
-
typedef :ulong, :Time
|
38
|
-
typedef :XID, :Window
|
39
|
-
typedef :XID, :Drawable
|
40
|
-
typedef :XID, :Font
|
41
|
-
typedef :XID, :Pixmap
|
42
|
-
typedef :XID, :Cursor
|
43
|
-
typedef :XID, :Colormap
|
44
|
-
typedef :XID, :GContext
|
45
|
-
typedef :XID, :KeySym
|
46
|
-
typedef :uchar, :KeyCode
|
33
|
+
module ::FFI
|
34
|
+
typedef :ulong, :XID
|
35
|
+
typedef :ulong, :Mask
|
36
|
+
typedef :ulong, :VisualID
|
37
|
+
typedef :ulong, :Time
|
38
|
+
typedef :XID, :Window
|
39
|
+
typedef :XID, :Drawable
|
40
|
+
typedef :XID, :Font
|
41
|
+
typedef :XID, :Pixmap
|
42
|
+
typedef :XID, :Cursor
|
43
|
+
typedef :XID, :Colormap
|
44
|
+
typedef :XID, :GContext
|
45
|
+
typedef :XID, :KeySym
|
46
|
+
typedef :uchar, :KeyCode
|
47
|
+
end
|
47
48
|
|
48
49
|
end; end
|
data/lib/X11/Xatom.rb
ADDED
@@ -0,0 +1,167 @@
|
|
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 <COPYRIGHT HOLDER> ''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 <COPYRIGHT HOLDER> 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
|
+
require 'X11/extensions'
|
30
|
+
|
31
|
+
module X11
|
32
|
+
|
33
|
+
class Atom
|
34
|
+
@atoms = {
|
35
|
+
:PRIMARY => 1,
|
36
|
+
:SECONDARY => 2,
|
37
|
+
:ARC => 3,
|
38
|
+
:ATOM => 4,
|
39
|
+
:BITMAP => 5,
|
40
|
+
:CARDINAL => 6,
|
41
|
+
:COLORMAP => 7,
|
42
|
+
:CURSOR => 8,
|
43
|
+
:CUT_BUFFER0 => 9,
|
44
|
+
:CUT_BUFFER1 => 10,
|
45
|
+
:CUT_BUFFER2 => 11,
|
46
|
+
:CUT_BUFFER3 => 12,
|
47
|
+
:CUT_BUFFER4 => 13,
|
48
|
+
:CUT_BUFFER5 => 14,
|
49
|
+
:CUT_BUFFER6 => 15,
|
50
|
+
:CUT_BUFFER7 => 16,
|
51
|
+
:DRAWABLE => 17,
|
52
|
+
:FONT => 18,
|
53
|
+
:INTEGER => 19,
|
54
|
+
:PIXMAP => 20,
|
55
|
+
:POINT => 21,
|
56
|
+
:RECTANGLE => 22,
|
57
|
+
:RESOURCE_MANAGER => 23,
|
58
|
+
:RGB_COLOR_MAP => 24,
|
59
|
+
:RGB_BEST_MAP => 25,
|
60
|
+
:RGB_BLUE_MAP => 26,
|
61
|
+
:RGB_DEFAULT_MAP => 27,
|
62
|
+
:RGB_GRAY_MAP => 28,
|
63
|
+
:RGB_GREEN_MAP => 29,
|
64
|
+
:RGB_RED_MAP => 30,
|
65
|
+
:STRING => 31,
|
66
|
+
:VISUALID => 32,
|
67
|
+
:WINDOW => 33,
|
68
|
+
:WM_COMMAND => 34,
|
69
|
+
:WM_HINTS => 35,
|
70
|
+
:WM_CLIENT_MACHINE => 36,
|
71
|
+
:WM_ICON_NAME => 37,
|
72
|
+
:WM_ICON_SIZE => 38,
|
73
|
+
:WM_NAME => 39,
|
74
|
+
:WM_NORMAL_HINTS => 40,
|
75
|
+
:WM_SIZE_HINTS => 41,
|
76
|
+
:WM_ZOOM_HINTS => 42,
|
77
|
+
:MIN_SPACE => 43,
|
78
|
+
:NORM_SPACE => 44,
|
79
|
+
:MAX_SPACE => 45,
|
80
|
+
:END_SPACE => 46,
|
81
|
+
:SUPERSCRIPT_X => 47,
|
82
|
+
:SUPERSCRIPT_Y => 48,
|
83
|
+
:SUBSCRIPT_X => 49,
|
84
|
+
:SUBSCRIPT_Y => 50,
|
85
|
+
:UNDERLINE_POSITION => 51,
|
86
|
+
:UNDERLINE_THICKNESS => 52,
|
87
|
+
:STRIKEOUT_ASCENT => 53,
|
88
|
+
:STRIKEOUT_DESCENT => 54,
|
89
|
+
:ITALIC_ANGLE => 55,
|
90
|
+
:X_HEIGHT => 56,
|
91
|
+
:QUAD_WIDTH => 57,
|
92
|
+
:WEIGHT => 58,
|
93
|
+
:POINT_SIZE => 59,
|
94
|
+
:RESOLUTION => 60,
|
95
|
+
:COPYRIGHT => 61,
|
96
|
+
:NOTICE => 62,
|
97
|
+
:FONT_NAME => 63,
|
98
|
+
:FAMILY_NAME => 64,
|
99
|
+
:FULL_NAME => 65,
|
100
|
+
:CAP_HEIGHT => 66,
|
101
|
+
:WM_CLASS => 67,
|
102
|
+
:WM_TRANSIENT_FOR => 68,
|
103
|
+
|
104
|
+
:LAST_PREDEFINED => 68
|
105
|
+
}
|
106
|
+
|
107
|
+
def self.to_hash
|
108
|
+
@atoms
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.const_missing (const)
|
112
|
+
Atom.new(to_hash.find {|name, value|
|
113
|
+
name.to_s.downcase == const.to_s.downcase
|
114
|
+
}.last)
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.method_missing (id, *)
|
118
|
+
const_missing(id)
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.from_name (display, name, if_exists=false)
|
122
|
+
C::XInternAtom(display.to_ffi, name, if_exists).tap {|atom|
|
123
|
+
break atom.to_i == 0 ? nil : atom.to_i
|
124
|
+
}
|
125
|
+
end
|
126
|
+
|
127
|
+
attr_reader :display
|
128
|
+
|
129
|
+
def initialize (value, display=nil)
|
130
|
+
if display
|
131
|
+
@display = display
|
132
|
+
@value = value.is_a?(Integer) ? value : Atom.from_name(display, value.to_s).to_i
|
133
|
+
else
|
134
|
+
@value = value.is_a?(Integer) ? value : Atom.const_missing(value).to_i
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def name
|
139
|
+
@name ||= if display
|
140
|
+
C::XGetAtomName(display.to_ffi, self)
|
141
|
+
else
|
142
|
+
Atom.to_hash.index(@value).tap {|name|
|
143
|
+
break name.nil? ? nil : name.to_s
|
144
|
+
}
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def to_sym
|
149
|
+
name.to_sym rescue nil
|
150
|
+
end
|
151
|
+
|
152
|
+
def to_s
|
153
|
+
name
|
154
|
+
end
|
155
|
+
|
156
|
+
def to_i
|
157
|
+
@value
|
158
|
+
end; alias to_ffi to_i
|
159
|
+
|
160
|
+
def inspect
|
161
|
+
to_sym.to_s
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
|
167
|
+
require 'X11/Xatom/c'
|
data/lib/X11/Xatom/c.rb
ADDED
@@ -0,0 +1,52 @@
|
|
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 <COPYRIGHT HOLDER> ''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 <COPYRIGHT HOLDER> 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
|
+
require 'X11/Xdefs'
|
30
|
+
|
31
|
+
module X11; module C
|
32
|
+
|
33
|
+
module Atom
|
34
|
+
extend FFI::DataConverter
|
35
|
+
|
36
|
+
native_type :ulong
|
37
|
+
|
38
|
+
def self.to_native (value, ctx)
|
39
|
+
value.to_ffi
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.from_native (value, ctx)
|
43
|
+
X11::Atom.new(value)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
FFI.typedef Atom, :Atom
|
48
|
+
|
49
|
+
attach_function :XInternAtom, [:pointer, :string, :Bool], :Atom
|
50
|
+
attach_function :XGetAtomName, [:pointer, :Atom], :string
|
51
|
+
|
52
|
+
end; end
|
data/lib/X11/Xdefs/c.rb
CHANGED
@@ -27,9 +27,12 @@
|
|
27
27
|
#++
|
28
28
|
|
29
29
|
require 'X11/extensions'
|
30
|
+
require 'X11/Xatom'
|
30
31
|
|
31
32
|
module X11; module C
|
32
33
|
|
34
|
+
ffi_lib_add 'X11'
|
35
|
+
|
33
36
|
module Bool
|
34
37
|
extend FFI::DataConverter
|
35
38
|
|
@@ -44,11 +47,12 @@ module Bool
|
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
47
|
-
|
48
|
-
typedef Bool, :Bool
|
49
|
-
typedef :ulong, :XID
|
50
|
-
typedef :ulong, :Mask
|
51
|
-
typedef :XID, :Font
|
52
|
-
typedef :ulong, :FSID
|
50
|
+
module ::FFI
|
51
|
+
typedef Bool, :Bool
|
52
|
+
typedef :ulong, :XID
|
53
|
+
typedef :ulong, :Mask
|
54
|
+
typedef :XID, :Font
|
55
|
+
typedef :ulong, :FSID
|
56
|
+
end
|
53
57
|
|
54
58
|
end; end
|
data/lib/X11/Xlib.rb
CHANGED
@@ -26,12 +26,18 @@
|
|
26
26
|
# or implied.
|
27
27
|
#++
|
28
28
|
|
29
|
+
require 'X11/Xlib/exceptions'
|
30
|
+
require 'X11/Xlib/transform'
|
31
|
+
|
29
32
|
require 'X11/Xlib/c'
|
30
33
|
|
31
34
|
require 'X11/Xlib/display'
|
32
35
|
require 'X11/Xlib/screen'
|
33
36
|
require 'X11/Xlib/window'
|
34
37
|
require 'X11/Xlib/visual'
|
38
|
+
require 'X11/Xlib/keysym'
|
35
39
|
|
40
|
+
require 'X11/Xlib/status'
|
36
41
|
require 'X11/Xlib/event'
|
37
42
|
require 'X11/Xlib/mask'
|
43
|
+
require 'X11/Xlib/revert_to'
|
data/lib/X11/Xlib/c/functions.rb
CHANGED
@@ -28,13 +28,19 @@
|
|
28
28
|
|
29
29
|
module X11; module C
|
30
30
|
|
31
|
+
attach_function :XFree, [:pointer], :int
|
32
|
+
|
31
33
|
attach_function :XOpenDisplay, [:string], :pointer
|
32
34
|
attach_function :XCloseDisplay, [:pointer], :int
|
35
|
+
attach_function :XFlush, [:pointer], :int
|
36
|
+
attach_function :XGetInputFocus, [:pointer, :pointer, :pointer], :int
|
37
|
+
attach_function :XSetInputFocus, [:pointer, :Window, :int, :Time], :int
|
33
38
|
|
34
39
|
attach_function :XGrabButton, [:pointer, :uint, :uint, :Window, :Bool, :uint, :int, :int, :Window, :Cursor], :int
|
35
40
|
attach_function :XGrabKey, [:pointer, :int, :uint, :Window, :Bool, :int, :int], :int
|
36
41
|
attach_function :XGrabKeyboard, [:pointer, :Window, :Bool, :int, :int, :Time], :int
|
37
42
|
attach_function :XGrabPointer, [:pointer, :Window, :Bool, :uint, :int, :int, :Window, :Cursor, :Time], :int
|
43
|
+
attach_function :XQueryPointer, [:pointer, :Window, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :Bool
|
38
44
|
|
39
45
|
attach_function :XUngrabButton, [:pointer, :uint, :uint, :Window], :int
|
40
46
|
attach_function :XUngrabKey, [:pointer, :int, :uint, :Window], :int
|
@@ -43,12 +49,21 @@ attach_function :XUngrabPointer, [:pointer, :Time], :int
|
|
43
49
|
|
44
50
|
attach_function :XGetWindowAttributes, [:pointer, :Window, :pointer], :int
|
45
51
|
attach_function :XMoveResizeWindow, [:pointer, :Window, :int, :int, :uint, :uint], :int
|
52
|
+
attach_function :XMoveWindow, [:pointer, :Window, :int, :int], :int
|
53
|
+
attach_function :XResizeWindow, [:pointer, :Window, :uint, :uint], :int
|
46
54
|
attach_function :XRaiseWindow, [:pointer, :Window], :int
|
55
|
+
attach_function :XQueryTree, [:pointer, :Window, :pointer, :pointer, :pointer, :pointer], :Status
|
56
|
+
attach_function :XListProperties, [:pointer, :Window, :pointer], :pointer
|
57
|
+
attach_function :XGetWindowProperty, [:pointer, :Window, :Atom, :long, :long, :Bool, :Atom, :pointer, :pointer, :pointer, :pointer, :pointer], :Status
|
47
58
|
|
59
|
+
attach_function :XAllowEvents, [:pointer, :int, :Time], :int
|
48
60
|
attach_function :XNextEvent, [:pointer, :pointer], :int
|
61
|
+
attach_function :XMaskEvent, [:pointer, :long, :pointer], :int
|
49
62
|
attach_function :XCheckTypedEvent, [:pointer, :int, :pointer], :Bool
|
63
|
+
attach_function :XWindowEvent, [:pointer, :Window, :long, :pointer], :int
|
50
64
|
|
51
65
|
attach_function :XStringToKeysym, [:string], :KeySym
|
66
|
+
attach_function :XKeysymToString, [:KeySym], :string
|
52
67
|
attach_function :XKeysymToKeycode, [:pointer, :KeySym], :KeyCode
|
53
68
|
|
54
69
|
end; end
|
@@ -0,0 +1,47 @@
|
|
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 <COPYRIGHT HOLDER> ''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 <COPYRIGHT HOLDER> 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; module C
|
30
|
+
|
31
|
+
module KeySym
|
32
|
+
extend FFI::DataConverter
|
33
|
+
|
34
|
+
native_type :XID
|
35
|
+
|
36
|
+
def self.to_native (value, ctx)
|
37
|
+
value.to_i
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.from_native (value, ctx)
|
41
|
+
X11::Keysym.new(value)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
FFI.typedef KeySym, :KeySym
|
46
|
+
|
47
|
+
end; end
|
@@ -0,0 +1,47 @@
|
|
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 <COPYRIGHT HOLDER> ''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 <COPYRIGHT HOLDER> 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; module C
|
30
|
+
|
31
|
+
module Status
|
32
|
+
extend FFI::DataConverter
|
33
|
+
|
34
|
+
native_type :int
|
35
|
+
|
36
|
+
def self.to_native (value, ctx)
|
37
|
+
value.to_i
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.from_native (value, ctx)
|
41
|
+
X11::Status.new(value)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
FFI.typedef Status, :Status
|
46
|
+
|
47
|
+
end; end
|