summaryrefslogtreecommitdiff
path: root/libcaribou/xadapter.vala
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@unixuser.org>2012-10-06 19:42:06 +0900
committerEitan Isaacson <eitan@monotonous.org>2012-10-08 11:55:36 -0700
commit0a643fd9e6e87d5e74da7cc00bb0c63ee79d1330 (patch)
treed7191a584fe243bac0059d8a5cb572755ff9c7b4 /libcaribou/xadapter.vala
parentcba1a72412c8223aed94732e75289e5a57dd2e96 (diff)
downloadcaribou-0a643fd9e6e87d5e74da7cc00bb0c63ee79d1330.tar.gz
libcaribou: simplify using xtst.vapi provided by vala
XTest.send_fake_key event and X.keysym_to_keycode are now available in vapi files in vala distribution. Also fix some compiler warnings. https://bugzilla.gnome.org/show_bug.cgi?id=685607
Diffstat (limited to 'libcaribou/xadapter.vala')
-rw-r--r--libcaribou/xadapter.vala11
1 files changed, 7 insertions, 4 deletions
diff --git a/libcaribou/xadapter.vala b/libcaribou/xadapter.vala
index 4d5c7c1..fba9df9 100644
--- a/libcaribou/xadapter.vala
+++ b/libcaribou/xadapter.vala
@@ -25,7 +25,7 @@ namespace Caribou {
public delegate void KeyButtonCallback (uint keybuttoncode, bool pressed);
private class KeyButtonHandler {
- public KeyButtonCallback cb { get; private set; }
+ public unowned KeyButtonCallback cb { get; private set; }
public KeyButtonHandler (KeyButtonCallback cb) {
this.cb = cb;
}
@@ -128,7 +128,7 @@ namespace Caribou {
for (i = xkbdesc.max_key_code; i >= xkbdesc.min_key_code; --i) {
if (xkbdesc.map.key_sym_map[i].kt_index[0] == Xkb.OneLevelIndex) {
- if (X.keycode_to_keysym (this.xdisplay, i, 0) != 0) {
+ if (this.xdisplay.keycode_to_keysym (i, 0) != 0) {
Gdk.error_trap_push ();
this.xdisplay.grab_key (i, 0,
Gdk.x11_get_default_root_xwindow (), true,
@@ -148,8 +148,8 @@ namespace Caribou {
private void replace_keycode (uint keysym) {
if (this.reserved_keycode == 0) {
this.reserved_keycode = get_reserved_keycode ();
- this.reserved_keysym = X.keycode_to_keysym (this.xdisplay,
- this.reserved_keycode, 0);
+ this.reserved_keysym = (uint) this.xdisplay.keycode_to_keysym (
+ this.reserved_keycode, 0);
}
this.xdisplay.flush ();
@@ -181,6 +181,9 @@ namespace Caribou {
Gdk.Keymap kmap= Gdk.Keymap.get_default ();
Gdk.KeymapKey[] kmk;
+ keycode = 0;
+ modmask = 0;
+
if (!kmap.get_entries_for_keyval (keyval, out kmk))
return false;