Define X11 keysym constants

This commit is contained in:
Takashi Kokubun 2016-11-30 02:05:33 +09:00
parent 74c44b5c8f
commit 560e51efb5
4 changed files with 2174 additions and 7 deletions

View File

@ -3,14 +3,14 @@ module Xkremap
# @param [Xkremap::Config] config
# @param [Xkremap::Display] display
def initialize(config, display)
@active_window = ActiveWindow.new(display)
@grab_manager = GrabManager.new(display)
@remap_compiler = KeyRemapCompiler.new(config, display)
@active_window = ActiveWindow.new(display)
@grab_manager = GrabManager.new(display)
@key_remap_compiler = KeyRemapCompiler.new(config, display)
remap_keys
end
def handle_key_press(keycode, state)
handler = @remap_handlers[keycode][state]
handler = @key_press_handlers[keycode][state]
if handler
handler.call
else
@ -32,7 +32,7 @@ module Xkremap
private
def remap_keys
@remap_handlers = @remap_compiler.compile
@key_press_handlers = @key_remap_compiler.compile
@grab_manager.grab_keys
puts 'remap keys!'
end

View File

@ -18,7 +18,7 @@ module Xkremap
display = @display
# C-b -> Left
result[to_keycode(0x0062)][1<<2] = Proc.new do
result[to_keycode(X11::XK_b)][1<<2] = Proc.new do
XlibWrapper.input_key(display, 0xff51, 0)
end
end

2166
src/x11_constants.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
#include "mruby.h"
extern void mrb_mruby_xkremap_gem_init(mrb_state *mrb);
extern void mrb_xkremap_xlib_wrapper_init(mrb_state *mrb, struct RClass *mXkremap);
extern void mrb_xkremap_display_init(mrb_state *mrb, struct RClass *mXkremap);
extern void mrb_xkremap_x11_constants_init(mrb_state *mrb, struct RClass *mXkremap);
void
mrb_xkremap_gem_init(mrb_state *mrb)
@ -11,6 +11,7 @@ mrb_xkremap_gem_init(mrb_state *mrb)
mrb_xkremap_xlib_wrapper_init(mrb, mXkremap);
mrb_xkremap_display_init(mrb, mXkremap);
mrb_xkremap_x11_constants_init(mrb, mXkremap);
mrb_gc_arena_restore(mrb, 0);
}