Re: #17611: Accelerators not using modifiers (or using only Shift) don't work in wxGTK when a wxPanel is focused

14 views
Skip to first unread message

wxTrac

unread,
Jun 6, 2021, 12:38:00 PM6/6/21
to wx-...@googlegroups.com
#17611: Accelerators not using modifiers (or using only Shift) don't work in wxGTK
when a wxPanel is focused
-------------------------+-------------------------
Reporter: jerome_mao | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 3.0.2
Resolution: | Keywords: accelerator
Blocked By: | Blocking:
Patch: 0 |
-------------------------+-------------------------
Changes (by GabrieleGiuseppini):

* cc: gabriele.giuseppini@… (added)


Comment:

I'm hitting the same issue (see
https://forums.wxwidgets.org/viewtopic.php?f=23&t=48358&p=206561#p206561),
and it seems the issue is not exclusively due to having a child wxPanel -
it also happens when the frame has a child wxGLCanvas, see minimal example
in the linked post.

This rules out the workaround of using a wxWindow instead of a wxPanel -
any frame that uses a wxGLCanvas will be affected, and the latter cannot
be substituted with a wxWindow :-(

Also, the workaround of adding a hidden window to the glCanvas doesn't
work. Could this ticket get some priority? Alternatively, is there another
workaround that might work when the child of the frame is a GL canvas?

I'd help with debugging but I'm a newbie with GTK...

--
Ticket URL: <https://trac.wxwidgets.org/ticket/17611#comment:15>

wxTrac

unread,
Jun 10, 2021, 6:10:31 PM6/10/21
to wx-...@googlegroups.com
#17611: Accelerators not using modifiers (or using only Shift) don't work in wxGTK
when a wxPanel is focused
-------------------------+-------------------------
Reporter: jerome_mao | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxGTK | Version: 3.0.2
Resolution: | Keywords: accelerator
Blocked By: | Blocking:
Patch: 0 |
-------------------------+-------------------------

Comment (by vadz):

The problem is that the IM explicitly tells us not to do anything with
this key event by returning `TRUE` from `gtk_im_context_filter_keypress()`
which mans that
[https://developer.gnome.org/gtk3/stable/GtkIMContext.html#gtk-im-context-
filter-keypress no further processing should be done for this key event].

Simply ignoring this recommendation, i.e. doing
{{{
#!diff
diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp
index d891c96423..716c15a312 100644
--- a/src/gtk/window.cpp
+++ b/src/gtk/window.cpp
@@ -1268,7 +1268,7 @@ gtk_window_key_press_callback( GtkWidget
*WXUNUSED(widget),
if ( intercepted_by_IM )
{
wxLogTrace(TRACE_KEYS, wxT("Key event intercepted by IM"));
- return TRUE;
+ return FALSE;
}
}

}}}

allows the accelerator to work, but I have no idea what could this
break... Paul, do you think we could do something like the above or is it
an Obviously Bad Idea?

--
Ticket URL: <https://trac.wxwidgets.org/ticket/17611#comment:16>
Reply all
Reply to author
Forward
0 new messages