#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.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
+
//-----------------------------------------------------------------------------
// documentation on internals
//-----------------------------------------------------------------------------
#ifndef __WXUNIVERSAL__
-GtkWidget* GetEntryWidget();
-
extern "C" {
static gboolean
expose_event_border(GtkWidget* widget, GdkEventExpose* gdk_event, wxWindow* win)
// for scrollable ones
detail = "viewport";
- GtkWidget* styleWidget = GetEntryWidget();
+ GtkWidget* styleWidget = wxGTKPrivate::GetEntryWidget();
gtk_paint_shadow(
styleWidget->style, gdk_event->window, GTK_STATE_NORMAL,
shadow, NULL, styleWidget, detail, x, y, w, h);
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK) != 0;
event.m_controlDown = (gdk_event->state & GDK_CONTROL_MASK) != 0;
event.m_altDown = (gdk_event->state & GDK_MOD1_MASK) != 0;
- event.m_metaDown = (gdk_event->state & GDK_MOD2_MASK) != 0;
+ event.m_metaDown = (gdk_event->state & GDK_META_MASK) != 0;
event.m_scanCode = gdk_event->keyval;
event.m_rawCode = (wxUint32) gdk_event->keyval;
event.m_rawFlags = 0;
event.m_shiftDown = gdk_event->state & GDK_SHIFT_MASK;
event.m_controlDown = gdk_event->state & GDK_CONTROL_MASK;
event.m_altDown = gdk_event->state & GDK_MOD1_MASK;
- event.m_metaDown = gdk_event->state & GDK_MOD2_MASK;
+ event.m_metaDown = gdk_event->state & GDK_META_MASK;
event.m_leftDown = gdk_event->state & GDK_BUTTON1_MASK;
event.m_middleDown = gdk_event->state & GDK_BUTTON2_MASK;
event.m_rightDown = gdk_event->state & GDK_BUTTON3_MASK;
ms.SetControlDown(mask & GDK_CONTROL_MASK);
ms.SetShiftDown(mask & GDK_SHIFT_MASK);
ms.SetAltDown(mask & GDK_MOD1_MASK);
- ms.SetMetaDown(mask & GDK_MOD2_MASK);
+ ms.SetMetaDown(mask & GDK_META_MASK);
return ms;
}
// Notify the parent keeping track of focus for the kbd navigation
// purposes that we got it.
- wxChildFocusEvent eventChildFocus(this);
+ wxChildFocusEvent eventChildFocus(static_cast<wxWindow*>(this));
GTKProcessEvent(eventChildFocus);
wxFocusEvent eventFocus(wxEVT_SET_FOCUS, GetId());
else
{
wxWindowDC dc( (wxWindow*)this );
- dc.SetClippingRegion( m_updateRegion );
+ dc.SetDeviceClippingRegion( m_updateRegion );
// Work around gtk-qt <= 0.60 bug whereby the window colour
// remains grey