xlib-xinput2 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9a597e27c531c6e8fba94e2f342af92ff5049ecb
4
+ data.tar.gz: e928ef334107998c36fb771858a9bb5ba97f47a9
5
+ SHA512:
6
+ metadata.gz: 3725ab88c12e336f189536f81ce7e649529334c4151eebb71e2c9de85c75b9e90d78337ed14d1c4304f946d6ea4c97517323d726cd3c4f817b6da304106a5fb1
7
+ data.tar.gz: 67df950de06ce890fc6b761ed2502c23167f2f253188053d87c5eaaabc4c0d05cbe9f276379ef45d97d0233a4f046c89fafaedaf296994ce171c79b7a0a29cd8
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in xlib-xinput2.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Christopher Aue
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ Simple 1:1 interface to XInput2 for ruby
2
+ ========================================
3
+
4
+ This gem just wraps Xlib's XInput2 extension and makes its interface
5
+ available in ruby through ffi. XInput2 documentation can be found in its
6
+ [manual](http://cgit.freedesktop.org/xorg/lib/libXi/tree/man) (functions
7
+ starting with XI belong to XInput Version 2 as defined in the
8
+ [header](http://cgit.freedesktop.org/xorg/lib/libXi/tree/include/X11/extensions/XInput2.h)).
9
+ No functions have been renamed or abstracted away in some objects. It's
10
+ just the plain XInput2 API.
11
+
12
+ For a lightweight wrapper and a more ruby style access to X11 have a look at
13
+ [ruby-xlib-objects'](https://github.com/christopheraue/ruby-xlib-objects).
14
+
15
+ Installation
16
+ ------------
17
+ ```
18
+ gem install xlib-xinput2
19
+ ```
20
+
21
+ Usage
22
+ -----
23
+ All constants and methods of XInput can found under their original name in
24
+ the Xlib namespace.
25
+
26
+ ```ruby
27
+ d = Xlib::XOpenDisplay(':0')
28
+ maj = FFI::MemoryPointer.new :int
29
+ min = FFI::MemoryPointer.new :int
30
+
31
+ maj.write_int 2
32
+ min.write_int 1
33
+
34
+ Xlib::XIQueryVersion(d, maj, min)
35
+ ```
@@ -0,0 +1,4 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ Dir[File.expand_path("tasks/*.rake", File.dirname(__FILE__))].each { |ext| load ext }
4
+
@@ -0,0 +1,14 @@
1
+ require "xlib/xinput2/version"
2
+ require "xlib"
3
+
4
+ module Xlib
5
+ ffi_lib 'Xi'
6
+
7
+ class_eval File.read(File.join(File.dirname(__FILE__), 'xinput2/generated/XI2.rb'))
8
+ class_eval File.read(File.join(File.dirname(__FILE__), 'xinput2/generated/XInput2.rb'))
9
+
10
+ XIGroupState = XIModifierState
11
+ XILeaveEvent = XIEnterEvent
12
+ XIFocusInEvent = XIEnterEvent
13
+ XIFocusOutEvent = XIEnterEvent
14
+ end
@@ -0,0 +1,143 @@
1
+ XInput_2_0 = 7
2
+ XI_2_Major = 2
3
+ XI_2_Minor = 3
4
+ XIPropertyDeleted = 0
5
+ XIPropertyCreated = 1
6
+ XIPropertyModified = 2
7
+ XIPropModeReplace = 0
8
+ XIPropModePrepend = 1
9
+ XIPropModeAppend = 2
10
+ XIAnyPropertyType = 0
11
+ XINotifyNormal = 0
12
+ XINotifyGrab = 1
13
+ XINotifyUngrab = 2
14
+ XINotifyWhileGrabbed = 3
15
+ XINotifyPassiveGrab = 4
16
+ XINotifyPassiveUngrab = 5
17
+ XINotifyAncestor = 0
18
+ XINotifyVirtual = 1
19
+ XINotifyInferior = 2
20
+ XINotifyNonlinear = 3
21
+ XINotifyNonlinearVirtual = 4
22
+ XINotifyPointer = 5
23
+ XINotifyPointerRoot = 6
24
+ XINotifyDetailNone = 7
25
+ XIGrabModeSync = 0
26
+ XIGrabModeAsync = 1
27
+ XIGrabModeTouch = 2
28
+ XIGrabSuccess = 0
29
+ XIAlreadyGrabbed = 1
30
+ XIGrabInvalidTime = 2
31
+ XIGrabNotViewable = 3
32
+ XIGrabFrozen = 4
33
+ XIGrabtypeButton = 0
34
+ XIGrabtypeKeycode = 1
35
+ XIGrabtypeEnter = 2
36
+ XIGrabtypeFocusIn = 3
37
+ XIGrabtypeTouchBegin = 4
38
+ XIAnyModifier = (1 << 31)
39
+ XIAnyButton = 0
40
+ XIAnyKeycode = 0
41
+ XIAsyncDevice = 0
42
+ XISyncDevice = 1
43
+ XIReplayDevice = 2
44
+ XIAsyncPairedDevice = 3
45
+ XIAsyncPair = 4
46
+ XISyncPair = 5
47
+ XIAcceptTouch = 6
48
+ XIRejectTouch = 7
49
+ XISlaveSwitch = 1
50
+ XIDeviceChange = 2
51
+ XIMasterAdded = (1 << 0)
52
+ XIMasterRemoved = (1 << 1)
53
+ XISlaveAdded = (1 << 2)
54
+ XISlaveRemoved = (1 << 3)
55
+ XISlaveAttached = (1 << 4)
56
+ XISlaveDetached = (1 << 5)
57
+ XIDeviceEnabled = (1 << 6)
58
+ XIDeviceDisabled = (1 << 7)
59
+ XIAddMaster = 1
60
+ XIRemoveMaster = 2
61
+ XIAttachSlave = 3
62
+ XIDetachSlave = 4
63
+ XIAttachToMaster = 1
64
+ XIFloating = 2
65
+ XIModeRelative = 0
66
+ XIModeAbsolute = 1
67
+ XIMasterPointer = 1
68
+ XIMasterKeyboard = 2
69
+ XISlavePointer = 3
70
+ XISlaveKeyboard = 4
71
+ XIFloatingSlave = 5
72
+ XIKeyClass = 0
73
+ XIButtonClass = 1
74
+ XIValuatorClass = 2
75
+ XIScrollClass = 3
76
+ XITouchClass = 8
77
+ XIScrollTypeVertical = 1
78
+ XIScrollTypeHorizontal = 2
79
+ XIScrollFlagNoEmulation = (1 << 0)
80
+ XIScrollFlagPreferred = (1 << 1)
81
+ XIKeyRepeat = (1 << 16)
82
+ XIPointerEmulated = (1 << 16)
83
+ XITouchPendingEnd = (1 << 16)
84
+ XITouchEmulatingPointer = (1 << 17)
85
+ XIBarrierPointerReleased = (1 << 0)
86
+ XIBarrierDeviceIsGrabbed = (1 << 1)
87
+ XIDirectTouch = 1
88
+ XIDependentTouch = 2
89
+ XIAllDevices = 0
90
+ XIAllMasterDevices = 1
91
+ XI_DeviceChanged = 1
92
+ XI_KeyPress = 2
93
+ XI_KeyRelease = 3
94
+ XI_ButtonPress = 4
95
+ XI_ButtonRelease = 5
96
+ XI_Motion = 6
97
+ XI_Enter = 7
98
+ XI_Leave = 8
99
+ XI_FocusIn = 9
100
+ XI_FocusOut = 10
101
+ XI_HierarchyChanged = 11
102
+ XI_PropertyEvent = 12
103
+ XI_RawKeyPress = 13
104
+ XI_RawKeyRelease = 14
105
+ XI_RawButtonPress = 15
106
+ XI_RawButtonRelease = 16
107
+ XI_RawMotion = 17
108
+ XI_TouchBegin = 18
109
+ XI_TouchUpdate = 19
110
+ XI_TouchEnd = 20
111
+ XI_TouchOwnership = 21
112
+ XI_RawTouchBegin = 22
113
+ XI_RawTouchUpdate = 23
114
+ XI_RawTouchEnd = 24
115
+ XI_BarrierHit = 25
116
+ XI_BarrierLeave = 26
117
+ XI_LASTEVENT = 26
118
+ XI_DeviceChangedMask = (1 << 1)
119
+ XI_KeyPressMask = (1 << 2)
120
+ XI_KeyReleaseMask = (1 << 3)
121
+ XI_ButtonPressMask = (1 << 4)
122
+ XI_ButtonReleaseMask = (1 << 5)
123
+ XI_MotionMask = (1 << 6)
124
+ XI_EnterMask = (1 << 7)
125
+ XI_LeaveMask = (1 << 8)
126
+ XI_FocusInMask = (1 << 9)
127
+ XI_FocusOutMask = (1 << 10)
128
+ XI_HierarchyChangedMask = (1 << 11)
129
+ XI_PropertyEventMask = (1 << 12)
130
+ XI_RawKeyPressMask = (1 << 13)
131
+ XI_RawKeyReleaseMask = (1 << 14)
132
+ XI_RawButtonPressMask = (1 << 15)
133
+ XI_RawButtonReleaseMask = (1 << 16)
134
+ XI_RawMotionMask = (1 << 17)
135
+ XI_TouchBeginMask = (1 << 18)
136
+ XI_TouchEndMask = (1 << 20)
137
+ XI_TouchOwnershipChangedMask = (1 << 21)
138
+ XI_TouchUpdateMask = (1 << 19)
139
+ XI_RawTouchBeginMask = (1 << 22)
140
+ XI_RawTouchEndMask = (1 << 24)
141
+ XI_RawTouchUpdateMask = (1 << 23)
142
+ XI_BarrierHitMask = (1 << 25)
143
+ XI_BarrierLeaveMask = (1 << 26)
@@ -0,0 +1,370 @@
1
+ class XIAddMasterInfo < FFI::Struct
2
+ layout(
3
+ :type, :int,
4
+ :name, :pointer,
5
+ :send_core, Bool,
6
+ :enable, Bool
7
+ )
8
+ def name=(str)
9
+ @name = FFI::MemoryPointer.from_string(str)
10
+ self[:name] = @name
11
+ end
12
+ def name
13
+ @name.get_string(0)
14
+ end
15
+
16
+ end
17
+ class XIRemoveMasterInfo < FFI::Struct
18
+ layout(
19
+ :type, :int,
20
+ :deviceid, :int,
21
+ :return_mode, :int,
22
+ :return_pointer, :int,
23
+ :return_keyboard, :int
24
+ )
25
+ end
26
+ class XIAttachSlaveInfo < FFI::Struct
27
+ layout(
28
+ :type, :int,
29
+ :deviceid, :int,
30
+ :new_master, :int
31
+ )
32
+ end
33
+ class XIDetachSlaveInfo < FFI::Struct
34
+ layout(
35
+ :type, :int,
36
+ :deviceid, :int
37
+ )
38
+ end
39
+ class XIAnyHierarchyChangeInfo < FFI::Union
40
+ layout(
41
+ :type, :int,
42
+ :add, XIAddMasterInfo,
43
+ :remove, XIRemoveMasterInfo,
44
+ :attach, XIAttachSlaveInfo,
45
+ :detach, XIDetachSlaveInfo
46
+ )
47
+ end
48
+ class XIModifierState < FFI::Struct
49
+ layout(
50
+ :base, :int,
51
+ :latched, :int,
52
+ :locked, :int,
53
+ :effective, :int
54
+ )
55
+ end
56
+ class XIButtonState < FFI::Struct
57
+ layout(
58
+ :mask_len, :int,
59
+ :mask, :pointer
60
+ )
61
+ end
62
+ class XIValuatorState < FFI::Struct
63
+ layout(
64
+ :mask_len, :int,
65
+ :mask, :pointer,
66
+ :values, :pointer
67
+ )
68
+ end
69
+ class XIEventMask < FFI::Struct
70
+ layout(
71
+ :deviceid, :int,
72
+ :mask_len, :int,
73
+ :mask, :pointer
74
+ )
75
+ end
76
+ class XIAnyClassInfo < FFI::Struct
77
+ layout(
78
+ :type, :int,
79
+ :sourceid, :int
80
+ )
81
+ end
82
+ class XIButtonClassInfo < FFI::Struct
83
+ layout(
84
+ :type, :int,
85
+ :sourceid, :int,
86
+ :num_buttons, :int,
87
+ :labels, :pointer,
88
+ :state, XIButtonState
89
+ )
90
+ end
91
+ class XIKeyClassInfo < FFI::Struct
92
+ layout(
93
+ :type, :int,
94
+ :sourceid, :int,
95
+ :num_keycodes, :int,
96
+ :keycodes, :pointer
97
+ )
98
+ end
99
+ class XIValuatorClassInfo < FFI::Struct
100
+ layout(
101
+ :type, :int,
102
+ :sourceid, :int,
103
+ :number, :int,
104
+ :label, :ulong,
105
+ :min, :double,
106
+ :max, :double,
107
+ :value, :double,
108
+ :resolution, :int,
109
+ :mode, :int
110
+ )
111
+ end
112
+ class XIScrollClassInfo < FFI::Struct
113
+ layout(
114
+ :type, :int,
115
+ :sourceid, :int,
116
+ :number, :int,
117
+ :scroll_type, :int,
118
+ :increment, :double,
119
+ :flags, :int
120
+ )
121
+ end
122
+ class XITouchClassInfo < FFI::Struct
123
+ layout(
124
+ :type, :int,
125
+ :sourceid, :int,
126
+ :mode, :int,
127
+ :num_touches, :int
128
+ )
129
+ end
130
+ class XIDeviceInfo < FFI::Struct
131
+ layout(
132
+ :deviceid, :int,
133
+ :name, :pointer,
134
+ :use, :int,
135
+ :attachment, :int,
136
+ :enabled, Bool,
137
+ :num_classes, :int,
138
+ :classes, :pointer
139
+ )
140
+ def name=(str)
141
+ @name = FFI::MemoryPointer.from_string(str)
142
+ self[:name] = @name
143
+ end
144
+ def name
145
+ @name.get_string(0)
146
+ end
147
+
148
+ end
149
+ class XIGrabModifiers < FFI::Struct
150
+ layout(
151
+ :modifiers, :int,
152
+ :status, :int
153
+ )
154
+ end
155
+ class XIBarrierReleasePointerInfo < FFI::Struct
156
+ layout(
157
+ :deviceid, :int,
158
+ :barrier, :ulong,
159
+ :eventid, :uint
160
+ )
161
+ end
162
+ class XIEvent < FFI::Struct
163
+ layout(
164
+ :type, :int,
165
+ :serial, :ulong,
166
+ :send_event, Bool,
167
+ :display, :pointer,
168
+ :extension, :int,
169
+ :evtype, :int,
170
+ :time, :ulong
171
+ )
172
+ end
173
+ class XIHierarchyInfo < FFI::Struct
174
+ layout(
175
+ :deviceid, :int,
176
+ :attachment, :int,
177
+ :use, :int,
178
+ :enabled, Bool,
179
+ :flags, :int
180
+ )
181
+ end
182
+ class XIHierarchyEvent < FFI::Struct
183
+ layout(
184
+ :type, :int,
185
+ :serial, :ulong,
186
+ :send_event, Bool,
187
+ :display, :pointer,
188
+ :extension, :int,
189
+ :evtype, :int,
190
+ :time, :ulong,
191
+ :flags, :int,
192
+ :num_info, :int,
193
+ :info, :pointer
194
+ )
195
+ end
196
+ class XIDeviceChangedEvent < FFI::Struct
197
+ layout(
198
+ :type, :int,
199
+ :serial, :ulong,
200
+ :send_event, Bool,
201
+ :display, :pointer,
202
+ :extension, :int,
203
+ :evtype, :int,
204
+ :time, :ulong,
205
+ :deviceid, :int,
206
+ :sourceid, :int,
207
+ :reason, :int,
208
+ :num_classes, :int,
209
+ :classes, :pointer
210
+ )
211
+ end
212
+ class XIDeviceEvent < FFI::Struct
213
+ layout(
214
+ :type, :int,
215
+ :serial, :ulong,
216
+ :send_event, Bool,
217
+ :display, :pointer,
218
+ :extension, :int,
219
+ :evtype, :int,
220
+ :time, :ulong,
221
+ :deviceid, :int,
222
+ :sourceid, :int,
223
+ :detail, :int,
224
+ :root, :ulong,
225
+ :event, :ulong,
226
+ :child, :ulong,
227
+ :root_x, :double,
228
+ :root_y, :double,
229
+ :event_x, :double,
230
+ :event_y, :double,
231
+ :flags, :int,
232
+ :buttons, XIButtonState,
233
+ :valuators, XIValuatorState,
234
+ :mods, XIModifierState,
235
+ :group, XIModifierState
236
+ )
237
+ end
238
+ class XIRawEvent < FFI::Struct
239
+ layout(
240
+ :type, :int,
241
+ :serial, :ulong,
242
+ :send_event, Bool,
243
+ :display, :pointer,
244
+ :extension, :int,
245
+ :evtype, :int,
246
+ :time, :ulong,
247
+ :deviceid, :int,
248
+ :sourceid, :int,
249
+ :detail, :int,
250
+ :flags, :int,
251
+ :valuators, XIValuatorState,
252
+ :raw_values, :pointer
253
+ )
254
+ end
255
+ class XIEnterEvent < FFI::Struct
256
+ layout(
257
+ :type, :int,
258
+ :serial, :ulong,
259
+ :send_event, Bool,
260
+ :display, :pointer,
261
+ :extension, :int,
262
+ :evtype, :int,
263
+ :time, :ulong,
264
+ :deviceid, :int,
265
+ :sourceid, :int,
266
+ :detail, :int,
267
+ :root, :ulong,
268
+ :event, :ulong,
269
+ :child, :ulong,
270
+ :root_x, :double,
271
+ :root_y, :double,
272
+ :event_x, :double,
273
+ :event_y, :double,
274
+ :mode, :int,
275
+ :focus, Bool,
276
+ :same_screen, Bool,
277
+ :buttons, XIButtonState,
278
+ :mods, XIModifierState,
279
+ :group, XIModifierState
280
+ )
281
+ end
282
+ class XIPropertyEvent < FFI::Struct
283
+ layout(
284
+ :type, :int,
285
+ :serial, :ulong,
286
+ :send_event, Bool,
287
+ :display, :pointer,
288
+ :extension, :int,
289
+ :evtype, :int,
290
+ :time, :ulong,
291
+ :deviceid, :int,
292
+ :property, :ulong,
293
+ :what, :int
294
+ )
295
+ end
296
+ class XITouchOwnershipEvent < FFI::Struct
297
+ layout(
298
+ :type, :int,
299
+ :serial, :ulong,
300
+ :send_event, Bool,
301
+ :display, :pointer,
302
+ :extension, :int,
303
+ :evtype, :int,
304
+ :time, :ulong,
305
+ :deviceid, :int,
306
+ :sourceid, :int,
307
+ :touchid, :uint,
308
+ :root, :ulong,
309
+ :event, :ulong,
310
+ :child, :ulong,
311
+ :flags, :int
312
+ )
313
+ end
314
+ class XIBarrierEvent < FFI::Struct
315
+ layout(
316
+ :type, :int,
317
+ :serial, :ulong,
318
+ :send_event, Bool,
319
+ :display, :pointer,
320
+ :extension, :int,
321
+ :evtype, :int,
322
+ :time, :ulong,
323
+ :deviceid, :int,
324
+ :sourceid, :int,
325
+ :event, :ulong,
326
+ :root, :ulong,
327
+ :root_x, :double,
328
+ :root_y, :double,
329
+ :dx, :double,
330
+ :dy, :double,
331
+ :dtime, :int,
332
+ :flags, :int,
333
+ :barrier, :ulong,
334
+ :eventid, :uint
335
+ )
336
+ end
337
+ attach_function :XIQueryPointer, [ :pointer, :int, :ulong, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer ], Bool
338
+ attach_function :XIWarpPointer, [ :pointer, :int, :ulong, :ulong, :double, :double, :uint, :uint, :double, :double ], Bool
339
+ attach_function :XIDefineCursor, [ :pointer, :int, :ulong, :ulong ], :int
340
+ attach_function :XIUndefineCursor, [ :pointer, :int, :ulong ], :int
341
+ attach_function :XIChangeHierarchy, [ :pointer, :pointer, :int ], :int
342
+ attach_function :XISetClientPointer, [ :pointer, :ulong, :int ], :int
343
+ attach_function :XIGetClientPointer, [ :pointer, :ulong, :pointer ], Bool
344
+ attach_function :XISelectEvents, [ :pointer, :ulong, :pointer, :int ], :int
345
+ attach_function :XIGetSelectedEvents, [ :pointer, :ulong, :pointer ], :pointer
346
+ attach_function :XIQueryVersion, [ :pointer, :pointer, :pointer ], :int
347
+ attach_function :XIQueryDevice, [ :pointer, :int, :pointer ], :pointer
348
+ attach_function :XISetFocus, [ :pointer, :int, :ulong, :ulong ], :int
349
+ attach_function :XIGetFocus, [ :pointer, :int, :pointer ], :int
350
+ attach_function :XIGrabDevice, [ :pointer, :int, :ulong, :ulong, :ulong, :int, :int, Bool, :pointer ], :int
351
+ attach_function :XIUngrabDevice, [ :pointer, :int, :ulong ], :int
352
+ attach_function :XIAllowEvents, [ :pointer, :int, :int, :ulong ], :int
353
+ attach_function :XIAllowTouchEvents, [ :pointer, :int, :uint, :ulong, :int ], :int
354
+ attach_function :XIGrabButton, [ :pointer, :int, :int, :ulong, :ulong, :int, :int, :int, :pointer, :int, :pointer ], :int
355
+ attach_function :XIGrabKeycode, [ :pointer, :int, :int, :ulong, :int, :int, :int, :pointer, :int, :pointer ], :int
356
+ attach_function :XIGrabEnter, [ :pointer, :int, :ulong, :ulong, :int, :int, :int, :pointer, :int, :pointer ], :int
357
+ attach_function :XIGrabFocusIn, [ :pointer, :int, :ulong, :int, :int, :int, :pointer, :int, :pointer ], :int
358
+ attach_function :XIGrabTouchBegin, [ :pointer, :int, :ulong, :int, :pointer, :int, :pointer ], :int
359
+ attach_function :XIUngrabButton, [ :pointer, :int, :int, :ulong, :int, :pointer ], :int
360
+ attach_function :XIUngrabKeycode, [ :pointer, :int, :int, :ulong, :int, :pointer ], :int
361
+ attach_function :XIUngrabEnter, [ :pointer, :int, :ulong, :int, :pointer ], :int
362
+ attach_function :XIUngrabFocusIn, [ :pointer, :int, :ulong, :int, :pointer ], :int
363
+ attach_function :XIUngrabTouchBegin, [ :pointer, :int, :ulong, :int, :pointer ], :int
364
+ attach_function :XIListProperties, [ :pointer, :int, :pointer ], :pointer
365
+ attach_function :XIChangeProperty, [ :pointer, :int, :ulong, :ulong, :int, :int, :pointer, :int ], :void
366
+ attach_function :XIDeleteProperty, [ :pointer, :int, :ulong ], :void
367
+ attach_function :XIGetProperty, [ :pointer, :int, :ulong, :long, :long, Bool, :ulong, :pointer, :pointer, :pointer, :pointer, :pointer ], :int
368
+ attach_function :XIBarrierReleasePointers, [ :pointer, :pointer, :int ], :void
369
+ attach_function :XIBarrierReleasePointer, [ :pointer, :int, :ulong, :uint ], :void
370
+ attach_function :XIFreeDeviceInfo, [ :pointer ], :void
@@ -0,0 +1,5 @@
1
+ module Xlib
2
+ module XInput2
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ %module XI2
2
+
3
+ %include "X11/extensions/XI2.h"
@@ -0,0 +1,15 @@
1
+ %module XInput2
2
+
3
+ #define _XFUNCPROTOBEGIN
4
+ #define _XFUNCPROTOEND
5
+
6
+ #define Status int
7
+ typedef unsigned long XID;
8
+ typedef XID Atom;
9
+ typedef XID Time;
10
+ typedef XID Window;
11
+ typedef XID Cursor;
12
+ typedef XID PointerBarrier;
13
+
14
+ %include "X11/extensions/XInput2.h"
15
+
@@ -0,0 +1,14 @@
1
+ namespace :ffi do
2
+ desc 'Generate ffi interface'
3
+ task :generate do
4
+ `swig -xml -o XI2_wrap.xml -I/usr/include swig/XI2.i`
5
+ `swig -xml -o XInput2_wrap.xml -I/usr/include swig/XInput2.i`
6
+
7
+ `ffi-gen XI2_wrap.xml lib/xlib/xinput2/generated/XI2.rb`
8
+ `ffi-gen XInput2_wrap.xml lib/xlib/xinput2/generated/XInput2.rb`
9
+
10
+ `sed -i 's/\\([0-9]\\)U/\\1/g' lib/xlib/xinput2/generated/XI2.rb`
11
+
12
+ `rm -f XI2_wrap.xml XInput2_wrap.xml`
13
+ end
14
+ end
data/test.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/setup'
2
+ Bundler.require
3
+
4
+ d = Xlib::XOpenDisplay(':0')
5
+ maj = FFI::MemoryPointer.new :int
6
+ min = FFI::MemoryPointer.new :int
7
+
8
+ maj.write_int 2
9
+ min.write_int 1
10
+
11
+ Xlib::XIQueryVersion(d, maj, min)
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xlib/xinput2/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xlib-xinput2"
8
+ spec.version = Xlib::XInput2::VERSION
9
+ spec.authors = ["Christopher Aue"]
10
+ spec.email = ["mail@christopheraue.net"]
11
+
12
+ spec.summary = 'Interface to Xlib XInput extensions Version 2'
13
+ spec.homepage = "https://github.com/christopheraue/ruby-xlib-xinput2"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.8"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "ffi-swig-generator", '~> 0'
23
+ spec.add_runtime_dependency 'xlib', '~> 1.1'
24
+ end
metadata ADDED
@@ -0,0 +1,115 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xlib-xinput2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Christopher Aue
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-12-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.8'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ffi-swig-generator
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: xlib
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.1'
69
+ description:
70
+ email:
71
+ - mail@christopheraue.net
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - lib/xlib/xinput2.rb
83
+ - lib/xlib/xinput2/generated/XI2.rb
84
+ - lib/xlib/xinput2/generated/XInput2.rb
85
+ - lib/xlib/xinput2/version.rb
86
+ - swig/XI2.i
87
+ - swig/XInput2.i
88
+ - tasks/ffi.rake
89
+ - test.rb
90
+ - xlib-xinput2.gemspec
91
+ homepage: https://github.com/christopheraue/ruby-xlib-xinput2
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubyforge_project:
111
+ rubygems_version: 2.4.5.1
112
+ signing_key:
113
+ specification_version: 4
114
+ summary: Interface to Xlib XInput extensions Version 2
115
+ test_files: []