[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/pgtk b1b7440 098/100: Work around gtk_im_context_filter_keypress
From: |
Yuuki Harano |
Subject: |
feature/pgtk b1b7440 098/100: Work around gtk_im_context_filter_keypress() issue with super key |
Date: |
Tue, 24 Nov 2020 08:02:46 -0500 (EST) |
branch: feature/pgtk
commit b1b744057f4605cf7165a2041d2979a7decdacff
Author: Yuuki Harano <masm+github@masm11.me>
Commit: Jeff Walsh <jeff.walsh@drtusers-MacBook-Pro.local>
Work around gtk_im_context_filter_keypress() issue with super key
* src/pgtkterm.c (x_find_modifier_meanings): Convert virtual super
to non-virtual one.
(pgtk_gtk_to_emacs_modifiers): Use non-virtual one.
(pgtk_emacs_to_gtk_modifiers): Use non-virtual one.
(key_press_event): Don't call pgtk_im_context_filter_keypress while
super is pressed.
* src/pgtkterm.h (struct pgtk_display_info): New member.
---
src/pgtkterm.c | 35 +++++++++++++++++++++++++++++++----
src/pgtkterm.h | 2 +-
2 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index d7bbfe1..ab61283 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -5424,6 +5424,25 @@ x_find_modifier_meanings (struct pgtk_display_info
*dpyinfo)
dpyinfo->meta_mod_mask = GDK_MOD1_MASK;
dpyinfo->alt_mod_mask = 0;
}
+
+ state = GDK_SUPER_MASK;
+ r = gdk_keymap_map_virtual_modifiers (keymap, &state);
+ if (r)
+ {
+ /* Super key exists. */
+ if (state == GDK_SUPER_MASK)
+ {
+ dpyinfo->super_mod_mask = GDK_MOD4_MASK; /* maybe this is super.
*/
+ }
+ else
+ {
+ dpyinfo->super_mod_mask = state & ~GDK_SUPER_MASK;
+ }
+ }
+ else
+ {
+ dpyinfo->super_mod_mask = GDK_MOD4_MASK;
+ }
}
static void
@@ -5478,7 +5497,7 @@ pgtk_gtk_to_emacs_modifiers (struct pgtk_display_info
*dpyinfo, int state)
mod |= mod_meta;
if (state & dpyinfo->alt_mod_mask)
mod |= mod_alt;
- if (state & GDK_SUPER_MASK)
+ if (state & dpyinfo->super_mod_mask)
mod |= mod_super;
if (state & GDK_HYPER_MASK)
mod |= mod_hyper;
@@ -5502,7 +5521,7 @@ pgtk_emacs_to_gtk_modifiers (struct pgtk_display_info
*dpyinfo, int state)
if (state & mod_alt)
mask |= dpyinfo->alt_mod_mask;
if (state & mod_super)
- mask |= GDK_SUPER_MASK;
+ mask |= dpyinfo->super_mod_mask;
if (state & mod_hyper)
mask |= GDK_HYPER_MASK;
if (state & shift_modifier)
@@ -5594,8 +5613,16 @@ key_press_event (GtkWidget * widget, GdkEvent * event,
gpointer * user_data)
if (f != 0)
{
- if (pgtk_im_filter_keypress (f, &event->key))
- return TRUE;
+ /* While super is pressed, gtk_im_context_filter_keypress() always
process the
+ * key events ignoring super.
+ * As a work around, don't call it while super is pressed...
+ */
+ struct pgtk_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
+ if (!(event->key.state & dpyinfo->super_mod_mask))
+ {
+ if (pgtk_im_filter_keypress (f, &event->key))
+ return TRUE;
+ }
}
if (f != 0)
diff --git a/src/pgtkterm.h b/src/pgtkterm.h
index 641509b..a777885 100644
--- a/src/pgtkterm.h
+++ b/src/pgtkterm.h
@@ -235,7 +235,7 @@ struct pgtk_display_info
struct frame *last_mouse_glyph_frame;
/* Modifier masks in gdk */
- int meta_mod_mask, alt_mod_mask;
+ int meta_mod_mask, alt_mod_mask, super_mod_mask;
/* The last click event. */
GdkEvent *last_click_event;
- feature/pgtk cbd28cd 046/100: improve code readability., (continued)
- feature/pgtk cbd28cd 046/100: improve code readability., Yuuki Harano, 2020/11/24
- feature/pgtk ef67659 045/100: Set screen/display dpi res to make broadway work as expected, Yuuki Harano, 2020/11/24
- feature/pgtk d109dab 059/100: * src/pgtkfns.c: change coding style, Yuuki Harano, 2020/11/24
- feature/pgtk 9eb35f9 033/100: experimental support of tab-bar., Yuuki Harano, 2020/11/24
- feature/pgtk 25cf592 067/100: Change coding style, Yuuki Harano, 2020/11/24
- feature/pgtk e7190d8 075/100: Fix non-English layout does not work, Yuuki Harano, 2020/11/24
- feature/pgtk 28073ba 083/100: Re-implement childframe with emacsgtkfixed, Yuuki Harano, 2020/11/24
- feature/pgtk 6c43496 074/100: Fix font lock is not applied on continued lines, Yuuki Harano, 2020/11/24
- feature/pgtk 9704e23 081/100: Enable GtkIMContext by default, Yuuki Harano, 2020/11/24
- feature/pgtk b60d4c9 086/100: Fix crash on creating child frames., Yuuki Harano, 2020/11/24
- feature/pgtk b1b7440 098/100: Work around gtk_im_context_filter_keypress() issue with super key,
Yuuki Harano <=
- feature/pgtk 992ef48 041/100: update redisplay_interface., Yuuki Harano, 2020/11/24
- feature/pgtk 232c129 035/100: implement pre-edit input method, Yuuki Harano, 2020/11/24
- feature/pgtk 984f9cc 050/100: restore frame_rehighlight_hook., Yuuki Harano, 2020/11/24
- feature/pgtk 51462ce 078/100: Add PGTK to system-configuration-features, Yuuki Harano, 2020/11/24
- feature/pgtk 7c8da33 084/100: Exclude Xlib's modifier keys, Yuuki Harano, 2020/11/24
- feature/pgtk 2d5ffa5 076/100: Make pointer visible when motion notify event, Yuuki Harano, 2020/11/24
- feature/pgtk 2dd20b2 079/100: Self-implement tooltip, Yuuki Harano, 2020/11/24
- feature/pgtk e75ce03 082/100: Add support for x-support-frames, Yuuki Harano, 2020/11/24
- feature/pgtk 6df8556 080/100: Remove duplicated syms_of_xwidget call, Yuuki Harano, 2020/11/24
- feature/pgtk 948e2fa 094/100: Avoid weird behavior when resizing with top-left corner, Yuuki Harano, 2020/11/24