From 82213cb04e56cb1aa3c8659f3c36c9b3017ad345 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 9 Sep 2012 13:36:20 +0000 Subject: [PATCH] Set modifiers properly for the key events with AltGr in wxGTK. Just as under Windows, represent AltGr as a combination of wxMOD_CONTROL and wxMOD_ALT. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 7dcf9853c2..613f33abf5 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -666,6 +666,16 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event, event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0; event.m_metaDown = (gdk_event->state & GDK_META_MASK) != 0; + // At least with current Linux systems, MOD5 corresponds to AltGr key and + // we represent it, for consistency with Windows, which really allows to + // use Ctrl+Alt as a replacement for AltGr if this key is not present, as a + // combination of these two modifiers. + if ( gdk_event->state & GDK_MOD5_MASK ) + { + event.m_controlDown = + event.m_altDown = true; + } + // Normally we take the state of modifiers directly from the low level GDK // event but unfortunately GDK uses a different convention from MSW for the // key events corresponding to the modifier keys themselves: in it, when