rwm 0.0.1.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rwm +38 -0
- data/lib/rwm.rb +41 -0
- data/lib/rwm/extensions.rb +66 -0
- data/lib/rwm/x11.rb +61 -0
- data/lib/rwm/x11/c.rb +31 -0
- data/lib/rwm/x11/c/functions.rb +45 -0
- data/lib/rwm/x11/c/types.rb +647 -0
- data/lib/rwm/x11/events.rb +472 -0
- data/lib/rwm/x11/masks.rb +64 -0
- data/lib/rwm/x11/types.rb +227 -0
- metadata +89 -0
data/bin/rwm
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rwm/x11'
|
4
|
+
include X11::Events
|
5
|
+
|
6
|
+
dpy = X11::Display.new(ENV['DISPLAY'])
|
7
|
+
root = dpy.default_screen.root_window
|
8
|
+
|
9
|
+
p X11::Mask
|
10
|
+
root.grab_key("F1", X11::Mask[:Mod1])
|
11
|
+
root.grab_button(1, X11::Mask[:Mod1])
|
12
|
+
root.grab_button(3, X11::Mask[:Mod1])
|
13
|
+
|
14
|
+
start, attr = []
|
15
|
+
|
16
|
+
dpy.each_event {|ev|
|
17
|
+
case ev
|
18
|
+
when KeyPress
|
19
|
+
ev.subwindow.raise unless ev.subwindow.nil?
|
20
|
+
when ButtonPress
|
21
|
+
unless ev.subwindow.nil?
|
22
|
+
ev.subwindow.grab_pointer(true, X11::Mask[:PointerMotion] | X11::Mask[:ButtonRelease])
|
23
|
+
attr = ev.subwindow.attributes
|
24
|
+
start = ev
|
25
|
+
end
|
26
|
+
when MotionNotify
|
27
|
+
nil while (dpy.check_typed_event(MotionNotify).tap {|x| ev = x if x })
|
28
|
+
|
29
|
+
xdiff = ev.x_root - start.x_root
|
30
|
+
ydiff = ev.y_root - start.y_root
|
31
|
+
ev.window.move_resize(attr.x + (start.button == 1 ? xdiff : 0),
|
32
|
+
attr.y + (start.button == 1 ? ydiff : 0),
|
33
|
+
[1, attr.width + (start.button == 3 ? xdiff : 0)].max,
|
34
|
+
[1, attr.height + (start.button == 3 ? ydiff : 0)].max)
|
35
|
+
when ButtonRelease
|
36
|
+
dpy.ungrab_pointer
|
37
|
+
end
|
38
|
+
}
|
data/lib/rwm.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft shura. [ shura1991@gmail.com ]
|
3
|
+
#
|
4
|
+
# This file is part of rwm.
|
5
|
+
#
|
6
|
+
# rwm 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.
|
10
|
+
#
|
11
|
+
# rwm 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.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with rwm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'rwm/client'
|
21
|
+
|
22
|
+
module Arbi
|
23
|
+
class << self
|
24
|
+
def connect(address = '127.0.0.1', port = 6969)
|
25
|
+
@@connection = Arbi::Client.new(address, port)
|
26
|
+
end
|
27
|
+
|
28
|
+
def connected?
|
29
|
+
@@connection ? true : false
|
30
|
+
end
|
31
|
+
|
32
|
+
def connection
|
33
|
+
@@connection.sock
|
34
|
+
end
|
35
|
+
|
36
|
+
def get(what)
|
37
|
+
self.connect unless self.connected?
|
38
|
+
@@connection.get(what)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft shura. [ shura1991@gmail.com ]
|
3
|
+
#
|
4
|
+
# This file is part of rwm.
|
5
|
+
#
|
6
|
+
# rwm 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.
|
10
|
+
#
|
11
|
+
# rwm 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.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with rwm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'ffi'
|
21
|
+
|
22
|
+
module FFI
|
23
|
+
module Library
|
24
|
+
def has_function? (sym, libraries=[])
|
25
|
+
if libraries.empty?
|
26
|
+
libraries << FFI::Library::LIBC
|
27
|
+
end
|
28
|
+
|
29
|
+
libraries.any? {|lib|
|
30
|
+
DynamicLibrary.new(lib, 0).find_function(sym.to_s) rescue nil
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def attach_function! (*args, &block)
|
35
|
+
begin
|
36
|
+
attach_function(*args, &block)
|
37
|
+
rescue Exception => e
|
38
|
+
false
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class Type::Builtin
|
44
|
+
def name
|
45
|
+
@__name__ ||= Type::Builtin.constants.find {|name|
|
46
|
+
Type::Builtin.const_get(name) == self
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class Pointer
|
52
|
+
def typecast (type)
|
53
|
+
if type.is_a?(Symbol)
|
54
|
+
type = FFI.find_type(type)
|
55
|
+
end
|
56
|
+
|
57
|
+
if type.is_a?(Class) && type.ancestors.member?(FFI::Struct)
|
58
|
+
type.new(self)
|
59
|
+
elsif type.is_a?(Type::Builtin)
|
60
|
+
send "read_#{type.name.downcase}"
|
61
|
+
else
|
62
|
+
ArgumentError.new "You have to pass a Struct, a Builtin type or a Symbol"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/rwm/x11.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft shura. [ shura1991@gmail.com ]
|
3
|
+
#
|
4
|
+
# This file is part of rwm.
|
5
|
+
#
|
6
|
+
# rwm 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.
|
10
|
+
#
|
11
|
+
# rwm 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.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with rwm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'rwm/x11/c'
|
21
|
+
require 'rwm/x11/types'
|
22
|
+
require 'rwm/x11/events'
|
23
|
+
require 'rwm/x11/masks'
|
24
|
+
|
25
|
+
class String
|
26
|
+
def to_keysym
|
27
|
+
X11::C.XStringToKeysym(self)
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_keycode (dpy=nil)
|
31
|
+
to_keysym.to_keycode(dpy)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class Fixnum
|
36
|
+
def to_keycode! (dpy=nil)
|
37
|
+
(dpy || ObjectSpace.each_object(X11::Display).first || X11::Display.new).
|
38
|
+
keysym_to_keycode(self).tap {|kc|
|
39
|
+
kc.instance_eval {
|
40
|
+
keycode!
|
41
|
+
}
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_keycode (dpy=nil)
|
46
|
+
keycoded? ? self : to_keycode!
|
47
|
+
end
|
48
|
+
|
49
|
+
def to_c
|
50
|
+
self
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
def keycoded?
|
55
|
+
@kc ||= false
|
56
|
+
end
|
57
|
+
|
58
|
+
def keycode!
|
59
|
+
@kc = true
|
60
|
+
end
|
61
|
+
end
|
data/lib/rwm/x11/c.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft shura. [ shura1991@gmail.com ]
|
3
|
+
#
|
4
|
+
# This file is part of rwm.
|
5
|
+
#
|
6
|
+
# rwm 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.
|
10
|
+
#
|
11
|
+
# rwm 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.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with rwm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'rwm/extensions'
|
21
|
+
|
22
|
+
module X11
|
23
|
+
module C
|
24
|
+
extend FFI::Library
|
25
|
+
|
26
|
+
ffi_lib 'X11'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
require 'rwm/x11/c/types'
|
31
|
+
require 'rwm/x11/c/functions'
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft shura. [ shura1991@gmail.com ]
|
3
|
+
#
|
4
|
+
# This file is part of rwm.
|
5
|
+
#
|
6
|
+
# rwm 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.
|
10
|
+
#
|
11
|
+
# rwm 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.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with rwm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
|
21
|
+
module X11
|
22
|
+
module C
|
23
|
+
attach_function :XOpenDisplay, [:string], :pointer
|
24
|
+
|
25
|
+
attach_function :XGrabButton, [:pointer, :uint, :uint, :Window, :Bool, :uint, :int, :int, :Window, :Cursor], :int
|
26
|
+
attach_function :XGrabKey, [:pointer, :int, :uint, :Window, :Bool, :int, :int], :int
|
27
|
+
attach_function :XGrabKeyboard, [:pointer, :Window, :Bool, :int, :int, :Time], :int
|
28
|
+
attach_function :XGrabPointer, [:pointer, :Window, :Bool, :uint, :int, :int, :Window, :Cursor, :Time], :int
|
29
|
+
|
30
|
+
attach_function :XUngrabButton, [:pointer, :uint, :uint, :Window], :int
|
31
|
+
attach_function :XUngrabKey, [:pointer, :int, :uint, :Window], :int
|
32
|
+
attach_function :XUngrabKeyboard, [:pointer, :Time], :int
|
33
|
+
attach_function :XUngrabPointer, [:pointer, :Time], :int
|
34
|
+
|
35
|
+
attach_function :XGetWindowAttributes, [:pointer, :Window, :pointer], :int
|
36
|
+
attach_function :XMoveResizeWindow, [:pointer, :Window, :int, :int, :uint, :uint], :int
|
37
|
+
attach_function :XRaiseWindow, [:pointer, :Window], :int
|
38
|
+
|
39
|
+
attach_function :XNextEvent, [:pointer, :pointer], :int
|
40
|
+
attach_function :XCheckTypedEvent, [:pointer, :int, :pointer], :Bool
|
41
|
+
|
42
|
+
attach_function :XStringToKeysym, [:string], :KeySym
|
43
|
+
attach_function :XKeysymToKeycode, [:pointer, :KeySym], :KeyCode
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,647 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft shura. [ shura1991@gmail.com ]
|
3
|
+
#
|
4
|
+
# This file is part of rwm.
|
5
|
+
#
|
6
|
+
# rwm 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.
|
10
|
+
#
|
11
|
+
# rwm 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.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
17
|
+
# along with rwm. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
module X11
|
21
|
+
module C
|
22
|
+
module Bool
|
23
|
+
extend FFI::DataConverter
|
24
|
+
native_type FFI::Type::INT
|
25
|
+
|
26
|
+
def self.to_native (value, ctx)
|
27
|
+
value ? 1 : 0
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.from_native (value, ctx)
|
31
|
+
!value.zero?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
FFI.typedef(Bool, :Bool)
|
35
|
+
|
36
|
+
FFI.typedef(:uint32, :CARD32)
|
37
|
+
XID = FFI.typedef(:ulong, :XID)
|
38
|
+
|
39
|
+
VisualID = FFI.typedef(:CARD32, :VisualID)
|
40
|
+
Window = FFI.typedef(:XID, :Window)
|
41
|
+
Colormap = FFI.typedef(:XID, :Colormap)
|
42
|
+
GContext = FFI.typedef(:XID, :GContext)
|
43
|
+
Cursor = FFI.typedef(:XID, :Cursor)
|
44
|
+
KeySym = FFI.typedef(:XID, :KeySym)
|
45
|
+
Drawable = FFI.typedef(:XID, :Drawable)
|
46
|
+
KeyCode = FFI.typedef(:uchar, :KeyCode)
|
47
|
+
Time = FFI.typedef(:ulong, :Time)
|
48
|
+
Atom = FFI.typedef(:ulong, :Atom)
|
49
|
+
|
50
|
+
class Display < FFI::Struct
|
51
|
+
layout \
|
52
|
+
:ext_data, :pointer,
|
53
|
+
:private1, :pointer,
|
54
|
+
:fd, :int,
|
55
|
+
:private2, :int,
|
56
|
+
:proto_major_version, :int,
|
57
|
+
:proto_minor_version, :int,
|
58
|
+
:vendor, :string,
|
59
|
+
:private3, XID,
|
60
|
+
:private4, XID,
|
61
|
+
:private5, XID,
|
62
|
+
:private6, :int,
|
63
|
+
:resource_alloc, :pointer,
|
64
|
+
:byte_order, :int,
|
65
|
+
:bitmap_unit, :int,
|
66
|
+
:bitmap_pad, :int,
|
67
|
+
:bitmap_bit_order, :int,
|
68
|
+
:nformats, :int,
|
69
|
+
:pixmap_format, :pointer,
|
70
|
+
:private8, :int,
|
71
|
+
:release, :int,
|
72
|
+
:private9, :pointer,
|
73
|
+
:private10, :pointer,
|
74
|
+
:qlen, :int,
|
75
|
+
:last_request_read, :ulong,
|
76
|
+
:request, :ulong,
|
77
|
+
:private11, :pointer,
|
78
|
+
:private12, :pointer,
|
79
|
+
:private13, :pointer,
|
80
|
+
:private14, :pointer,
|
81
|
+
:max_request_size, :uint,
|
82
|
+
:db, :pointer,
|
83
|
+
:private15, :pointer,
|
84
|
+
:display_name, :string,
|
85
|
+
:default_screen, :int,
|
86
|
+
:nscreens, :int,
|
87
|
+
:screens, :pointer,
|
88
|
+
:motion_buffer, :ulong,
|
89
|
+
:private16, :ulong,
|
90
|
+
:min_keycode, :int,
|
91
|
+
:max_keycode, :int,
|
92
|
+
:private17, :pointer,
|
93
|
+
:private18, :pointer,
|
94
|
+
:private19, :int,
|
95
|
+
:xdefaults, :string
|
96
|
+
end
|
97
|
+
|
98
|
+
class GC < FFI::Struct
|
99
|
+
layout \
|
100
|
+
:ext_data, :pointer,
|
101
|
+
:gid, GContext
|
102
|
+
end
|
103
|
+
|
104
|
+
class Screen < FFI::Struct
|
105
|
+
layout \
|
106
|
+
:ext_data, :pointer,
|
107
|
+
:display, :pointer,
|
108
|
+
:root, :Window,
|
109
|
+
:width, :int,
|
110
|
+
:height, :int,
|
111
|
+
:mwidth, :int,
|
112
|
+
:mheight, :int,
|
113
|
+
:ndepths, :int,
|
114
|
+
:depths, :pointer,
|
115
|
+
:root_depth, :int,
|
116
|
+
:root_visual, :pointer,
|
117
|
+
:default_gc, GC,
|
118
|
+
:cmap, Colormap,
|
119
|
+
:white_pixel, :ulong,
|
120
|
+
:black_pixel, :ulong,
|
121
|
+
:max_maps, :int,
|
122
|
+
:min_maps, :int,
|
123
|
+
:save_unders, :Bool,
|
124
|
+
:root_input_mask, :long
|
125
|
+
end
|
126
|
+
|
127
|
+
class XWindowAttributes < FFI::Struct
|
128
|
+
layout \
|
129
|
+
:x, :int,
|
130
|
+
:y, :int,
|
131
|
+
:width, :int,
|
132
|
+
:height, :int,
|
133
|
+
:border_width, :int,
|
134
|
+
:depth, :int,
|
135
|
+
:visual, :pointer,
|
136
|
+
:root, :Window,
|
137
|
+
:class, :int,
|
138
|
+
:bit_gravity, :int,
|
139
|
+
:win_gravity, :int,
|
140
|
+
:backing_store, :int,
|
141
|
+
:backing_planes, :ulong,
|
142
|
+
:backing_pixel, :ulong,
|
143
|
+
:save_under, :Bool,
|
144
|
+
:colormap, Colormap,
|
145
|
+
:map_installed, :Bool,
|
146
|
+
:map_state, :int,
|
147
|
+
:all_event_masks, :long,
|
148
|
+
:your_event_masks, :long,
|
149
|
+
:do_not_propagate_mask, :long,
|
150
|
+
:override_redirect, :Bool,
|
151
|
+
:screen, :pointer
|
152
|
+
end
|
153
|
+
|
154
|
+
class Visual < FFI::Struct
|
155
|
+
layout \
|
156
|
+
:ext_data, :pointer,
|
157
|
+
:visualid, :VisualID,
|
158
|
+
:class, :int,
|
159
|
+
:read_mask, :ulong,
|
160
|
+
:green_mask, :ulong,
|
161
|
+
:blue_mask, :ulong,
|
162
|
+
:buts_per_rgb, :int,
|
163
|
+
:map_entries, :int
|
164
|
+
end
|
165
|
+
|
166
|
+
class XAnyEvent < FFI::Struct
|
167
|
+
layout \
|
168
|
+
:type, :int,
|
169
|
+
:serial, :ulong,
|
170
|
+
:send_event, :Bool,
|
171
|
+
:display, :pointer,
|
172
|
+
:window, :Window
|
173
|
+
end
|
174
|
+
|
175
|
+
class XKeyEvent < FFI::Struct
|
176
|
+
layout \
|
177
|
+
:type, :int,
|
178
|
+
:serial, :ulong,
|
179
|
+
:send_event, :Bool,
|
180
|
+
:display, :pointer,
|
181
|
+
:window, :Window,
|
182
|
+
:root, :Window,
|
183
|
+
:subwindow, :Window,
|
184
|
+
:time, :Time,
|
185
|
+
:x, :int,
|
186
|
+
:y, :int,
|
187
|
+
:x_root, :int,
|
188
|
+
:y_root, :int,
|
189
|
+
:state, :uint,
|
190
|
+
:keycode, :uint,
|
191
|
+
:same_screen, :Bool
|
192
|
+
end
|
193
|
+
|
194
|
+
class XButtonEvent < FFI::Struct
|
195
|
+
layout \
|
196
|
+
:type, :int,
|
197
|
+
:serial, :ulong,
|
198
|
+
:send_event, :Bool,
|
199
|
+
:display, :pointer,
|
200
|
+
:window, :Window,
|
201
|
+
:root, :Window,
|
202
|
+
:subwindow, :Window,
|
203
|
+
:time, :Time,
|
204
|
+
:x, :int,
|
205
|
+
:y, :int,
|
206
|
+
:x_root, :int,
|
207
|
+
:y_root, :int,
|
208
|
+
:state, :uint,
|
209
|
+
:button, :uint,
|
210
|
+
:same_screen, :Bool
|
211
|
+
end
|
212
|
+
|
213
|
+
class XMotionEvent < FFI::Struct
|
214
|
+
layout \
|
215
|
+
:type, :int,
|
216
|
+
:serial, :ulong,
|
217
|
+
:send_event, :Bool,
|
218
|
+
:display, :pointer,
|
219
|
+
:window, :Window,
|
220
|
+
:root, :Window,
|
221
|
+
:subwindow, :Window,
|
222
|
+
:time, :Time,
|
223
|
+
:x, :int,
|
224
|
+
:y, :int,
|
225
|
+
:x_root, :int,
|
226
|
+
:y_root, :int,
|
227
|
+
:state, :uint,
|
228
|
+
:is_hint, :char,
|
229
|
+
:same_screen, :Bool
|
230
|
+
end
|
231
|
+
|
232
|
+
class XCrossingEvent < FFI::Struct
|
233
|
+
layout \
|
234
|
+
:type, :int,
|
235
|
+
:serial, :ulong,
|
236
|
+
:send_event, :Bool,
|
237
|
+
:display, :pointer,
|
238
|
+
:window, :Window,
|
239
|
+
:root, :Window,
|
240
|
+
:subwindow, :Window,
|
241
|
+
:time, :Time,
|
242
|
+
:x, :int,
|
243
|
+
:y, :int,
|
244
|
+
:x_root, :int,
|
245
|
+
:y_root, :int,
|
246
|
+
:mode, :int,
|
247
|
+
:detail, :int,
|
248
|
+
:same_screen, :Bool,
|
249
|
+
:focus, :Bool,
|
250
|
+
:state, :uint
|
251
|
+
end
|
252
|
+
|
253
|
+
class XFocusChangeEvent < FFI::Union
|
254
|
+
layout \
|
255
|
+
:type, :int,
|
256
|
+
:serial, :ulong,
|
257
|
+
:send_event, :Bool,
|
258
|
+
:display, :pointer,
|
259
|
+
:window, :Window,
|
260
|
+
:mode, :int,
|
261
|
+
:detail, :int
|
262
|
+
end
|
263
|
+
|
264
|
+
class XExposeEvent < FFI::Struct
|
265
|
+
layout \
|
266
|
+
:type, :int,
|
267
|
+
:serial, :ulong,
|
268
|
+
:send_event, :Bool,
|
269
|
+
:display, :pointer,
|
270
|
+
:window, :Window,
|
271
|
+
:x, :int,
|
272
|
+
:y, :int,
|
273
|
+
:width, :int,
|
274
|
+
:height, :int,
|
275
|
+
:count, :int
|
276
|
+
end
|
277
|
+
|
278
|
+
class XGraphicsExposeEvent < FFI::Struct
|
279
|
+
layout \
|
280
|
+
:type, :int,
|
281
|
+
:serial, :ulong,
|
282
|
+
:send_event, :Bool,
|
283
|
+
:display, :pointer,
|
284
|
+
:window, :Window,
|
285
|
+
:drawable, :Drawable,
|
286
|
+
:x, :int,
|
287
|
+
:y, :int,
|
288
|
+
:width, :int,
|
289
|
+
:height, :int,
|
290
|
+
:count, :int,
|
291
|
+
:major_code, :int,
|
292
|
+
:minor_code, :int
|
293
|
+
end
|
294
|
+
|
295
|
+
class XNoExposeEvent < FFI::Struct
|
296
|
+
layout \
|
297
|
+
:type, :int,
|
298
|
+
:serial, :ulong,
|
299
|
+
:send_event, :Bool,
|
300
|
+
:display, :pointer,
|
301
|
+
:drawable, :Drawable,
|
302
|
+
:major_code, :int,
|
303
|
+
:minor_code, :int
|
304
|
+
end
|
305
|
+
|
306
|
+
class XVisibilityEvent < FFI::Struct
|
307
|
+
layout \
|
308
|
+
:type, :int,
|
309
|
+
:serial, :ulong,
|
310
|
+
:send_event, :Bool,
|
311
|
+
:display, :pointer,
|
312
|
+
:window, :Window,
|
313
|
+
:state, :int
|
314
|
+
end
|
315
|
+
|
316
|
+
class XCreateWindowEvent < FFI::Struct
|
317
|
+
layout \
|
318
|
+
:type, :int,
|
319
|
+
:serial, :ulong,
|
320
|
+
:send_event, :Bool,
|
321
|
+
:display, :pointer,
|
322
|
+
:parent, :Window,
|
323
|
+
:window, :Window,
|
324
|
+
:x, :int,
|
325
|
+
:y, :int,
|
326
|
+
:width, :int,
|
327
|
+
:height, :int,
|
328
|
+
:border_width, :int,
|
329
|
+
:override_redirect, :Bool
|
330
|
+
end
|
331
|
+
|
332
|
+
class XDestroyWindowEvent < FFI::Struct
|
333
|
+
layout \
|
334
|
+
:type, :int,
|
335
|
+
:serial, :ulong,
|
336
|
+
:send_event, :Bool,
|
337
|
+
:display, :pointer,
|
338
|
+
:event, :Window,
|
339
|
+
:window, :Window
|
340
|
+
end
|
341
|
+
|
342
|
+
class XUnmapEvent < FFI::Struct
|
343
|
+
layout \
|
344
|
+
:type, :int,
|
345
|
+
:serial, :ulong,
|
346
|
+
:send_event, :Bool,
|
347
|
+
:display, :pointer,
|
348
|
+
:event, :Window,
|
349
|
+
:window, :Window,
|
350
|
+
:from_configure, :Bool
|
351
|
+
end
|
352
|
+
|
353
|
+
class XMapEvent < FFI::Struct
|
354
|
+
layout \
|
355
|
+
:type, :int,
|
356
|
+
:serial, :ulong,
|
357
|
+
:send_event, :Bool,
|
358
|
+
:display, :pointer,
|
359
|
+
:event, :Window,
|
360
|
+
:window, :Window,
|
361
|
+
:override_redirect, :Bool
|
362
|
+
end
|
363
|
+
|
364
|
+
class XMapRequestEvent < FFI::Struct
|
365
|
+
layout \
|
366
|
+
:type, :int,
|
367
|
+
:serial, :ulong,
|
368
|
+
:send_event, :Bool,
|
369
|
+
:display, :pointer,
|
370
|
+
:event, :Window,
|
371
|
+
:window, :Window,
|
372
|
+
:parent, :Window,
|
373
|
+
:x, :int,
|
374
|
+
:y, :int,
|
375
|
+
:override_redirect, :Bool
|
376
|
+
end
|
377
|
+
|
378
|
+
class XReparentEvent < FFI::Struct
|
379
|
+
layout \
|
380
|
+
:type, :int,
|
381
|
+
:serial, :ulong,
|
382
|
+
:send_event, :Bool,
|
383
|
+
:display, :pointer,
|
384
|
+
:event, :Window,
|
385
|
+
:window, :Window,
|
386
|
+
:parent, :Window,
|
387
|
+
:x, :int,
|
388
|
+
:y, :int,
|
389
|
+
:override_redirect, :Bool
|
390
|
+
end
|
391
|
+
|
392
|
+
class XConfigureEvent < FFI::Struct
|
393
|
+
layout \
|
394
|
+
:type, :int,
|
395
|
+
:serial, :ulong,
|
396
|
+
:send_event, :Bool,
|
397
|
+
:display, :pointer,
|
398
|
+
:event, :Window,
|
399
|
+
:window, :Window,
|
400
|
+
:x, :int,
|
401
|
+
:y, :int,
|
402
|
+
:width, :int,
|
403
|
+
:height, :int,
|
404
|
+
:border_width, :int,
|
405
|
+
:above, :Window,
|
406
|
+
:override_redirect, :Bool
|
407
|
+
end
|
408
|
+
|
409
|
+
class XGravityEvent < FFI::Struct
|
410
|
+
layout \
|
411
|
+
:type, :int,
|
412
|
+
:serial, :ulong,
|
413
|
+
:send_event, :Bool,
|
414
|
+
:display, :pointer,
|
415
|
+
:event, :Window,
|
416
|
+
:window, :Window,
|
417
|
+
:x, :int,
|
418
|
+
:y, :int
|
419
|
+
end
|
420
|
+
|
421
|
+
class XResizeRequestEvent < FFI::Struct
|
422
|
+
layout \
|
423
|
+
:type, :int,
|
424
|
+
:serial, :ulong,
|
425
|
+
:send_event, :Bool,
|
426
|
+
:display, :pointer,
|
427
|
+
:window, :Window,
|
428
|
+
:width, :int,
|
429
|
+
:height, :int
|
430
|
+
end
|
431
|
+
|
432
|
+
class XConfigureRequestEvent < FFI::Struct
|
433
|
+
layout \
|
434
|
+
:type, :int,
|
435
|
+
:serial, :ulong,
|
436
|
+
:send_event, :Bool,
|
437
|
+
:display, :pointer,
|
438
|
+
:event, :Window,
|
439
|
+
:window, :Window,
|
440
|
+
:x, :int,
|
441
|
+
:y, :int,
|
442
|
+
:width, :int,
|
443
|
+
:height, :int,
|
444
|
+
:border_width, :int,
|
445
|
+
:above, :Window,
|
446
|
+
:detail, :int,
|
447
|
+
:value_mask, :ulong
|
448
|
+
end
|
449
|
+
|
450
|
+
class XCirculateEvent < FFI::Struct
|
451
|
+
layout \
|
452
|
+
:type, :int,
|
453
|
+
:serial, :ulong,
|
454
|
+
:send_event, :Bool,
|
455
|
+
:display, :pointer,
|
456
|
+
:event, :Window,
|
457
|
+
:window, :Window,
|
458
|
+
:place, :int
|
459
|
+
end
|
460
|
+
|
461
|
+
class XCirculateRequestEvent < FFI::Struct
|
462
|
+
layout \
|
463
|
+
:type, :int,
|
464
|
+
:serial, :ulong,
|
465
|
+
:send_event, :Bool,
|
466
|
+
:display, :pointer,
|
467
|
+
:event, :Window,
|
468
|
+
:window, :Window,
|
469
|
+
:place, :int
|
470
|
+
end
|
471
|
+
|
472
|
+
class XPropertyEvent < FFI::Struct
|
473
|
+
layout \
|
474
|
+
:type, :int,
|
475
|
+
:serial, :ulong,
|
476
|
+
:send_event, :Bool,
|
477
|
+
:display, :pointer,
|
478
|
+
:window, :Window,
|
479
|
+
:atom, :Atom,
|
480
|
+
:time, :Time,
|
481
|
+
:state, :int
|
482
|
+
end
|
483
|
+
|
484
|
+
class XSelectionClearEvent < FFI::Struct
|
485
|
+
layout \
|
486
|
+
:type, :int,
|
487
|
+
:serial, :ulong,
|
488
|
+
:send_event, :Bool,
|
489
|
+
:display, :pointer,
|
490
|
+
:window, :Window,
|
491
|
+
:selection, :Atom,
|
492
|
+
:time, :Time
|
493
|
+
end
|
494
|
+
|
495
|
+
class XSelectionRequestEvent < FFI::Struct
|
496
|
+
layout \
|
497
|
+
:type, :int,
|
498
|
+
:serial, :ulong,
|
499
|
+
:send_event, :Bool,
|
500
|
+
:display, :pointer,
|
501
|
+
:owner, :Window,
|
502
|
+
:requestor, :Window,
|
503
|
+
:selection, :Atom,
|
504
|
+
:target, :Atom,
|
505
|
+
:property, :Atom,
|
506
|
+
:time, :Time
|
507
|
+
end
|
508
|
+
|
509
|
+
class XSelectionEvent < FFI::Struct
|
510
|
+
layout \
|
511
|
+
:type, :int,
|
512
|
+
:serial, :ulong,
|
513
|
+
:send_event, :Bool,
|
514
|
+
:display, :pointer,
|
515
|
+
:requestor, :Window,
|
516
|
+
:selection, :Atom,
|
517
|
+
:target, :Atom,
|
518
|
+
:property, :Atom,
|
519
|
+
:time, :Time
|
520
|
+
end
|
521
|
+
|
522
|
+
class XColormapEvent < FFI::Struct
|
523
|
+
layout \
|
524
|
+
:type, :int,
|
525
|
+
:serial, :ulong,
|
526
|
+
:send_event, :Bool,
|
527
|
+
:display, :pointer,
|
528
|
+
:window, :Window,
|
529
|
+
:colormap, :Colormap,
|
530
|
+
:new, :Bool,
|
531
|
+
:state, :int
|
532
|
+
end
|
533
|
+
|
534
|
+
class XClientMessageEvent < FFI::Struct
|
535
|
+
class Data < FFI::Struct
|
536
|
+
layout \
|
537
|
+
:b, [:char, 20],
|
538
|
+
:s, [:short, 10],
|
539
|
+
:l, [:long, 5]
|
540
|
+
end
|
541
|
+
|
542
|
+
layout \
|
543
|
+
:type, :int,
|
544
|
+
:serial, :ulong,
|
545
|
+
:send_event, :Bool,
|
546
|
+
:display, :pointer,
|
547
|
+
:window, :Window,
|
548
|
+
:message_type, :Atom,
|
549
|
+
:format, :int,
|
550
|
+
:data, Data
|
551
|
+
end
|
552
|
+
|
553
|
+
class XMappingEvent < FFI::Struct
|
554
|
+
layout \
|
555
|
+
:type, :int,
|
556
|
+
:serial, :ulong,
|
557
|
+
:send_event, :Bool,
|
558
|
+
:display, :pointer,
|
559
|
+
:window, :Window,
|
560
|
+
:request, :int,
|
561
|
+
:first_keycode, :int,
|
562
|
+
:count, :int
|
563
|
+
end
|
564
|
+
|
565
|
+
class XErrorEvent < FFI::Struct
|
566
|
+
layout \
|
567
|
+
:type, :int,
|
568
|
+
:display, :pointer,
|
569
|
+
:resourceid, :XID,
|
570
|
+
:serial, :ulong,
|
571
|
+
:error_code, :uchar,
|
572
|
+
:request_code, :uchar,
|
573
|
+
:minor_code, :uchar
|
574
|
+
end
|
575
|
+
|
576
|
+
class XKeymapEvent < FFI::Struct
|
577
|
+
layout \
|
578
|
+
:type, :int,
|
579
|
+
:serial, :ulong,
|
580
|
+
:send_event, :Bool,
|
581
|
+
:display, :pointer,
|
582
|
+
:window, :Window,
|
583
|
+
:key_vector, [:char, 32]
|
584
|
+
end
|
585
|
+
|
586
|
+
class XGenericEvent < FFI::Struct
|
587
|
+
layout \
|
588
|
+
:type, :int,
|
589
|
+
:serial, :ulong,
|
590
|
+
:send_event, :Bool,
|
591
|
+
:display, :pointer,
|
592
|
+
:extension, :int,
|
593
|
+
:evtype, :int
|
594
|
+
end
|
595
|
+
|
596
|
+
class XGenericEventCookie < FFI::Struct
|
597
|
+
layout \
|
598
|
+
:type, :int,
|
599
|
+
:serial, :ulong,
|
600
|
+
:send_event, :Bool,
|
601
|
+
:display, :pointer,
|
602
|
+
:extension, :int,
|
603
|
+
:evtype, :int,
|
604
|
+
:cookie, :uint,
|
605
|
+
:data, :pointer
|
606
|
+
end
|
607
|
+
|
608
|
+
class XEvent < FFI::Union
|
609
|
+
layout \
|
610
|
+
:type, :int,
|
611
|
+
:xany, XAnyEvent,
|
612
|
+
:xkey, XKeyEvent,
|
613
|
+
:xbutton, XButtonEvent,
|
614
|
+
:xmotion, XMotionEvent,
|
615
|
+
:xcrossing, XCrossingEvent,
|
616
|
+
:xfocus, XFocusChangeEvent,
|
617
|
+
:xexpose, XExposeEvent,
|
618
|
+
:xgraphicsexpose, XGraphicsExposeEvent,
|
619
|
+
:xnoexpose, XNoExposeEvent,
|
620
|
+
:xvisibility, XVisibilityEvent,
|
621
|
+
:xcreatewindow, XCreateWindowEvent,
|
622
|
+
:xdestroywindow, XDestroyWindowEvent,
|
623
|
+
:xunmap, XUnmapEvent,
|
624
|
+
:xmap, XMapEvent,
|
625
|
+
:xmaprequest, XMapRequestEvent,
|
626
|
+
:xreparent, XReparentEvent,
|
627
|
+
:xconfigure, XConfigureEvent,
|
628
|
+
:xgravity, XGravityEvent,
|
629
|
+
:xresizerequest, XResizeRequestEvent,
|
630
|
+
:xconfigurerequest, XConfigureRequestEvent,
|
631
|
+
:xcirculate, XCirculateEvent,
|
632
|
+
:xcirculaterequest, XCirculateRequestEvent,
|
633
|
+
:xproperty, XPropertyEvent,
|
634
|
+
:xselectionclear, XSelectionClearEvent,
|
635
|
+
:xselectionrequest, XSelectionRequestEvent,
|
636
|
+
:xselection, XSelectionEvent,
|
637
|
+
:xcolormap, XColormapEvent,
|
638
|
+
:xclient, XClientMessageEvent,
|
639
|
+
:xmapping, XMappingEvent,
|
640
|
+
:xerror, XErrorEvent,
|
641
|
+
:xkeymap, XKeymapEvent,
|
642
|
+
:xgeneric, XGenericEvent,
|
643
|
+
:xcookie, XGenericEventCookie,
|
644
|
+
:pad, [:long, 24]
|
645
|
+
end
|
646
|
+
end
|
647
|
+
end
|