libx11 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/bin/generate-constants +92 -0
- data/bin/generate-functions +64 -0
- data/bin/generate-structs +103 -0
- data/bin/typesym.rb +50 -0
- data/example/window_manager.rb +10 -14
- data/lib/libx11/version.rb +1 -1
- data/lib/libx11/x.rb +573 -132
- data/lib/libx11/xlib.rb +463 -28
- data/lib/libx11/xlib/depth.rb +11 -0
- data/lib/libx11/xlib/screen.rb +28 -0
- data/lib/libx11/xlib/screen_format.rb +12 -0
- data/lib/libx11/xlib/visual.rb +16 -0
- data/lib/libx11/xlib/{xany_event.rb → x_any_event.rb} +1 -1
- data/lib/libx11/xlib/x_arc.rb +14 -0
- data/lib/libx11/xlib/{xbutton_event.rb → x_button_event.rb} +2 -2
- data/lib/libx11/xlib/x_char2b.rb +10 -0
- data/lib/libx11/xlib/x_char_struct.rb +14 -0
- data/lib/libx11/xlib/{xcirculate_event.rb → x_circulate_event.rb} +1 -1
- data/lib/libx11/xlib/{xcirculate_request_event.rb → x_circulate_request_event.rb} +2 -2
- data/lib/libx11/xlib/{xclient_message_event.rb → x_client_message_event.rb} +0 -0
- data/lib/libx11/xlib/x_color.rb +14 -0
- data/lib/libx11/xlib/{xcolormap_event.rb → x_colormap_event.rb} +2 -2
- data/lib/libx11/xlib/{xconfigure_event.rb → x_configure_event.rb} +2 -2
- data/lib/libx11/xlib/{xconfigure_request_event.rb → x_configure_request_event.rb} +2 -2
- data/lib/libx11/xlib/{xcreate_window_event.rb → x_create_window_event.rb} +2 -2
- data/lib/libx11/xlib/{xcrossing_event.rb → x_crossing_event.rb} +4 -4
- data/lib/libx11/xlib/{xdestroy_window_event.rb → x_destroy_window_event.rb} +1 -1
- data/lib/libx11/xlib/x_edata_object.rb +14 -0
- data/lib/libx11/xlib/{xerror_event.rb → x_error_event.rb} +0 -0
- data/lib/libx11/xlib/{xevent.rb → x_event.rb} +34 -34
- data/lib/libx11/xlib/{xexpose_event.rb → x_expose_event.rb} +1 -1
- data/lib/libx11/xlib/x_ext_codes.rb +12 -0
- data/lib/libx11/xlib/{xfocus_change_event.rb → x_focus_change_event.rb} +2 -2
- data/lib/libx11/xlib/x_font_prop.rb +10 -0
- data/lib/libx11/xlib/x_font_set_extents.rb +10 -0
- data/lib/libx11/xlib/x_font_struct.rb +24 -0
- data/lib/libx11/xlib/{xgeneric_event.rb → x_generic_event.rb} +0 -0
- data/lib/libx11/xlib/{xgeneric_event_cookie.rb → x_generic_event_cookie.rb} +1 -1
- data/lib/libx11/xlib/{xgraphics_expose_event.rb → x_graphics_expose_event.rb} +1 -2
- data/lib/libx11/xlib/{xgravity_event.rb → x_gravity_event.rb} +1 -1
- data/lib/libx11/xlib/x_host_address.rb +11 -0
- data/lib/libx11/xlib/x_key_event.rb +23 -0
- data/lib/libx11/xlib/x_keyboard_control.rb +16 -0
- data/lib/libx11/xlib/x_keyboard_state.rb +15 -0
- data/lib/libx11/xlib/{xkeymap_event.rb → x_keymap_event.rb} +1 -1
- data/lib/libx11/xlib/{xmap_event.rb → x_map_event.rb} +2 -2
- data/lib/libx11/xlib/x_map_request_event.rb +14 -0
- data/lib/libx11/xlib/{xmapping_event.rb → x_mapping_event.rb} +1 -1
- data/lib/libx11/xlib/x_modifier_keymap.rb +10 -0
- data/lib/libx11/xlib/{xmotion_event.rb → x_motion_event.rb} +2 -2
- data/lib/libx11/xlib/{xno_expose_event.rb → x_no_expose_event.rb} +1 -1
- data/lib/libx11/xlib/x_pixmap_format_values.rb +11 -0
- data/lib/libx11/xlib/x_point.rb +10 -0
- data/lib/libx11/xlib/{xproperty_event.rb → x_property_event.rb} +1 -1
- data/lib/libx11/xlib/x_rectangle.rb +12 -0
- data/lib/libx11/xlib/{xreparent_event.rb → x_reparent_event.rb} +2 -2
- data/lib/libx11/xlib/{xresize_request_event.rb → x_resize_request_event.rb} +1 -1
- data/lib/libx11/xlib/x_segment.rb +12 -0
- data/lib/libx11/xlib/{xselection_clear_event.rb → x_selection_clear_event.rb} +1 -1
- data/lib/libx11/xlib/{xselection_event.rb → x_selection_event.rb} +1 -1
- data/lib/libx11/xlib/{xselection_request_event.rb → x_selection_request_event.rb} +1 -1
- data/lib/libx11/xlib/x_server_interpreted_address.rb +12 -0
- data/lib/libx11/xlib/x_set_window_attributes.rb +23 -0
- data/lib/libx11/xlib/x_text_item.rb +12 -0
- data/lib/libx11/xlib/x_text_item16.rb +12 -0
- data/lib/libx11/xlib/x_time_coord.rb +11 -0
- data/lib/libx11/xlib/{xunmap_event.rb → x_unmap_event.rb} +2 -2
- data/lib/libx11/xlib/{xvisibility_event.rb → x_visibility_event.rb} +1 -1
- data/lib/libx11/xlib/x_window_attributes.rb +31 -0
- data/lib/libx11/xlib/x_window_changes.rb +15 -0
- data/lib/libx11/xlib/xgc_values.rb +31 -0
- data/lib/libx11/xlib/xic_callback.rb +10 -0
- data/lib/libx11/xlib/xim_callback.rb +10 -0
- data/lib/libx11/xlib/xim_styles.rb +10 -0
- data/lib/libx11/xlib/xim_values_list.rb +10 -0
- data/lib/libx11/xlib/xmb_text_item.rb +12 -0
- data/lib/libx11/xlib/xom_char_set_list.rb +10 -0
- data/lib/libx11/xlib/xom_font_info.rb +11 -0
- data/lib/libx11/xlib/xom_orientation.rb +10 -0
- data/lib/libx11/xlib/xwc_text_item.rb +12 -0
- data/libx11.gemspec +2 -1
- metadata +105 -49
- data/lib/libx11/xlib/xkey_event.rb +0 -23
- data/lib/libx11/xlib/xmap_request_event.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 854819b1ec364d4bbfcb3df95e7e7b33ef05cc8e
|
|
4
|
+
data.tar.gz: b375827e9805d96cd316cd4e51306e52fb3fd61d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e08a4440c2dce4a1e00923181ebb039070d6883b0413d244cea19f88b926c32d80883f211875f2fe9337d527b6f6eca9e74cba44c0ecc1b9f982816bd704fa3
|
|
7
|
+
data.tar.gz: 9fe9991a6b16c20d734feadf30d7c81f97598d27da732b887bf0806273c0b909b57163486dde20860707860bbd41de7e2ae58b64d3e23ddbcf5ad6185f82e9f3
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
|
|
5
|
+
target = ARGV[0]
|
|
6
|
+
abort "'#{target}' does not exist" unless File.exist?(target)
|
|
7
|
+
|
|
8
|
+
source = File.read(target).split("\n")[109..714].join("\n")
|
|
9
|
+
source = source.gsub(%r[key/button], 'key button')
|
|
10
|
+
parts = source.split("\n\n")
|
|
11
|
+
|
|
12
|
+
class ConstGenerator
|
|
13
|
+
def initialize(parts)
|
|
14
|
+
@parts = parts
|
|
15
|
+
@entities = []
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def write
|
|
19
|
+
@parts.each do |part|
|
|
20
|
+
inject_part(part)
|
|
21
|
+
end
|
|
22
|
+
source = <<~PREFIX + @entities.join("\n\n") + "\n" + <<~SUFFIX
|
|
23
|
+
module LibX11
|
|
24
|
+
module X
|
|
25
|
+
PREFIX
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
SUFFIX
|
|
29
|
+
File.write('lib/libx11/x.rb', source)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
def inject_part(part)
|
|
35
|
+
entity = convert_part(part)
|
|
36
|
+
@entities << entity.gsub(/^/, ' ' * 4)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def convert_part(part)
|
|
40
|
+
part = part.strip
|
|
41
|
+
case part
|
|
42
|
+
when %r[\A/\*+ ?\n.*\n \*+/\z]m
|
|
43
|
+
part.gsub(/^../, '#').sub(/\/\z/, '')
|
|
44
|
+
when %r[\A/\* .+ \*/\z]m
|
|
45
|
+
part.gsub(/^/, '# ')
|
|
46
|
+
when %r[\A#ifndef None\n.+\n#endif\z]m
|
|
47
|
+
_, line = part.match(%r[\A#ifndef None\n(.+)\n#endif\z]m).to_a
|
|
48
|
+
convert_line(line)
|
|
49
|
+
when %r[\A#define[ \t]]
|
|
50
|
+
part = part.gsub(%r{/\*([^/]+)\*/}m) { '/*' + $1.gsub("\n", '').gsub("\t", '') + '*/' }
|
|
51
|
+
part.split("\n").map { |line| convert_line(line) }.join("\n")
|
|
52
|
+
when %r[\A/\*[^/]+\*/\n#define]
|
|
53
|
+
_, comment, rest = part.match(%r[\A(/\*[^/]+\*/)\n(#define.+)\z]m).to_a
|
|
54
|
+
"#{comment.gsub(/^/, '# ')}\n#{rest.split("\n").map {|l| convert_line(l)}.join("\n")}"
|
|
55
|
+
else
|
|
56
|
+
abort "Unprocessible entity:\n'#{part}'"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def convert_line(line)
|
|
61
|
+
case line
|
|
62
|
+
when %r{\A#define [^ ]+ +[^ \t]+\t/\* [^/]+ \*/\z}
|
|
63
|
+
_, const, spaces, value, comment = line.match(%r{\A#define ([^ ]+)( +)([^ \t]+)\t/\* ([^/]+) \*/\z}).to_a
|
|
64
|
+
"#{const}#{spaces}= #{convert_value(value)} # #{comment}"
|
|
65
|
+
when %r{\A#define [^ ]+\t+[^ ]+ *\z}
|
|
66
|
+
_, const, spaces, value = line.match(%r{\A#define ([^ ]+)(\t+)([^ ]+) *\z}).to_a
|
|
67
|
+
"#{const}#{spaces.gsub("\t", ' ')}= #{convert_value(value)}"
|
|
68
|
+
when %r{\A#define[\t ][^ \t]+[\t ]+[^\t ]+[\t ]+/\*[^/]+\*/\z}
|
|
69
|
+
_, const, spaces, value, comment = line.match(%r{\A#define[\t ]([^ \t]+)([\t ]+)([^\t ]+)[\t ]+/\*([^/]+)\*/\z}).to_a
|
|
70
|
+
"#{const}#{spaces.gsub("\t", ' ')}= #{convert_value(value)} # #{comment}"
|
|
71
|
+
when %r{\A[\t ]+\z}
|
|
72
|
+
"\n"
|
|
73
|
+
when %r{\A/\* .+ \*/\z}
|
|
74
|
+
_, comment = line.match(%r{\A/\* (.+) \*/\z}).to_a
|
|
75
|
+
"# #{comment}"
|
|
76
|
+
when %r{\A/\*\*.+\*\*/\z}
|
|
77
|
+
_, comment = line.match(%r{\A/\*(\*.+\*)\*/\z}).to_a
|
|
78
|
+
"# #{comment}"
|
|
79
|
+
when %r{\A#define [^ ]+( +)[^ ]+\z}
|
|
80
|
+
_, const, spaces, value = line.match(%r{\A#define ([^ ]+)( +)([^ ]+)\z}).to_a
|
|
81
|
+
"#{const}#{spaces}= #{convert_value(value)}"
|
|
82
|
+
else
|
|
83
|
+
abort "Unprocessible line:\n#{line.inspect}"
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def convert_value(value)
|
|
88
|
+
value.gsub('0L', '0').gsub('1L', '1').gsub('(int)', '')
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
ConstGenerator.new(parts).write
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'strscan'
|
|
5
|
+
require_relative 'typesym'
|
|
6
|
+
|
|
7
|
+
target = ARGV[0]
|
|
8
|
+
abort "'#{target}' does not exist" unless File.exist?(target)
|
|
9
|
+
|
|
10
|
+
source = File.read(target)
|
|
11
|
+
decls = source.scan(/extern [^\n]+ [^ ]+ ?\([^\(\)]+\);/m)
|
|
12
|
+
|
|
13
|
+
class FFIGenerator
|
|
14
|
+
BLOCKING_FUNCTIONS = %w[XSync XNextEvent]
|
|
15
|
+
|
|
16
|
+
def initialize(decls)
|
|
17
|
+
@decls = decls
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def print_ffi
|
|
21
|
+
@decls.each do |decl|
|
|
22
|
+
puts ffi_by_decl(decl)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def preprocess(decl)
|
|
29
|
+
decl.gsub(/#if NeedWidePrototypes\n[^\n]+\n#else\n([^\n]+)\n#endif\n/m, '\1' << "\n")
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def ffi_by_decl(decl)
|
|
33
|
+
if decl == 'extern Bool XSupportsLocale (void);'
|
|
34
|
+
return 'attach_function :XSupportsLocale, [], :bool'
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
definition, *params = preprocess(decl).split("\n")
|
|
38
|
+
params.delete_at(-1)
|
|
39
|
+
_, type, _, func = definition.match(/\Aextern ((unsigned )?[^ ]+ \**)([^ ]+) ?\(\z/).to_a
|
|
40
|
+
|
|
41
|
+
param_syms = params.map { |param| typesym(param_to_type(param))}
|
|
42
|
+
param_syms = [] if param_syms == [':void']
|
|
43
|
+
|
|
44
|
+
ffi = "attach_function :#{func}, [#{param_syms.join(', ')}], #{typesym(type.strip)}"
|
|
45
|
+
ffi.concat(', blocking: true') if BLOCKING_FUNCTIONS.include?(func)
|
|
46
|
+
ffi
|
|
47
|
+
rescue => e
|
|
48
|
+
puts
|
|
49
|
+
puts e.backtrace.join("\n")
|
|
50
|
+
abort "Failed to parse!:\n\n#{decl}\n\n#{e.message}"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def typesym(type)
|
|
54
|
+
Typesym.typesym(type)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def param_to_type(param)
|
|
58
|
+
s = StringScanner.new(param)
|
|
59
|
+
s.scan(/ +/)
|
|
60
|
+
s.scan_until(/(,|\/\*|\z)/).sub(/(,|\/\*)/, '').sub(/ ?_Xconst ?/, '').strip
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
FFIGenerator.new(decls).print_ffi
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'active_support'
|
|
5
|
+
require 'active_support/core_ext'
|
|
6
|
+
require_relative 'typesym'
|
|
7
|
+
|
|
8
|
+
target = ARGV[0]
|
|
9
|
+
abort "'#{target}' does not exist" unless File.exist?(target)
|
|
10
|
+
|
|
11
|
+
source = File.read(target)
|
|
12
|
+
structs = source.scan(/typedef struct {[^{}]+} [^ ]+;/m)
|
|
13
|
+
|
|
14
|
+
class FFIWriter
|
|
15
|
+
def initialize(structs)
|
|
16
|
+
@structs = structs
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def write_ffis
|
|
20
|
+
@structs.each do |struct|
|
|
21
|
+
write_ffi(struct)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def write_ffi(struct)
|
|
28
|
+
str = drop_comments(struct)
|
|
29
|
+
str = preprocess(str)
|
|
30
|
+
_, params, name = str.match(%r[typedef struct {([^{}]+)} ([^ ;]+);]m).to_a
|
|
31
|
+
|
|
32
|
+
result = source_prefix(name) + source_body(params) + source_suffix
|
|
33
|
+
File.write("lib/libx11/xlib/#{name.underscore}.rb", result)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def source_prefix(name)
|
|
37
|
+
<<~PREFIX
|
|
38
|
+
module LibX11
|
|
39
|
+
module Xlib
|
|
40
|
+
class #{name} < FFI::Struct
|
|
41
|
+
layout(
|
|
42
|
+
PREFIX
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def source_body(params)
|
|
46
|
+
params = params.gsub(%r[/\*[^/]+\*/]m, '')
|
|
47
|
+
lines = params.strip.split("\n").map(&:strip)
|
|
48
|
+
lines = expand_multiple_vars(lines).reject(&:empty?)
|
|
49
|
+
layouts = lines.map do |line|
|
|
50
|
+
line = line.gsub(/\t/, ' ')
|
|
51
|
+
if line =~ /\[\d+\]/
|
|
52
|
+
_, type, var, num = line.match(/\A([^ ]+) ([^\*\[]+)\[(\d+)\]/).to_a
|
|
53
|
+
[":#{var}", "[:#{type}, #{num}]"]
|
|
54
|
+
else
|
|
55
|
+
_, type, var = line.match(/\A(.+ \**)([^ *]+);/).to_a
|
|
56
|
+
[":#{var}", Typesym.typesym(type.strip)]
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
build_layout(layouts)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def source_suffix
|
|
63
|
+
<<~SUFFIX
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
SUFFIX
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def expand_multiple_vars(lines)
|
|
72
|
+
[].tap do |result|
|
|
73
|
+
lines.each do |line|
|
|
74
|
+
if line =~ /, /
|
|
75
|
+
first, *rest = line.split(', ')
|
|
76
|
+
_, type, var = first.match(/\A(.+ \**)([^ *]+)\z/).to_a
|
|
77
|
+
[var, *rest].each do |name|
|
|
78
|
+
result << "#{type}#{name.sub(/;\z/, '')};"
|
|
79
|
+
end
|
|
80
|
+
else
|
|
81
|
+
result << line
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def drop_comments(str)
|
|
88
|
+
str.gsub(%r[/\*[^/\*]+\*/], '')
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def build_layout(layouts)
|
|
92
|
+
max = layouts.map(&:first).map(&:length).max
|
|
93
|
+
layouts.map do |var, type|
|
|
94
|
+
"#{' ' * 8}#{var},#{' ' * (max - var.length)} #{type},"
|
|
95
|
+
end.join("\n").concat("\n")
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def preprocess(str)
|
|
99
|
+
str.gsub(/#if defined\(__cplusplus\) \|\| defined\(c_plusplus\)\n[^\n]+\n#else\n([^\n]+)\n#endif\n/m, '\1' << "\n")
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
FFIWriter.new(structs).write_ffis
|
data/bin/typesym.rb
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module Typesym
|
|
2
|
+
def self.typesym(type)
|
|
3
|
+
type = type.gsub(/ +\*\z/, '*').gsub(/ +\*\*\z/, '**')
|
|
4
|
+
case type
|
|
5
|
+
when 'Display*', 'XKeyEvent*', 'XEvent*', 'XMappingEvent*',
|
|
6
|
+
'XGenericEventCookie*', 'Depth*', 'XFontProp*'
|
|
7
|
+
type.sub(/ ?\*\z/, '').concat('.ptr')
|
|
8
|
+
when 'XFontStruct*', 'XTimeCoord*', 'XModifierKeymap*', 'Visual*', 'XImage*',
|
|
9
|
+
'XColor*', 'XGCValues*', 'XSetWindowAttributes*', 'XHostAddress*', 'Screen*',
|
|
10
|
+
'XExtCodes*', 'XExtData*', 'XPixmapFormatValues*', 'XWindowChanges*',
|
|
11
|
+
'XKeyboardControl*', 'XArc*', 'XChar2b*', 'XPoint*', 'XRectangle*', 'XSegment*',
|
|
12
|
+
'XTextItem*', 'XTextItem16*', 'XKeyboardState*', 'XWindowAttributes*',
|
|
13
|
+
'XCharStruct*', 'XOM', 'XOC', 'XFontSet', 'XFontSetExtents*',
|
|
14
|
+
'XmbTextItem*', 'XwcTextItem*', 'XIM', 'XIC', 'XKeyPressedEvent*', 'XOrientation*',
|
|
15
|
+
'XIMStyle*'
|
|
16
|
+
':pointer'
|
|
17
|
+
when 'XID', 'Window', 'Time', 'KeyCode', 'int', 'Status', 'Drawable', 'void', 'Atom',
|
|
18
|
+
'KeySym', 'Colormap', 'Pixmap', 'Cursor', 'Font', 'GC', 'GContext', 'long',
|
|
19
|
+
'VisualID', 'XPointer', 'XIDProc', 'XConnectionWatchProc', 'XErrorHandler',
|
|
20
|
+
'XIOErrorHandler', 'char', 'short', 'XOrientation', 'XIMProc', 'XICProc'
|
|
21
|
+
":#{type}"
|
|
22
|
+
when 'char*', 'const char*'
|
|
23
|
+
':string'
|
|
24
|
+
when 'int*', 'Atom*', 'char**', 'Colormap*', 'XFontStruct**', 'Bool*', 'KeySym*',
|
|
25
|
+
'char **', 'XExtData**', 'Atom**', 'char***', 'Window**', 'Window*', 'struct _XExtData**',
|
|
26
|
+
'unsigned long*', 'unsigned char*', 'void*', 'unsigned int*', 'unsigned char**', 'Pixmap*',
|
|
27
|
+
'struct _XrmHashBucketRec*', 'XFontStruct***', 'wchar_t*', 'Status*', 'int**', 'wchar_t', 'char [32]',
|
|
28
|
+
'KeyCode*'
|
|
29
|
+
':pointer'
|
|
30
|
+
when 'unsigned int'
|
|
31
|
+
':uint'
|
|
32
|
+
when 'unsigned long'
|
|
33
|
+
':ulong'
|
|
34
|
+
when 'unsigned short'
|
|
35
|
+
':ushort'
|
|
36
|
+
when 'Bool'
|
|
37
|
+
':bool'
|
|
38
|
+
when 'unsigned char', 'unsigned'
|
|
39
|
+
':uchar'
|
|
40
|
+
when 'XEDataObject'
|
|
41
|
+
'XEDataObject.by_value'
|
|
42
|
+
when 'struct _XDisplay*'
|
|
43
|
+
'Display.ptr'
|
|
44
|
+
when 'XRectangle', 'XCharStruct'
|
|
45
|
+
type
|
|
46
|
+
else
|
|
47
|
+
raise "Unprocessible type name: '#{type}'"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
data/example/window_manager.rb
CHANGED
|
@@ -10,17 +10,15 @@ class XServer
|
|
|
10
10
|
|
|
11
11
|
def self.bind_events(display, window, event_mask)
|
|
12
12
|
wm_detected = false
|
|
13
|
-
LibX11::Xlib.XSetErrorHandler(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
wm_detected = true
|
|
17
|
-
end
|
|
18
|
-
0
|
|
13
|
+
LibX11::Xlib.XSetErrorHandler -> (display, error) do
|
|
14
|
+
if error[:error_code] == LibX11::X::BadAccess
|
|
15
|
+
wm_detected = true
|
|
19
16
|
end
|
|
20
|
-
|
|
17
|
+
0
|
|
18
|
+
end
|
|
21
19
|
|
|
22
20
|
LibX11::Xlib.XSelectInput(display, window, event_mask)
|
|
23
|
-
LibX11::Xlib.XSync(display,
|
|
21
|
+
LibX11::Xlib.XSync(display, false)
|
|
24
22
|
|
|
25
23
|
if wm_detected
|
|
26
24
|
abort 'Another window manager detected!'
|
|
@@ -40,12 +38,10 @@ XServer.with_connection do |display|
|
|
|
40
38
|
LibX11::X::SubstructureNotifyMask,
|
|
41
39
|
)
|
|
42
40
|
|
|
43
|
-
LibX11::Xlib.XSetErrorHandler(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
)
|
|
41
|
+
LibX11::Xlib.XSetErrorHandler -> (display, error) do
|
|
42
|
+
$stderr.puts "Error detected: (error_code=#{error[:error_code]})"
|
|
43
|
+
0
|
|
44
|
+
end
|
|
49
45
|
|
|
50
46
|
loop do
|
|
51
47
|
event = LibX11::Xlib::XEvent.new
|
data/lib/libx11/version.rb
CHANGED
data/lib/libx11/x.rb
CHANGED
|
@@ -4,145 +4,586 @@ module LibX11
|
|
|
4
4
|
# RESERVED RESOURCE AND CONSTANT DEFINITIONS
|
|
5
5
|
#****************************************************************
|
|
6
6
|
|
|
7
|
-
None
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
None = 0 # universal null resource or null atom
|
|
8
|
+
|
|
9
|
+
ParentRelative = 1 # background pixmap in CreateWindow and ChangeWindowAttributes
|
|
10
|
+
|
|
11
|
+
CopyFromParent = 0 # border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window class passed to CreateWindow
|
|
12
|
+
|
|
13
|
+
PointerWindow = 0 # destination window in SendEvent
|
|
14
|
+
InputFocus = 1 # destination window in SendEvent
|
|
15
|
+
|
|
16
|
+
PointerRoot = 1 # focus window in SetInputFocus
|
|
17
|
+
|
|
18
|
+
AnyPropertyType = 0 # special Atom, passed to GetProperty
|
|
19
|
+
|
|
20
|
+
AnyKey = 0 # special Key Code, passed to GrabKey
|
|
21
|
+
|
|
22
|
+
AnyButton = 0 # special Button Code, passed to GrabButton
|
|
23
|
+
|
|
24
|
+
AllTemporary = 0 # special Resource ID passed to KillClient
|
|
25
|
+
|
|
26
|
+
CurrentTime = 0 # special Time
|
|
27
|
+
|
|
28
|
+
NoSymbol = 0 # special KeySym
|
|
29
|
+
|
|
30
|
+
#****************************************************************
|
|
22
31
|
# EVENT DEFINITIONS
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# Input Event Masks. Used as event-mask window attribute and as arguments
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
NoEventMask
|
|
29
|
-
KeyPressMask
|
|
30
|
-
KeyReleaseMask
|
|
31
|
-
ButtonPressMask
|
|
32
|
-
ButtonReleaseMask
|
|
33
|
-
EnterWindowMask
|
|
34
|
-
LeaveWindowMask
|
|
35
|
-
PointerMotionMask
|
|
36
|
-
PointerMotionHintMask
|
|
37
|
-
Button1MotionMask
|
|
38
|
-
Button2MotionMask
|
|
39
|
-
Button3MotionMask
|
|
40
|
-
Button4MotionMask
|
|
41
|
-
Button5MotionMask
|
|
42
|
-
ButtonMotionMask
|
|
43
|
-
KeymapStateMask
|
|
44
|
-
ExposureMask
|
|
45
|
-
VisibilityChangeMask
|
|
46
|
-
StructureNotifyMask
|
|
47
|
-
ResizeRedirectMask
|
|
48
|
-
SubstructureNotifyMask
|
|
49
|
-
SubstructureRedirectMask
|
|
50
|
-
FocusChangeMask
|
|
51
|
-
PropertyChangeMask
|
|
52
|
-
ColormapChangeMask
|
|
53
|
-
OwnerGrabButtonMask
|
|
54
|
-
|
|
55
|
-
# Event names. Used in "type" field in XEvent structures. Not to be
|
|
32
|
+
#****************************************************************
|
|
33
|
+
|
|
34
|
+
# /* Input Event Masks. Used as event-mask window attribute and as arguments
|
|
35
|
+
# to Grab requests. Not to be confused with event names. */
|
|
36
|
+
|
|
37
|
+
NoEventMask = 0
|
|
38
|
+
KeyPressMask = (1<<0)
|
|
39
|
+
KeyReleaseMask = (1<<1)
|
|
40
|
+
ButtonPressMask = (1<<2)
|
|
41
|
+
ButtonReleaseMask = (1<<3)
|
|
42
|
+
EnterWindowMask = (1<<4)
|
|
43
|
+
LeaveWindowMask = (1<<5)
|
|
44
|
+
PointerMotionMask = (1<<6)
|
|
45
|
+
PointerMotionHintMask = (1<<7)
|
|
46
|
+
Button1MotionMask = (1<<8)
|
|
47
|
+
Button2MotionMask = (1<<9)
|
|
48
|
+
Button3MotionMask = (1<<10)
|
|
49
|
+
Button4MotionMask = (1<<11)
|
|
50
|
+
Button5MotionMask = (1<<12)
|
|
51
|
+
ButtonMotionMask = (1<<13)
|
|
52
|
+
KeymapStateMask = (1<<14)
|
|
53
|
+
ExposureMask = (1<<15)
|
|
54
|
+
VisibilityChangeMask = (1<<16)
|
|
55
|
+
StructureNotifyMask = (1<<17)
|
|
56
|
+
ResizeRedirectMask = (1<<18)
|
|
57
|
+
SubstructureNotifyMask = (1<<19)
|
|
58
|
+
SubstructureRedirectMask = (1<<20)
|
|
59
|
+
FocusChangeMask = (1<<21)
|
|
60
|
+
PropertyChangeMask = (1<<22)
|
|
61
|
+
ColormapChangeMask = (1<<23)
|
|
62
|
+
OwnerGrabButtonMask = (1<<24)
|
|
63
|
+
|
|
64
|
+
# /* Event names. Used in "type" field in XEvent structures. Not to be
|
|
56
65
|
# confused with event masks above. They start from 2 because 0 and 1
|
|
57
|
-
# are reserved in the protocol for errors and replies.
|
|
58
|
-
|
|
59
|
-
KeyPress
|
|
60
|
-
KeyRelease
|
|
61
|
-
ButtonPress
|
|
62
|
-
ButtonRelease
|
|
63
|
-
MotionNotify
|
|
64
|
-
EnterNotify
|
|
65
|
-
LeaveNotify
|
|
66
|
-
FocusIn
|
|
67
|
-
FocusOut
|
|
68
|
-
KeymapNotify
|
|
69
|
-
Expose
|
|
70
|
-
GraphicsExpose
|
|
71
|
-
NoExpose
|
|
72
|
-
VisibilityNotify
|
|
73
|
-
CreateNotify
|
|
74
|
-
DestroyNotify
|
|
75
|
-
UnmapNotify
|
|
76
|
-
MapNotify
|
|
77
|
-
MapRequest
|
|
78
|
-
ReparentNotify
|
|
79
|
-
ConfigureNotify
|
|
80
|
-
ConfigureRequest
|
|
81
|
-
GravityNotify
|
|
82
|
-
ResizeRequest
|
|
83
|
-
CirculateNotify
|
|
84
|
-
CirculateRequest
|
|
85
|
-
PropertyNotify
|
|
86
|
-
SelectionClear
|
|
87
|
-
SelectionRequest
|
|
88
|
-
SelectionNotify
|
|
89
|
-
ColormapNotify
|
|
90
|
-
ClientMessage
|
|
91
|
-
MappingNotify
|
|
92
|
-
GenericEvent
|
|
93
|
-
LASTEvent = 36
|
|
94
|
-
|
|
95
|
-
# Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
-
ShiftMask
|
|
99
|
-
LockMask
|
|
100
|
-
ControlMask
|
|
101
|
-
Mod1Mask
|
|
102
|
-
Mod2Mask
|
|
103
|
-
Mod3Mask
|
|
104
|
-
Mod4Mask
|
|
105
|
-
Mod5Mask
|
|
106
|
-
|
|
107
|
-
#
|
|
108
|
-
#
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
66
|
+
# are reserved in the protocol for errors and replies. */
|
|
67
|
+
|
|
68
|
+
KeyPress = 2
|
|
69
|
+
KeyRelease = 3
|
|
70
|
+
ButtonPress = 4
|
|
71
|
+
ButtonRelease = 5
|
|
72
|
+
MotionNotify = 6
|
|
73
|
+
EnterNotify = 7
|
|
74
|
+
LeaveNotify = 8
|
|
75
|
+
FocusIn = 9
|
|
76
|
+
FocusOut = 10
|
|
77
|
+
KeymapNotify = 11
|
|
78
|
+
Expose = 12
|
|
79
|
+
GraphicsExpose = 13
|
|
80
|
+
NoExpose = 14
|
|
81
|
+
VisibilityNotify = 15
|
|
82
|
+
CreateNotify = 16
|
|
83
|
+
DestroyNotify = 17
|
|
84
|
+
UnmapNotify = 18
|
|
85
|
+
MapNotify = 19
|
|
86
|
+
MapRequest = 20
|
|
87
|
+
ReparentNotify = 21
|
|
88
|
+
ConfigureNotify = 22
|
|
89
|
+
ConfigureRequest = 23
|
|
90
|
+
GravityNotify = 24
|
|
91
|
+
ResizeRequest = 25
|
|
92
|
+
CirculateNotify = 26
|
|
93
|
+
CirculateRequest = 27
|
|
94
|
+
PropertyNotify = 28
|
|
95
|
+
SelectionClear = 29
|
|
96
|
+
SelectionRequest = 30
|
|
97
|
+
SelectionNotify = 31
|
|
98
|
+
ColormapNotify = 32
|
|
99
|
+
ClientMessage = 33
|
|
100
|
+
MappingNotify = 34
|
|
101
|
+
GenericEvent = 35
|
|
102
|
+
LASTEvent = 36 # must be bigger than any event #
|
|
103
|
+
|
|
104
|
+
# /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
|
|
105
|
+
# state in various key-, mouse-, and button-related events. */
|
|
106
|
+
|
|
107
|
+
ShiftMask = (1<<0)
|
|
108
|
+
LockMask = (1<<1)
|
|
109
|
+
ControlMask = (1<<2)
|
|
110
|
+
Mod1Mask = (1<<3)
|
|
111
|
+
Mod2Mask = (1<<4)
|
|
112
|
+
Mod3Mask = (1<<5)
|
|
113
|
+
Mod4Mask = (1<<6)
|
|
114
|
+
Mod5Mask = (1<<7)
|
|
115
|
+
|
|
116
|
+
# /* modifier names. Used to build a SetModifierMapping request or
|
|
117
|
+
# to read a GetModifierMapping request. These correspond to the
|
|
118
|
+
# masks defined above. */
|
|
119
|
+
ShiftMapIndex = 0
|
|
120
|
+
LockMapIndex = 1
|
|
121
|
+
ControlMapIndex = 2
|
|
122
|
+
Mod1MapIndex = 3
|
|
123
|
+
Mod2MapIndex = 4
|
|
124
|
+
Mod3MapIndex = 5
|
|
125
|
+
Mod4MapIndex = 6
|
|
126
|
+
Mod5MapIndex = 7
|
|
127
|
+
|
|
128
|
+
# /* button masks. Used in same manner as Key masks above. Not to be confused
|
|
129
|
+
# with button names below. */
|
|
130
|
+
|
|
131
|
+
Button1Mask = (1<<8)
|
|
132
|
+
Button2Mask = (1<<9)
|
|
133
|
+
Button3Mask = (1<<10)
|
|
134
|
+
Button4Mask = (1<<11)
|
|
135
|
+
Button5Mask = (1<<12)
|
|
136
|
+
|
|
137
|
+
AnyModifier = (1<<15) # used in GrabButton, GrabKey
|
|
138
|
+
|
|
139
|
+
# /* button names. Used as arguments to GrabButton and as detail in ButtonPress
|
|
140
|
+
# and ButtonRelease events. Not to be confused with button masks above.
|
|
141
|
+
# Note that 0 is already defined above as "AnyButton". */
|
|
142
|
+
|
|
143
|
+
Button1 = 1
|
|
144
|
+
Button2 = 2
|
|
145
|
+
Button3 = 3
|
|
146
|
+
Button4 = 4
|
|
147
|
+
Button5 = 5
|
|
148
|
+
|
|
149
|
+
# /* Notify modes */
|
|
150
|
+
|
|
151
|
+
NotifyNormal = 0
|
|
152
|
+
NotifyGrab = 1
|
|
153
|
+
NotifyUngrab = 2
|
|
154
|
+
NotifyWhileGrabbed = 3
|
|
155
|
+
|
|
156
|
+
NotifyHint = 1 # for MotionNotify events
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
# Notify detail
|
|
160
|
+
|
|
161
|
+
NotifyAncestor = 0
|
|
162
|
+
NotifyVirtual = 1
|
|
163
|
+
NotifyInferior = 2
|
|
164
|
+
NotifyNonlinear = 3
|
|
165
|
+
NotifyNonlinearVirtual = 4
|
|
166
|
+
NotifyPointer = 5
|
|
167
|
+
NotifyPointerRoot = 6
|
|
168
|
+
NotifyDetailNone = 7
|
|
169
|
+
|
|
170
|
+
# /* Visibility notify */
|
|
171
|
+
|
|
172
|
+
VisibilityUnobscured = 0
|
|
173
|
+
VisibilityPartiallyObscured = 1
|
|
174
|
+
VisibilityFullyObscured = 2
|
|
175
|
+
|
|
176
|
+
# /* Circulation request */
|
|
177
|
+
|
|
178
|
+
PlaceOnTop = 0
|
|
179
|
+
PlaceOnBottom = 1
|
|
180
|
+
|
|
181
|
+
# /* protocol families */
|
|
182
|
+
|
|
183
|
+
FamilyInternet = 0 # IPv4
|
|
184
|
+
FamilyDECnet = 1
|
|
185
|
+
FamilyChaos = 2
|
|
186
|
+
FamilyInternet6 = 6 # IPv6
|
|
187
|
+
|
|
188
|
+
# /* authentication families not tied to a specific protocol */
|
|
189
|
+
FamilyServerInterpreted = 5
|
|
190
|
+
|
|
191
|
+
# /* Property notification */
|
|
192
|
+
|
|
193
|
+
PropertyNewValue = 0
|
|
194
|
+
PropertyDelete = 1
|
|
195
|
+
|
|
196
|
+
# /* Color Map notification */
|
|
197
|
+
|
|
198
|
+
ColormapUninstalled = 0
|
|
199
|
+
ColormapInstalled = 1
|
|
200
|
+
|
|
201
|
+
# /* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
|
|
202
|
+
|
|
203
|
+
GrabModeSync = 0
|
|
204
|
+
GrabModeAsync = 1
|
|
205
|
+
|
|
206
|
+
# /* GrabPointer, GrabKeyboard reply status */
|
|
207
|
+
|
|
208
|
+
GrabSuccess = 0
|
|
209
|
+
AlreadyGrabbed = 1
|
|
210
|
+
GrabInvalidTime = 2
|
|
211
|
+
GrabNotViewable = 3
|
|
212
|
+
GrabFrozen = 4
|
|
213
|
+
|
|
214
|
+
# /* AllowEvents modes */
|
|
215
|
+
|
|
216
|
+
AsyncPointer = 0
|
|
217
|
+
SyncPointer = 1
|
|
218
|
+
ReplayPointer = 2
|
|
219
|
+
AsyncKeyboard = 3
|
|
220
|
+
SyncKeyboard = 4
|
|
221
|
+
ReplayKeyboard = 5
|
|
222
|
+
AsyncBoth = 6
|
|
223
|
+
SyncBoth = 7
|
|
224
|
+
|
|
225
|
+
# /* Used in SetInputFocus, GetInputFocus */
|
|
226
|
+
|
|
227
|
+
RevertToNone = None
|
|
228
|
+
RevertToPointerRoot = PointerRoot
|
|
229
|
+
RevertToParent = 2
|
|
121
230
|
|
|
122
231
|
#****************************************************************
|
|
123
232
|
# ERROR CODES
|
|
124
233
|
#****************************************************************
|
|
125
234
|
|
|
126
|
-
Success
|
|
127
|
-
BadRequest
|
|
128
|
-
BadValue
|
|
129
|
-
BadWindow
|
|
130
|
-
BadPixmap
|
|
131
|
-
BadAtom
|
|
132
|
-
BadCursor
|
|
133
|
-
BadFont
|
|
134
|
-
BadMatch
|
|
135
|
-
BadDrawable
|
|
136
|
-
BadAccess
|
|
137
|
-
BadAlloc
|
|
138
|
-
BadColor
|
|
139
|
-
BadGC
|
|
140
|
-
BadIDChoice
|
|
141
|
-
BadName
|
|
142
|
-
BadLength
|
|
143
|
-
BadImplementation = 17
|
|
144
|
-
|
|
145
|
-
FirstExtensionError
|
|
235
|
+
Success = 0 # everything's okay
|
|
236
|
+
BadRequest = 1 # bad request code
|
|
237
|
+
BadValue = 2 # int parameter out of range
|
|
238
|
+
BadWindow = 3 # parameter not a Window
|
|
239
|
+
BadPixmap = 4 # parameter not a Pixmap
|
|
240
|
+
BadAtom = 5 # parameter not an Atom
|
|
241
|
+
BadCursor = 6 # parameter not a Cursor
|
|
242
|
+
BadFont = 7 # parameter not a Font
|
|
243
|
+
BadMatch = 8 # parameter mismatch
|
|
244
|
+
BadDrawable = 9 # parameter not a Pixmap or Window
|
|
245
|
+
BadAccess = 10 # depending on context: - key button already grabbed - attempt to free an illegal cmap entry - attempt to store into a read-only color map entry. - attempt to modify the access control list from other than the local host.
|
|
246
|
+
BadAlloc = 11 # insufficient resources
|
|
247
|
+
BadColor = 12 # no such colormap
|
|
248
|
+
BadGC = 13 # parameter not a GC
|
|
249
|
+
BadIDChoice = 14 # choice not in range or already used
|
|
250
|
+
BadName = 15 # font or color name doesn't exist
|
|
251
|
+
BadLength = 16 # Request length incorrect
|
|
252
|
+
BadImplementation = 17 # server is defective
|
|
253
|
+
|
|
254
|
+
FirstExtensionError = 128
|
|
146
255
|
LastExtensionError = 255
|
|
256
|
+
|
|
257
|
+
#****************************************************************
|
|
258
|
+
# WINDOW DEFINITIONS
|
|
259
|
+
#****************************************************************
|
|
260
|
+
|
|
261
|
+
# /* Window classes used by CreateWindow */
|
|
262
|
+
# /* Note that CopyFromParent is already defined as 0 above */
|
|
263
|
+
|
|
264
|
+
InputOutput = 1
|
|
265
|
+
InputOnly = 2
|
|
266
|
+
|
|
267
|
+
# /* Window attributes for CreateWindow and ChangeWindowAttributes */
|
|
268
|
+
|
|
269
|
+
CWBackPixmap = (1<<0)
|
|
270
|
+
CWBackPixel = (1<<1)
|
|
271
|
+
CWBorderPixmap = (1<<2)
|
|
272
|
+
CWBorderPixel = (1<<3)
|
|
273
|
+
CWBitGravity = (1<<4)
|
|
274
|
+
CWWinGravity = (1<<5)
|
|
275
|
+
CWBackingStore = (1<<6)
|
|
276
|
+
CWBackingPlanes = (1<<7)
|
|
277
|
+
CWBackingPixel = (1<<8)
|
|
278
|
+
CWOverrideRedirect = (1<<9)
|
|
279
|
+
CWSaveUnder = (1<<10)
|
|
280
|
+
CWEventMask = (1<<11)
|
|
281
|
+
CWDontPropagate = (1<<12)
|
|
282
|
+
CWColormap = (1<<13)
|
|
283
|
+
CWCursor = (1<<14)
|
|
284
|
+
|
|
285
|
+
# /* ConfigureWindow structure */
|
|
286
|
+
|
|
287
|
+
CWX = (1<<0)
|
|
288
|
+
CWY = (1<<1)
|
|
289
|
+
CWWidth = (1<<2)
|
|
290
|
+
CWHeight = (1<<3)
|
|
291
|
+
CWBorderWidth = (1<<4)
|
|
292
|
+
CWSibling = (1<<5)
|
|
293
|
+
CWStackMode = (1<<6)
|
|
294
|
+
|
|
295
|
+
# /* Bit Gravity */
|
|
296
|
+
|
|
297
|
+
ForgetGravity = 0
|
|
298
|
+
NorthWestGravity = 1
|
|
299
|
+
NorthGravity = 2
|
|
300
|
+
NorthEastGravity = 3
|
|
301
|
+
WestGravity = 4
|
|
302
|
+
CenterGravity = 5
|
|
303
|
+
EastGravity = 6
|
|
304
|
+
SouthWestGravity = 7
|
|
305
|
+
SouthGravity = 8
|
|
306
|
+
SouthEastGravity = 9
|
|
307
|
+
StaticGravity = 10
|
|
308
|
+
|
|
309
|
+
# /* Window gravity + bit gravity above */
|
|
310
|
+
|
|
311
|
+
UnmapGravity = 0
|
|
312
|
+
|
|
313
|
+
# /* Used in CreateWindow for backing-store hint */
|
|
314
|
+
|
|
315
|
+
NotUseful = 0
|
|
316
|
+
WhenMapped = 1
|
|
317
|
+
Always = 2
|
|
318
|
+
|
|
319
|
+
# /* Used in GetWindowAttributes reply */
|
|
320
|
+
|
|
321
|
+
IsUnmapped = 0
|
|
322
|
+
IsUnviewable = 1
|
|
323
|
+
IsViewable = 2
|
|
324
|
+
|
|
325
|
+
# /* Used in ChangeSaveSet */
|
|
326
|
+
|
|
327
|
+
SetModeInsert = 0
|
|
328
|
+
SetModeDelete = 1
|
|
329
|
+
|
|
330
|
+
# /* Used in ChangeCloseDownMode */
|
|
331
|
+
|
|
332
|
+
DestroyAll = 0
|
|
333
|
+
RetainPermanent = 1
|
|
334
|
+
RetainTemporary = 2
|
|
335
|
+
|
|
336
|
+
# /* Window stacking method (in configureWindow) */
|
|
337
|
+
|
|
338
|
+
Above = 0
|
|
339
|
+
Below = 1
|
|
340
|
+
TopIf = 2
|
|
341
|
+
BottomIf = 3
|
|
342
|
+
Opposite = 4
|
|
343
|
+
|
|
344
|
+
# /* Circulation direction */
|
|
345
|
+
|
|
346
|
+
RaiseLowest = 0
|
|
347
|
+
LowerHighest = 1
|
|
348
|
+
|
|
349
|
+
# /* Property modes */
|
|
350
|
+
|
|
351
|
+
PropModeReplace = 0
|
|
352
|
+
PropModePrepend = 1
|
|
353
|
+
PropModeAppend = 2
|
|
354
|
+
|
|
355
|
+
#****************************************************************
|
|
356
|
+
# GRAPHICS DEFINITIONS
|
|
357
|
+
#****************************************************************
|
|
358
|
+
|
|
359
|
+
# /* graphics functions, as in GC.alu */
|
|
360
|
+
|
|
361
|
+
GXclear = 0x0 # 0
|
|
362
|
+
GXand = 0x1 # src AND dst
|
|
363
|
+
GXandReverse = 0x2 # src AND NOT dst
|
|
364
|
+
GXcopy = 0x3 # src
|
|
365
|
+
GXandInverted = 0x4 # NOT src AND dst
|
|
366
|
+
GXnoop = 0x5 # dst
|
|
367
|
+
GXxor = 0x6 # src XOR dst
|
|
368
|
+
GXor = 0x7 # src OR dst
|
|
369
|
+
GXnor = 0x8 # NOT src AND NOT dst
|
|
370
|
+
GXequiv = 0x9 # NOT src XOR dst
|
|
371
|
+
GXinvert = 0xa # NOT dst
|
|
372
|
+
GXorReverse = 0xb # src OR NOT dst
|
|
373
|
+
GXcopyInverted = 0xc # NOT src
|
|
374
|
+
GXorInverted = 0xd # NOT src OR dst
|
|
375
|
+
GXnand = 0xe # NOT src OR NOT dst
|
|
376
|
+
GXset = 0xf # 1
|
|
377
|
+
|
|
378
|
+
# /* LineStyle */
|
|
379
|
+
|
|
380
|
+
LineSolid = 0
|
|
381
|
+
LineOnOffDash = 1
|
|
382
|
+
LineDoubleDash = 2
|
|
383
|
+
|
|
384
|
+
# /* capStyle */
|
|
385
|
+
|
|
386
|
+
CapNotLast = 0
|
|
387
|
+
CapButt = 1
|
|
388
|
+
CapRound = 2
|
|
389
|
+
CapProjecting = 3
|
|
390
|
+
|
|
391
|
+
# /* joinStyle */
|
|
392
|
+
|
|
393
|
+
JoinMiter = 0
|
|
394
|
+
JoinRound = 1
|
|
395
|
+
JoinBevel = 2
|
|
396
|
+
|
|
397
|
+
# /* fillStyle */
|
|
398
|
+
|
|
399
|
+
FillSolid = 0
|
|
400
|
+
FillTiled = 1
|
|
401
|
+
FillStippled = 2
|
|
402
|
+
FillOpaqueStippled = 3
|
|
403
|
+
|
|
404
|
+
# /* fillRule */
|
|
405
|
+
|
|
406
|
+
EvenOddRule = 0
|
|
407
|
+
WindingRule = 1
|
|
408
|
+
|
|
409
|
+
# /* subwindow mode */
|
|
410
|
+
|
|
411
|
+
ClipByChildren = 0
|
|
412
|
+
IncludeInferiors = 1
|
|
413
|
+
|
|
414
|
+
# /* SetClipRectangles ordering */
|
|
415
|
+
|
|
416
|
+
Unsorted = 0
|
|
417
|
+
YSorted = 1
|
|
418
|
+
YXSorted = 2
|
|
419
|
+
YXBanded = 3
|
|
420
|
+
|
|
421
|
+
# /* CoordinateMode for drawing routines */
|
|
422
|
+
|
|
423
|
+
CoordModeOrigin = 0 # relative to the origin
|
|
424
|
+
CoordModePrevious = 1 # relative to previous point
|
|
425
|
+
|
|
426
|
+
# /* Polygon shapes */
|
|
427
|
+
|
|
428
|
+
Complex = 0 # paths may intersect
|
|
429
|
+
Nonconvex = 1 # no paths intersect, but not convex
|
|
430
|
+
Convex = 2 # wholly convex
|
|
431
|
+
|
|
432
|
+
# /* Arc modes for PolyFillArc */
|
|
433
|
+
|
|
434
|
+
ArcChord = 0 # join endpoints of arc
|
|
435
|
+
ArcPieSlice = 1 # join endpoints to center of arc
|
|
436
|
+
|
|
437
|
+
# /* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
|
|
438
|
+
# GC.stateChanges */
|
|
439
|
+
|
|
440
|
+
GCFunction = (1<<0)
|
|
441
|
+
GCPlaneMask = (1<<1)
|
|
442
|
+
GCForeground = (1<<2)
|
|
443
|
+
GCBackground = (1<<3)
|
|
444
|
+
GCLineWidth = (1<<4)
|
|
445
|
+
GCLineStyle = (1<<5)
|
|
446
|
+
GCCapStyle = (1<<6)
|
|
447
|
+
GCJoinStyle = (1<<7)
|
|
448
|
+
GCFillStyle = (1<<8)
|
|
449
|
+
GCFillRule = (1<<9)
|
|
450
|
+
GCTile = (1<<10)
|
|
451
|
+
GCStipple = (1<<11)
|
|
452
|
+
GCTileStipXOrigin = (1<<12)
|
|
453
|
+
GCTileStipYOrigin = (1<<13)
|
|
454
|
+
GCFont = (1<<14)
|
|
455
|
+
GCSubwindowMode = (1<<15)
|
|
456
|
+
GCGraphicsExposures = (1<<16)
|
|
457
|
+
GCClipXOrigin = (1<<17)
|
|
458
|
+
GCClipYOrigin = (1<<18)
|
|
459
|
+
GCClipMask = (1<<19)
|
|
460
|
+
GCDashOffset = (1<<20)
|
|
461
|
+
GCDashList = (1<<21)
|
|
462
|
+
GCArcMode = (1<<22)
|
|
463
|
+
|
|
464
|
+
GCLastBit = 22
|
|
465
|
+
# **************************************************************** * FONTS ****************************************************************
|
|
466
|
+
|
|
467
|
+
# /* used in QueryFont -- draw direction */
|
|
468
|
+
|
|
469
|
+
FontLeftToRight = 0
|
|
470
|
+
FontRightToLeft = 1
|
|
471
|
+
|
|
472
|
+
FontChange = 255
|
|
473
|
+
|
|
474
|
+
#****************************************************************
|
|
475
|
+
# IMAGING
|
|
476
|
+
#****************************************************************
|
|
477
|
+
|
|
478
|
+
# /* ImageFormat -- PutImage, GetImage */
|
|
479
|
+
|
|
480
|
+
XYBitmap = 0 # depth 1, XYFormat
|
|
481
|
+
XYPixmap = 1 # depth == drawable depth
|
|
482
|
+
ZPixmap = 2 # depth == drawable depth
|
|
483
|
+
|
|
484
|
+
#****************************************************************
|
|
485
|
+
# COLOR MAP STUFF
|
|
486
|
+
#****************************************************************
|
|
487
|
+
|
|
488
|
+
# /* For CreateColormap */
|
|
489
|
+
|
|
490
|
+
AllocNone = 0 # create map with no entries
|
|
491
|
+
AllocAll = 1 # allocate entire map writeable
|
|
492
|
+
|
|
493
|
+
# /* Flags used in StoreNamedColor, StoreColors */
|
|
494
|
+
|
|
495
|
+
DoRed = (1<<0)
|
|
496
|
+
DoGreen = (1<<1)
|
|
497
|
+
DoBlue = (1<<2)
|
|
498
|
+
|
|
499
|
+
#****************************************************************
|
|
500
|
+
# CURSOR STUFF
|
|
501
|
+
#****************************************************************
|
|
502
|
+
|
|
503
|
+
# /* QueryBestSize Class */
|
|
504
|
+
|
|
505
|
+
CursorShape = 0 # largest size that can be displayed
|
|
506
|
+
TileShape = 1 # size tiled fastest
|
|
507
|
+
StippleShape = 2 # size stippled fastest
|
|
508
|
+
|
|
509
|
+
#****************************************************************
|
|
510
|
+
# KEYBOARD/POINTER STUFF
|
|
511
|
+
#****************************************************************
|
|
512
|
+
|
|
513
|
+
AutoRepeatModeOff = 0
|
|
514
|
+
AutoRepeatModeOn = 1
|
|
515
|
+
AutoRepeatModeDefault = 2
|
|
516
|
+
|
|
517
|
+
LedModeOff = 0
|
|
518
|
+
LedModeOn = 1
|
|
519
|
+
|
|
520
|
+
# /* masks for ChangeKeyboardControl */
|
|
521
|
+
|
|
522
|
+
KBKeyClickPercent = (1<<0)
|
|
523
|
+
KBBellPercent = (1<<1)
|
|
524
|
+
KBBellPitch = (1<<2)
|
|
525
|
+
KBBellDuration = (1<<3)
|
|
526
|
+
KBLed = (1<<4)
|
|
527
|
+
KBLedMode = (1<<5)
|
|
528
|
+
KBKey = (1<<6)
|
|
529
|
+
KBAutoRepeatMode = (1<<7)
|
|
530
|
+
|
|
531
|
+
MappingSuccess = 0
|
|
532
|
+
MappingBusy = 1
|
|
533
|
+
MappingFailed = 2
|
|
534
|
+
|
|
535
|
+
MappingModifier = 0
|
|
536
|
+
MappingKeyboard = 1
|
|
537
|
+
MappingPointer = 2
|
|
538
|
+
|
|
539
|
+
#****************************************************************
|
|
540
|
+
# SCREEN SAVER STUFF
|
|
541
|
+
#****************************************************************
|
|
542
|
+
|
|
543
|
+
DontPreferBlanking = 0
|
|
544
|
+
PreferBlanking = 1
|
|
545
|
+
DefaultBlanking = 2
|
|
546
|
+
|
|
547
|
+
DisableScreenSaver = 0
|
|
548
|
+
DisableScreenInterval = 0
|
|
549
|
+
|
|
550
|
+
DontAllowExposures = 0
|
|
551
|
+
AllowExposures = 1
|
|
552
|
+
DefaultExposures = 2
|
|
553
|
+
|
|
554
|
+
# /* for ForceScreenSaver */
|
|
555
|
+
|
|
556
|
+
ScreenSaverReset = 0
|
|
557
|
+
ScreenSaverActive = 1
|
|
558
|
+
|
|
559
|
+
#****************************************************************
|
|
560
|
+
# HOSTS AND CONNECTIONS
|
|
561
|
+
#****************************************************************
|
|
562
|
+
|
|
563
|
+
# /* for ChangeHosts */
|
|
564
|
+
|
|
565
|
+
HostInsert = 0
|
|
566
|
+
HostDelete = 1
|
|
567
|
+
|
|
568
|
+
# /* for ChangeAccessControl */
|
|
569
|
+
|
|
570
|
+
EnableAccess = 1
|
|
571
|
+
DisableAccess = 0
|
|
572
|
+
|
|
573
|
+
# /* Display classes used in opening the connection
|
|
574
|
+
# * Note that the statically allocated ones are even numbered and the
|
|
575
|
+
# * dynamically changeable ones are odd numbered */
|
|
576
|
+
|
|
577
|
+
StaticGray = 0
|
|
578
|
+
GrayScale = 1
|
|
579
|
+
StaticColor = 2
|
|
580
|
+
PseudoColor = 3
|
|
581
|
+
TrueColor = 4
|
|
582
|
+
DirectColor = 5
|
|
583
|
+
|
|
584
|
+
# /* Byte order used in imageByteOrder and bitmapBitOrder */
|
|
585
|
+
|
|
586
|
+
LSBFirst = 0
|
|
587
|
+
MSBFirst = 1
|
|
147
588
|
end
|
|
148
589
|
end
|