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
This commit is contained in:
Vadim Zeitlin
2011-11-08 11:02:05 +00:00
parent b6dd4afdf8
commit cf0a0f9303
2 changed files with 23 additions and 23 deletions

View File

@@ -11,6 +11,29 @@
#ifndef _GTK_PRIVATE_EVENT_H_ #ifndef _GTK_PRIVATE_EVENT_H_
#define _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 namespace wxGTKImpl
{ {

View File

@@ -47,29 +47,6 @@ using namespace wxGTKImpl;
#include <gdk/gdkkeysyms-compat.h> #include <gdk/gdkkeysyms-compat.h>
#endif #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 // documentation on internals
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------