Skip to content

Commit

Permalink
client/gtk2/ibusimcontext: keycode - 8 for gtk3 keycode generation
Browse files Browse the repository at this point in the history
Since IBus keycode subtracts 8 from Linux keycode, keycodes from
gdk_keymap_get_entries_for_keyval() also have to be subtracted 8.
The keycodes will add 8 when they bring back the GDK event loop.
  • Loading branch information
fujiwarat committed May 20, 2022
1 parent 47303a6 commit 8711dc8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/gtk2/ibusimcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
* Copyright (C) 2015-2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
* Copyright (C) 2008-2021 Red Hat, Inc.
* Copyright (C) 2015-2022 Takao Fujiwara <takao.fujiwara1@gmail.com>
* Copyright (C) 2008-2022 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -1980,6 +1980,9 @@ _ibus_context_forward_key_event_cb (IBusInputContext *ibuscontext,
keycode = keys->keycode;
else
g_warning ("Failed to parse keycode from keyval %x", keyval);
/* _create_gdk_event() will add 8 to keycode. */
if (keycode != 0)
keycode -= 8;
}
GdkEventKey *event = _create_gdk_event (ibusimcontext, keyval, keycode, state);
gdk_event_put ((GdkEvent *)event);
Expand Down

0 comments on commit 8711dc8

Please sign in to comment.