From cf0a0f93032009e2da3a1e7aa6d6998992dc564d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 8 Nov 2011 11:02:05 +0000 Subject: [PATCH] Move GDK_META_MASK definition in the header in which it is also used. The code using GDK_META_MASK was moved to wx/gtk/private/event.h from gtk/window.cpp but the fallback definition of GDK_META_MASK for GTK+ < 2.10 remained in window.cpp. Move it to the header as well now so that it can be compiled with GTK+ < 2.10 again. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69698 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/private/event.h | 23 +++++++++++++++++++++++ src/gtk/window.cpp | 23 ----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/wx/gtk/private/event.h b/include/wx/gtk/private/event.h index 1b23254045..7c1254fea8 100644 --- a/include/wx/gtk/private/event.h +++ b/include/wx/gtk/private/event.h @@ -11,6 +11,29 @@ #ifndef _GTK_PRIVATE_EVENT_H_ #define _GTK_PRIVATE_EVENT_H_ +#if !GTK_CHECK_VERSION(2,10,0) + // GTK+ can reliably detect Meta key state only since 2.10 when + // GDK_META_MASK was introduced -- there wasn't any way to detect it + // in older versions. wxGTK used GDK_MOD2_MASK for this purpose, but + // GDK_MOD2_MASK is documented as: + // + // the fifth modifier key (it depends on the modifier mapping of the X + // server which key is interpreted as this modifier) + // + // In other words, it isn't guaranteed to map to Meta. This is a real + // problem: it is common to map NumLock to it (in fact, it's an exception + // if the X server _doesn't_ use it for NumLock). So the old code caused + // wxKeyEvent::MetaDown() to always return true as long as NumLock was on + // on many systems, which broke all applications using + // wxKeyEvent::GetModifiers() to check modifiers state (see e.g. here: + // http://tinyurl.com/56lsk2). + // + // Because of this, it's better to not detect Meta key state at all than + // to detect it incorrectly. Hence the following #define, which causes + // m_metaDown to be always set to false. + #define GDK_META_MASK 0 +#endif + namespace wxGTKImpl { diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 1af7d1442d..c244d2c91c 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -47,29 +47,6 @@ using namespace wxGTKImpl; #include #endif -#if !GTK_CHECK_VERSION(2,10,0) - // GTK+ can reliably detect Meta key state only since 2.10 when - // GDK_META_MASK was introduced -- there wasn't any way to detect it - // in older versions. wxGTK used GDK_MOD2_MASK for this purpose, but - // GDK_MOD2_MASK is documented as: - // - // the fifth modifier key (it depends on the modifier mapping of the X - // server which key is interpreted as this modifier) - // - // In other words, it isn't guaranteed to map to Meta. This is a real - // problem: it is common to map NumLock to it (in fact, it's an exception - // if the X server _doesn't_ use it for NumLock). So the old code caused - // wxKeyEvent::MetaDown() to always return true as long as NumLock was on - // on many systems, which broke all applications using - // wxKeyEvent::GetModifiers() to check modifiers state (see e.g. here: - // http://tinyurl.com/56lsk2). - // - // Because of this, it's better to not detect Meta key state at all than - // to detect it incorrectly. Hence the following #define, which causes - // m_metaDown to be always set to false. - #define GDK_META_MASK 0 -#endif - //----------------------------------------------------------------------------- // documentation on internals //----------------------------------------------------------------------------- -- 2.45.2