libxkbcommon 1.0.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.
@@ -0,0 +1,9 @@
1
+ XKB_MOD_NAME_SHIFT = "Shift"
2
+ XKB_MOD_NAME_CAPS = "Lock"
3
+ XKB_MOD_NAME_CTRL = "Control"
4
+ XKB_MOD_NAME_ALT = "Mod1"
5
+ XKB_MOD_NAME_NUM = "Mod2"
6
+ XKB_MOD_NAME_LOGO = "Mod4"
7
+ XKB_LED_NAME_CAPS = "Caps Lock"
8
+ XKB_LED_NAME_NUM = "Num Lock"
9
+ XKB_LED_NAME_SCROLL = "Scroll Lock"
@@ -0,0 +1,8 @@
1
+ XKB_X11_MIN_MAJOR_XKB_VERSION = 1
2
+ XKB_X11_MIN_MINOR_XKB_VERSION = 0
3
+ XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS = 0
4
+
5
+ attach_function :xkb_x11_setup_xkb_extension, [ :pointer, :ushort, :ushort, :int, :pointer, :pointer, :pointer, :pointer ], :int
6
+ attach_function :xkb_x11_get_core_keyboard_device_id, [ :pointer ], :int
7
+ attach_function :xkb_x11_keymap_new_from_device, [ :pointer, :pointer, :int, :int ], :pointer
8
+ attach_function :xkb_x11_state_new_from_device, [ :pointer, :pointer, :int ], :pointer
@@ -0,0 +1,154 @@
1
+ XKB_KEYCODE_INVALID = (0xffffffff)
2
+ XKB_LAYOUT_INVALID = (0xffffffff)
3
+ XKB_LEVEL_INVALID = (0xffffffff)
4
+ XKB_MOD_INVALID = (0xffffffff)
5
+ XKB_LED_INVALID = (0xffffffff)
6
+ XKB_KEYCODE_MAX = (0xffffffff-1)
7
+ class XkbRuleNames < FFI::Struct
8
+ layout(
9
+ :rules, :pointer,
10
+ :model, :pointer,
11
+ :layout, :pointer,
12
+ :variant, :pointer,
13
+ :options, :pointer
14
+ )
15
+ def rules=(str)
16
+ @rules = FFI::MemoryPointer.from_string(str)
17
+ self[:rules] = @rules
18
+ end
19
+ def rules
20
+ @rules.get_string(0)
21
+ end
22
+ def model=(str)
23
+ @model = FFI::MemoryPointer.from_string(str)
24
+ self[:model] = @model
25
+ end
26
+ def model
27
+ @model.get_string(0)
28
+ end
29
+ def layout=(str)
30
+ @layout = FFI::MemoryPointer.from_string(str)
31
+ self[:layout] = @layout
32
+ end
33
+ def layout
34
+ @layout.get_string(0)
35
+ end
36
+ def variant=(str)
37
+ @variant = FFI::MemoryPointer.from_string(str)
38
+ self[:variant] = @variant
39
+ end
40
+ def variant
41
+ @variant.get_string(0)
42
+ end
43
+ def options=(str)
44
+ @options = FFI::MemoryPointer.from_string(str)
45
+ self[:options] = @options
46
+ end
47
+ def options
48
+ @options.get_string(0)
49
+ end
50
+
51
+ end
52
+ attach_function :xkb_keysym_get_name, [ :uint, :pointer, :uint ], :int
53
+ XKB_KEYSYM_CASE_INSENSITIVE = (1 << 0)
54
+ XKB_KEYSYM_NO_FLAGS = 0
55
+
56
+ attach_function :xkb_keysym_from_name, [ :string, :int ], :uint
57
+ attach_function :xkb_keysym_to_utf8, [ :uint, :pointer, :uint ], :int
58
+ attach_function :xkb_keysym_to_utf32, [ :uint ], :uint
59
+ XKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0)
60
+ XKB_CONTEXT_NO_ENVIRONMENT_NAMES = (1 << 1)
61
+ XKB_CONTEXT_NO_FLAGS = 0
62
+
63
+ attach_function :xkb_context_new, [ :int ], :pointer
64
+ attach_function :xkb_context_ref, [ :pointer ], :pointer
65
+ attach_function :xkb_context_unref, [ :pointer ], :void
66
+ attach_function :xkb_context_set_user_data, [ :pointer, :pointer ], :void
67
+ attach_function :xkb_context_get_user_data, [ :pointer ], :pointer
68
+ attach_function :xkb_context_include_path_append, [ :pointer, :string ], :int
69
+ attach_function :xkb_context_include_path_append_default, [ :pointer ], :int
70
+ attach_function :xkb_context_include_path_reset_defaults, [ :pointer ], :int
71
+ attach_function :xkb_context_include_path_clear, [ :pointer ], :void
72
+ attach_function :xkb_context_num_include_paths, [ :pointer ], :uint
73
+ attach_function :xkb_context_include_path_get, [ :pointer, :uint ], :string
74
+ XKB_LOG_LEVEL_CRITICAL = 10
75
+ XKB_LOG_LEVEL_ERROR = 20
76
+ XKB_LOG_LEVEL_WARNING = 30
77
+ XKB_LOG_LEVEL_INFO = 40
78
+ XKB_LOG_LEVEL_DEBUG = 50
79
+
80
+ attach_function :xkb_context_set_log_level, [ :pointer, :int ], :void
81
+ attach_function :xkb_context_get_log_level, [ :pointer ], :int
82
+ attach_function :xkb_context_set_log_verbosity, [ :pointer, :int ], :void
83
+ attach_function :xkb_context_get_log_verbosity, [ :pointer ], :int
84
+ attach_function :xkb_context_set_log_fn, [ :pointer, callback([ :pointer, :int, :string, :pointer ], :void) ], :void
85
+ XKB_KEYMAP_COMPILE_NO_FLAGS = 0
86
+
87
+ attach_function :xkb_keymap_new_from_names, [ :pointer, :pointer, :int ], :pointer
88
+ XKB_KEYMAP_FORMAT_TEXT_V1 = 1
89
+
90
+ attach_function :xkb_keymap_new_from_file, [ :pointer, :pointer, :int, :int ], :pointer
91
+ attach_function :xkb_keymap_new_from_string, [ :pointer, :string, :int, :int ], :pointer
92
+ attach_function :xkb_keymap_new_from_buffer, [ :pointer, :string, :uint, :int, :int ], :pointer
93
+ attach_function :xkb_keymap_ref, [ :pointer ], :pointer
94
+ attach_function :xkb_keymap_unref, [ :pointer ], :void
95
+ attach_function :xkb_keymap_get_as_string, [ :pointer, :int ], :string
96
+ attach_function :xkb_keymap_min_keycode, [ :pointer ], :uint
97
+ attach_function :xkb_keymap_max_keycode, [ :pointer ], :uint
98
+ callback(:xkb_keymap_key_iter_t, [ :pointer, :uint, :pointer ], :void)
99
+ attach_function :xkb_keymap_key_for_each, [ :pointer, :xkb_keymap_key_iter_t, :pointer ], :void
100
+ attach_function :xkb_keymap_num_mods, [ :pointer ], :uint
101
+ attach_function :xkb_keymap_mod_get_name, [ :pointer, :uint ], :string
102
+ attach_function :xkb_keymap_mod_get_index, [ :pointer, :string ], :uint
103
+ attach_function :xkb_keymap_num_layouts, [ :pointer ], :uint
104
+ attach_function :xkb_keymap_layout_get_name, [ :pointer, :uint ], :string
105
+ attach_function :xkb_keymap_layout_get_index, [ :pointer, :string ], :uint
106
+ attach_function :xkb_keymap_num_leds, [ :pointer ], :uint
107
+ attach_function :xkb_keymap_led_get_name, [ :pointer, :uint ], :string
108
+ attach_function :xkb_keymap_led_get_index, [ :pointer, :string ], :uint
109
+ attach_function :xkb_keymap_num_layouts_for_key, [ :pointer, :uint ], :uint
110
+ attach_function :xkb_keymap_num_levels_for_key, [ :pointer, :uint, :uint ], :uint
111
+ attach_function :xkb_keymap_key_get_syms_by_level, [ :pointer, :uint, :uint, :uint, :pointer ], :int
112
+ attach_function :xkb_keymap_key_repeats, [ :pointer, :uint ], :int
113
+ attach_function :xkb_state_new, [ :pointer ], :pointer
114
+ attach_function :xkb_state_ref, [ :pointer ], :pointer
115
+ attach_function :xkb_state_unref, [ :pointer ], :void
116
+ attach_function :xkb_state_get_keymap, [ :pointer ], :pointer
117
+ XKB_KEY_UP = 0
118
+ XKB_KEY_DOWN = 1
119
+
120
+ XKB_STATE_MODS_DEPRESSED = (1 << 0)
121
+ XKB_STATE_MODS_LATCHED = (1 << 1)
122
+ XKB_STATE_MODS_LOCKED = (1 << 2)
123
+ XKB_STATE_MODS_EFFECTIVE = (1 << 3)
124
+ XKB_STATE_LAYOUT_DEPRESSED = (1 << 4)
125
+ XKB_STATE_LAYOUT_LATCHED = (1 << 5)
126
+ XKB_STATE_LAYOUT_LOCKED = (1 << 6)
127
+ XKB_STATE_LAYOUT_EFFECTIVE = (1 << 7)
128
+ XKB_STATE_LEDS = (1 << 8)
129
+
130
+ attach_function :xkb_state_update_key, [ :pointer, :uint, :int ], :int
131
+ attach_function :xkb_state_update_mask, [ :pointer, :uint, :uint, :uint, :uint, :uint, :uint ], :int
132
+ attach_function :xkb_state_key_get_syms, [ :pointer, :uint, :pointer ], :int
133
+ attach_function :xkb_state_key_get_utf8, [ :pointer, :uint, :pointer, :uint ], :int
134
+ attach_function :xkb_state_key_get_utf32, [ :pointer, :uint ], :uint
135
+ attach_function :xkb_state_key_get_one_sym, [ :pointer, :uint ], :uint
136
+ attach_function :xkb_state_key_get_layout, [ :pointer, :uint ], :uint
137
+ attach_function :xkb_state_key_get_level, [ :pointer, :uint, :uint ], :uint
138
+ XKB_STATE_MATCH_ANY = (1 << 0)
139
+ XKB_STATE_MATCH_ALL = (1 << 1)
140
+ XKB_STATE_MATCH_NON_EXCLUSIVE = (1 << 16)
141
+
142
+ attach_function :xkb_state_serialize_mods, [ :pointer, :int ], :uint
143
+ attach_function :xkb_state_serialize_layout, [ :pointer, :int ], :uint
144
+ attach_function :xkb_state_mod_name_is_active, [ :pointer, :string, :int ], :int
145
+ attach_function :xkb_state_mod_names_are_active, [ :pointer, :int, :int, :varargs ], :int
146
+ attach_function :xkb_state_mod_index_is_active, [ :pointer, :uint, :int ], :int
147
+ attach_function :xkb_state_mod_indices_are_active, [ :pointer, :int, :int, :varargs ], :int
148
+ attach_function :xkb_state_mod_index_is_consumed, [ :pointer, :uint, :uint ], :int
149
+ attach_function :xkb_state_mod_mask_remove_consumed, [ :pointer, :uint, :uint ], :uint
150
+ attach_function :xkb_state_key_get_consumed_mods, [ :pointer, :uint ], :uint
151
+ attach_function :xkb_state_layout_name_is_active, [ :pointer, :string, :int ], :int
152
+ attach_function :xkb_state_layout_index_is_active, [ :pointer, :uint, :int ], :int
153
+ attach_function :xkb_state_led_name_is_active, [ :pointer, :string ], :int
154
+ attach_function :xkb_state_led_index_is_active, [ :pointer, :uint ], :int
@@ -0,0 +1,5 @@
1
+ %module xkbcommon_compose
2
+
3
+ typedef unsigned int xkb_keysym_t;
4
+
5
+ %include "xkbcommon/xkbcommon-compose.h"
@@ -0,0 +1,2 @@
1
+ %module xkbcommon_keysyms
2
+ %include "xkbcommon/xkbcommon-keysyms.h"
@@ -0,0 +1,2 @@
1
+ %module xkbcommon_names
2
+ %include "xkbcommon/xkbcommon-names.h"
@@ -0,0 +1,8 @@
1
+ %module xkbcommon_x11
2
+
3
+ typedef unsigned short uint16_t;
4
+
5
+ typedef int int32_t;
6
+ typedef unsigned int uint32_t;
7
+
8
+ %include "xkbcommon/xkbcommon-x11.h"
data/swig/xkbcommon.i ADDED
@@ -0,0 +1,5 @@
1
+ %module xkbcommon
2
+
3
+ typedef unsigned int uint32_t;
4
+
5
+ %include "xkbcommon/xkbcommon.h"
data/tasks/ffi.rake ADDED
@@ -0,0 +1,46 @@
1
+ namespace :ffi do
2
+ desc 'Generate ffi interface'
3
+ task :generate do
4
+ `swig -xml -o xkbcommon-compose_wrap.xml -I/usr/include swig/xkbcommon-compose.i`
5
+ `swig -xml -o xkbcommon-keysyms_wrap.xml -I/usr/include swig/xkbcommon-keysyms.i`
6
+ `swig -xml -o xkbcommon-names_wrap.xml -I/usr/include swig/xkbcommon-names.i`
7
+ `swig -xml -o xkbcommon-x11_wrap.xml -I/usr/include swig/xkbcommon-x11.i`
8
+ `swig -xml -o xkbcommon_wrap.xml -I/usr/include swig/xkbcommon.i`
9
+
10
+ `ffi-gen xkbcommon-compose_wrap.xml lib/libxkbcommon/xkbcommon-compose.rb`
11
+ `ffi-gen xkbcommon-keysyms_wrap.xml lib/libxkbcommon/xkbcommon-keysyms.rb`
12
+ `ffi-gen xkbcommon-names_wrap.xml lib/libxkbcommon/xkbcommon-names.rb`
13
+ `ffi-gen xkbcommon-x11_wrap.xml lib/libxkbcommon/xkbcommon-x11.rb`
14
+ `ffi-gen xkbcommon_wrap.xml lib/libxkbcommon/xkbcommon.rb`
15
+
16
+ # manual adjustments
17
+ `sed -i 's/va_list/:pointer/g' lib/libxkbcommon/xkbcommon.rb`
18
+
19
+ # translate char* into :pointer instead of :string
20
+ before = 'attach_function :xkb_state_key_get_utf8, \[ :pointer, :uint, :string, :uint \], :int'
21
+ after = 'attach_function :xkb_state_key_get_utf8, [ :pointer, :uint, :pointer, :uint ], :int'
22
+ `sed -i 's/#{before}/#{after}/g' lib/libxkbcommon/xkbcommon.rb`
23
+
24
+ before = 'attach_function :xkb_keysym_get_name, \[ :uint, :string, :uint \], :int'
25
+ after = 'attach_function :xkb_keysym_get_name, [ :uint, :pointer, :uint ], :int'
26
+ `sed -i 's/#{before}/#{after}/g' lib/libxkbcommon/xkbcommon.rb`
27
+
28
+ before = 'attach_function :xkb_keysym_to_utf8, \[ :uint, :string, :uint \], :int'
29
+ after = 'attach_function :xkb_keysym_to_utf8, [ :uint, :pointer, :uint ], :int'
30
+ `sed -i 's/#{before}/#{after}/g' lib/libxkbcommon/xkbcommon.rb`
31
+
32
+ `sed -i 's/Shift/"Shift"/g' lib/libxkbcommon/xkbcommon-names.rb`
33
+ `sed -i 's/Control/"Control"/g' lib/libxkbcommon/xkbcommon-names.rb`
34
+ `sed -i 's/Mod1/"Mod1"/g' lib/libxkbcommon/xkbcommon-names.rb`
35
+ `sed -i 's/Mod2/"Mod2"/g' lib/libxkbcommon/xkbcommon-names.rb`
36
+ `sed -i 's/Mod4/"Mod4"/g' lib/libxkbcommon/xkbcommon-names.rb`
37
+ `sed -i 's/= Caps Lock/= "Caps Lock"/g' lib/libxkbcommon/xkbcommon-names.rb`
38
+ `sed -i 's/= Num Lock/= "Num Lock"/g' lib/libxkbcommon/xkbcommon-names.rb`
39
+ `sed -i 's/= Scroll Lock/= "Scroll Lock"/g' lib/libxkbcommon/xkbcommon-names.rb`
40
+ `sed -i 's/= Lock/= "Lock"/g' lib/libxkbcommon/xkbcommon-names.rb`
41
+
42
+ # clean up
43
+ `rm -f xkbcommon-compose_wrap.xml xkbcommon-keysyms_wrap.xml xkbcommon-names_wrap.xml`
44
+ `rm -f xkbcommon-x11_wrap.xml xkbcommon_wrap.xml`
45
+ end
46
+ end
data/xkbcommon.gemspec ADDED
@@ -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 'libxkbcommon/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "libxkbcommon"
8
+ spec.version = Libxkbcommon::VERSION
9
+ spec.authors = ["Christopher Aue"]
10
+ spec.email = ["mail@christopheraue.net"]
11
+
12
+ spec.summary = %q{1:1 ruby bindings for libxkbcommon}
13
+ spec.homepage = "https://github.com/christopheraue/ruby-libxkbcommon"
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_runtime_dependency 'ffi', '~> 1.9'
21
+ spec.add_development_dependency "bundler", "~> 1.8"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "ffi-swig-generator", '~> 0'
24
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: libxkbcommon
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-08-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: ffi-swig-generator
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - mail@christopheraue.net
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rakeTasks"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - README.md
82
+ - Rakefile
83
+ - lib/libxkbcommon.rb
84
+ - lib/libxkbcommon/version.rb
85
+ - lib/libxkbcommon/xkbcommon-compose.rb
86
+ - lib/libxkbcommon/xkbcommon-keysyms.rb
87
+ - lib/libxkbcommon/xkbcommon-names.rb
88
+ - lib/libxkbcommon/xkbcommon-x11.rb
89
+ - lib/libxkbcommon/xkbcommon.rb
90
+ - swig/xkbcommon-compose.i
91
+ - swig/xkbcommon-keysyms.i
92
+ - swig/xkbcommon-names.i
93
+ - swig/xkbcommon-x11.i
94
+ - swig/xkbcommon.i
95
+ - tasks/ffi.rake
96
+ - xkbcommon.gemspec
97
+ homepage: https://github.com/christopheraue/ruby-libxkbcommon
98
+ licenses:
99
+ - MIT
100
+ metadata: {}
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubyforge_project:
117
+ rubygems_version: 2.4.8
118
+ signing_key:
119
+ specification_version: 4
120
+ summary: 1:1 ruby bindings for libxkbcommon
121
+ test_files: []