x11 0.0.1a1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/X11/X.rb +33 -0
- data/lib/X11/X/c.rb +48 -0
- data/lib/X11/Xdefs.rb +29 -0
- data/lib/X11/Xdefs/c.rb +54 -0
- data/lib/X11/Xlib.rb +37 -0
- data/lib/X11/Xlib/c.rb +36 -0
- data/lib/X11/Xlib/c/functions.rb +54 -0
- data/lib/X11/Xlib/c/type/any_event.rb +36 -0
- data/lib/X11/Xlib/c/type/button_event.rb +46 -0
- data/lib/X11/Xlib/c/type/circulate_event.rb +38 -0
- data/lib/X11/Xlib/c/type/circulate_request_event.rb +38 -0
- data/lib/X11/Xlib/c/type/client_message_event.rb +46 -0
- data/lib/X11/Xlib/c/type/colormap_event.rb +39 -0
- data/lib/X11/Xlib/c/type/configure_event.rb +44 -0
- data/lib/X11/Xlib/c/type/configure_request_event.rb +45 -0
- data/lib/X11/Xlib/c/type/create_window_event.rb +43 -0
- data/lib/X11/Xlib/c/type/crossing_event.rb +48 -0
- data/lib/X11/Xlib/c/type/destroy_window_event.rb +37 -0
- data/lib/X11/Xlib/c/type/display.rb +75 -0
- data/lib/X11/Xlib/c/type/error_event.rb +38 -0
- data/lib/X11/Xlib/c/type/event.rb +67 -0
- data/lib/X11/Xlib/c/type/expose_event.rb +41 -0
- data/lib/X11/Xlib/c/type/focus_change_event.rb +38 -0
- data/lib/X11/Xlib/c/type/gc.rb +33 -0
- data/lib/X11/Xlib/c/type/generic_event.rb +37 -0
- data/lib/X11/Xlib/c/type/generic_event_cookie.rb +39 -0
- data/lib/X11/Xlib/c/type/graphics_expose_event.rb +44 -0
- data/lib/X11/Xlib/c/type/gravity_event.rb +39 -0
- data/lib/X11/Xlib/c/type/key_event.rb +46 -0
- data/lib/X11/Xlib/c/type/keymap_event.rb +37 -0
- data/lib/X11/Xlib/c/type/map_event.rb +38 -0
- data/lib/X11/Xlib/c/type/map_request_event.rb +41 -0
- data/lib/X11/Xlib/c/type/mapping_event.rb +39 -0
- data/lib/X11/Xlib/c/type/motion_event.rb +46 -0
- data/lib/X11/Xlib/c/type/no_expose_event.rb +38 -0
- data/lib/X11/Xlib/c/type/property_event.rb +39 -0
- data/lib/X11/Xlib/c/type/reparent_event.rb +41 -0
- data/lib/X11/Xlib/c/type/resize_request_event.rb +38 -0
- data/lib/X11/Xlib/c/type/screen.rb +50 -0
- data/lib/X11/Xlib/c/type/selection_clear_event.rb +38 -0
- data/lib/X11/Xlib/c/type/selection_event.rb +40 -0
- data/lib/X11/Xlib/c/type/selection_request_event.rb +41 -0
- data/lib/X11/Xlib/c/type/unmap_event.rb +38 -0
- data/lib/X11/Xlib/c/type/visibility_event.rb +37 -0
- data/lib/X11/Xlib/c/type/visual.rb +39 -0
- data/lib/X11/Xlib/c/type/window_attributes.rb +54 -0
- data/lib/X11/Xlib/c/types.rb +71 -0
- data/lib/X11/Xlib/display.rb +101 -0
- data/lib/X11/Xlib/event.rb +55 -0
- data/lib/X11/Xlib/event/any.rb +33 -0
- data/lib/X11/Xlib/event/button_press.rb +44 -0
- data/lib/X11/Xlib/event/button_release.rb +44 -0
- data/lib/X11/Xlib/event/circulate_notify.rb +36 -0
- data/lib/X11/Xlib/event/circulate_request.rb +36 -0
- data/lib/X11/Xlib/event/client_message.rb +37 -0
- data/lib/X11/Xlib/event/colormap_notify.rb +37 -0
- data/lib/X11/Xlib/event/configure_notify.rb +42 -0
- data/lib/X11/Xlib/event/configure_request.rb +43 -0
- data/lib/X11/Xlib/event/create_notify.rb +41 -0
- data/lib/X11/Xlib/event/destroy_notify.rb +35 -0
- data/lib/X11/Xlib/event/enter_notify.rb +31 -0
- data/lib/X11/Xlib/event/expose.rb +39 -0
- data/lib/X11/Xlib/event/focus_in.rb +36 -0
- data/lib/X11/Xlib/event/focus_out.rb +36 -0
- data/lib/X11/Xlib/event/generic_event.rb +38 -0
- data/lib/X11/Xlib/event/graphics_expose.rb +38 -0
- data/lib/X11/Xlib/event/gravity_notify.rb +37 -0
- data/lib/X11/Xlib/event/helper.rb +117 -0
- data/lib/X11/Xlib/event/key_press.rb +44 -0
- data/lib/X11/Xlib/event/key_release.rb +45 -0
- data/lib/X11/Xlib/event/keymap_notify.rb +39 -0
- data/lib/X11/Xlib/event/leave_notify.rb +43 -0
- data/lib/X11/Xlib/event/map_notify.rb +36 -0
- data/lib/X11/Xlib/event/map_request.rb +35 -0
- data/lib/X11/Xlib/event/mapping_notify.rb +37 -0
- data/lib/X11/Xlib/event/motion_notify.rb +44 -0
- data/lib/X11/Xlib/event/no_expose.rb +24 -0
- data/lib/X11/Xlib/event/property_notify.rb +37 -0
- data/lib/X11/Xlib/event/reparent_notify.rb +39 -0
- data/lib/X11/Xlib/event/resize_request.rb +36 -0
- data/lib/X11/Xlib/event/selection_clear.rb +36 -0
- data/lib/X11/Xlib/event/selection_notify.rb +39 -0
- data/lib/X11/Xlib/event/selection_request.rb +40 -0
- data/lib/X11/Xlib/event/unmap_notify.rb +36 -0
- data/lib/X11/Xlib/event/visibility_notify.rb +35 -0
- data/lib/X11/Xlib/events.rb +65 -0
- data/lib/X11/Xlib/mask.rb +72 -0
- data/lib/X11/Xlib/screen.rb +54 -0
- data/lib/X11/Xlib/visual.rb +48 -0
- data/lib/X11/Xlib/window.rb +104 -0
- data/lib/X11/Xlib/window/attributes.rb +67 -0
- data/lib/X11/Xmd.rb +29 -0
- data/lib/X11/Xmd/c.rb +49 -0
- data/lib/X11/extensions.rb +83 -0
- metadata +179 -0
@@ -0,0 +1,83 @@
|
|
1
|
+
#--
|
2
|
+
# Copyleft shura. [ shura1991@gmail.com ]
|
3
|
+
#
|
4
|
+
# This file is part of sysctl.
|
5
|
+
#
|
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.
|
10
|
+
#
|
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.
|
15
|
+
#
|
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/>.
|
18
|
+
#++
|
19
|
+
|
20
|
+
require 'ffi'
|
21
|
+
require 'memoized'
|
22
|
+
require 'refining'
|
23
|
+
|
24
|
+
module FFI
|
25
|
+
module Library
|
26
|
+
def ffi_lib_add (*names)
|
27
|
+
ffi_lib *((begin; ffi_libraries; rescue Exception; []; end).map { |lib| lib.name } + names).compact.uniq
|
28
|
+
end
|
29
|
+
|
30
|
+
def has_function? (sym, libraries=nil)
|
31
|
+
libraries ||= ffi_libraries
|
32
|
+
|
33
|
+
libraries.any? {|lib|
|
34
|
+
if lib.is_a?(DynamicLibrary)
|
35
|
+
lib
|
36
|
+
else
|
37
|
+
DynamicLibrary.new(lib, 0)
|
38
|
+
end.find_function(sym.to_s) rescue nil
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
def attach_function! (*args, &block)
|
43
|
+
begin
|
44
|
+
attach_function(*args, &block)
|
45
|
+
rescue Exception => e
|
46
|
+
false
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class Type::Builtin
|
52
|
+
memoize
|
53
|
+
def name
|
54
|
+
Type::Builtin.constants.find {|name|
|
55
|
+
Type::Builtin.const_get(name) == self
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
class Pointer
|
61
|
+
def typecast (type)
|
62
|
+
if type.is_a?(Symbol)
|
63
|
+
type = FFI.find_type(type)
|
64
|
+
end
|
65
|
+
|
66
|
+
if type.is_a?(Class) && type.ancestors.member?(FFI::Struct)
|
67
|
+
type.new(self)
|
68
|
+
elsif type.is_a?(Type::Builtin)
|
69
|
+
if type.name == :STRING
|
70
|
+
read_string
|
71
|
+
else
|
72
|
+
send "read_#{type.name.downcase}"
|
73
|
+
end
|
74
|
+
else
|
75
|
+
ArgumentError.new 'You have to pass a Struct, a Builtin type or a Symbol'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
find_type(:size_t) rescue typedef(:ulong, :size_t)
|
81
|
+
end
|
82
|
+
|
83
|
+
module X11; module C; extend FFI::Library; end; end
|
metadata
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: x11
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: 5
|
5
|
+
version: 0.0.1a1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- meh.
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-08-02 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: memoized
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :runtime
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: refining
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id002
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: ffi
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id003
|
48
|
+
description:
|
49
|
+
email: meh@paranoici.org
|
50
|
+
executables: []
|
51
|
+
|
52
|
+
extensions: []
|
53
|
+
|
54
|
+
extra_rdoc_files: []
|
55
|
+
|
56
|
+
files:
|
57
|
+
- lib/X11/Xlib.rb
|
58
|
+
- lib/X11/extensions.rb
|
59
|
+
- lib/X11/Xdefs/c.rb
|
60
|
+
- lib/X11/Xmd.rb
|
61
|
+
- lib/X11/X/c.rb
|
62
|
+
- lib/X11/X.rb
|
63
|
+
- lib/X11/Xmd/c.rb
|
64
|
+
- lib/X11/Xlib/event/visibility_notify.rb
|
65
|
+
- lib/X11/Xlib/event/create_notify.rb
|
66
|
+
- lib/X11/Xlib/event/circulate_notify.rb
|
67
|
+
- lib/X11/Xlib/event/circulate_request.rb
|
68
|
+
- lib/X11/Xlib/event/focus_out.rb
|
69
|
+
- lib/X11/Xlib/event/colormap_notify.rb
|
70
|
+
- lib/X11/Xlib/event/generic_event.rb
|
71
|
+
- lib/X11/Xlib/event/gravity_notify.rb
|
72
|
+
- lib/X11/Xlib/event/selection_clear.rb
|
73
|
+
- lib/X11/Xlib/event/focus_in.rb
|
74
|
+
- lib/X11/Xlib/event/helper.rb
|
75
|
+
- lib/X11/Xlib/event/graphics_expose.rb
|
76
|
+
- lib/X11/Xlib/event/no_expose.rb
|
77
|
+
- lib/X11/Xlib/event/button_press.rb
|
78
|
+
- lib/X11/Xlib/event/property_notify.rb
|
79
|
+
- lib/X11/Xlib/event/map_notify.rb
|
80
|
+
- lib/X11/Xlib/event/unmap_notify.rb
|
81
|
+
- lib/X11/Xlib/event/any.rb
|
82
|
+
- lib/X11/Xlib/event/key_release.rb
|
83
|
+
- lib/X11/Xlib/event/client_message.rb
|
84
|
+
- lib/X11/Xlib/event/reparent_notify.rb
|
85
|
+
- lib/X11/Xlib/event/expose.rb
|
86
|
+
- lib/X11/Xlib/event/resize_request.rb
|
87
|
+
- lib/X11/Xlib/event/selection_notify.rb
|
88
|
+
- lib/X11/Xlib/event/configure_notify.rb
|
89
|
+
- lib/X11/Xlib/event/leave_notify.rb
|
90
|
+
- lib/X11/Xlib/event/destroy_notify.rb
|
91
|
+
- lib/X11/Xlib/event/selection_request.rb
|
92
|
+
- lib/X11/Xlib/event/button_release.rb
|
93
|
+
- lib/X11/Xlib/event/enter_notify.rb
|
94
|
+
- lib/X11/Xlib/event/key_press.rb
|
95
|
+
- lib/X11/Xlib/event/mapping_notify.rb
|
96
|
+
- lib/X11/Xlib/event/map_request.rb
|
97
|
+
- lib/X11/Xlib/event/motion_notify.rb
|
98
|
+
- lib/X11/Xlib/event/keymap_notify.rb
|
99
|
+
- lib/X11/Xlib/event/configure_request.rb
|
100
|
+
- lib/X11/Xlib/visual.rb
|
101
|
+
- lib/X11/Xlib/screen.rb
|
102
|
+
- lib/X11/Xlib/window.rb
|
103
|
+
- lib/X11/Xlib/window/attributes.rb
|
104
|
+
- lib/X11/Xlib/mask.rb
|
105
|
+
- lib/X11/Xlib/c/type/map_event.rb
|
106
|
+
- lib/X11/Xlib/c/type/visual.rb
|
107
|
+
- lib/X11/Xlib/c/type/focus_change_event.rb
|
108
|
+
- lib/X11/Xlib/c/type/crossing_event.rb
|
109
|
+
- lib/X11/Xlib/c/type/selection_clear_event.rb
|
110
|
+
- lib/X11/Xlib/c/type/circulate_event.rb
|
111
|
+
- lib/X11/Xlib/c/type/map_request_event.rb
|
112
|
+
- lib/X11/Xlib/c/type/destroy_window_event.rb
|
113
|
+
- lib/X11/Xlib/c/type/generic_event.rb
|
114
|
+
- lib/X11/Xlib/c/type/colormap_event.rb
|
115
|
+
- lib/X11/Xlib/c/type/screen.rb
|
116
|
+
- lib/X11/Xlib/c/type/window_attributes.rb
|
117
|
+
- lib/X11/Xlib/c/type/button_event.rb
|
118
|
+
- lib/X11/Xlib/c/type/key_event.rb
|
119
|
+
- lib/X11/Xlib/c/type/mapping_event.rb
|
120
|
+
- lib/X11/Xlib/c/type/circulate_request_event.rb
|
121
|
+
- lib/X11/Xlib/c/type/no_expose_event.rb
|
122
|
+
- lib/X11/Xlib/c/type/error_event.rb
|
123
|
+
- lib/X11/Xlib/c/type/gravity_event.rb
|
124
|
+
- lib/X11/Xlib/c/type/selection_request_event.rb
|
125
|
+
- lib/X11/Xlib/c/type/motion_event.rb
|
126
|
+
- lib/X11/Xlib/c/type/create_window_event.rb
|
127
|
+
- lib/X11/Xlib/c/type/configure_event.rb
|
128
|
+
- lib/X11/Xlib/c/type/any_event.rb
|
129
|
+
- lib/X11/Xlib/c/type/graphics_expose_event.rb
|
130
|
+
- lib/X11/Xlib/c/type/configure_request_event.rb
|
131
|
+
- lib/X11/Xlib/c/type/selection_event.rb
|
132
|
+
- lib/X11/Xlib/c/type/client_message_event.rb
|
133
|
+
- lib/X11/Xlib/c/type/keymap_event.rb
|
134
|
+
- lib/X11/Xlib/c/type/resize_request_event.rb
|
135
|
+
- lib/X11/Xlib/c/type/visibility_event.rb
|
136
|
+
- lib/X11/Xlib/c/type/event.rb
|
137
|
+
- lib/X11/Xlib/c/type/expose_event.rb
|
138
|
+
- lib/X11/Xlib/c/type/gc.rb
|
139
|
+
- lib/X11/Xlib/c/type/generic_event_cookie.rb
|
140
|
+
- lib/X11/Xlib/c/type/property_event.rb
|
141
|
+
- lib/X11/Xlib/c/type/reparent_event.rb
|
142
|
+
- lib/X11/Xlib/c/type/unmap_event.rb
|
143
|
+
- lib/X11/Xlib/c/type/display.rb
|
144
|
+
- lib/X11/Xlib/c/types.rb
|
145
|
+
- lib/X11/Xlib/c/functions.rb
|
146
|
+
- lib/X11/Xlib/event.rb
|
147
|
+
- lib/X11/Xlib/events.rb
|
148
|
+
- lib/X11/Xlib/c.rb
|
149
|
+
- lib/X11/Xlib/display.rb
|
150
|
+
- lib/X11/Xdefs.rb
|
151
|
+
homepage: http://github.com/meh/ruby-x11
|
152
|
+
licenses: []
|
153
|
+
|
154
|
+
post_install_message:
|
155
|
+
rdoc_options: []
|
156
|
+
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: "0"
|
165
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
|
+
none: false
|
167
|
+
requirements:
|
168
|
+
- - ">"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: 1.3.1
|
171
|
+
requirements: []
|
172
|
+
|
173
|
+
rubyforge_project:
|
174
|
+
rubygems_version: 1.8.5
|
175
|
+
signing_key:
|
176
|
+
specification_version: 3
|
177
|
+
summary: Bindings for X11
|
178
|
+
test_files: []
|
179
|
+
|