guard with compile-time checks the new GDK_* event type symbols; explain why runtime checks are not necessary (closes #10603)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-03-17 20:56:00 +00:00
parent 863001cdca
commit 3bb5029df2

View File

@@ -138,6 +138,13 @@ static void wxgtk_main_do_event(GdkEvent *event, wxGUIEventLoop* evtloop)
// categorize the GDK event according to wxEventCategory.
// See http://library.gnome.org/devel/gdk/unstable/gdk-Events.html#GdkEventType
// for more info.
// NOTE: GDK_* constants which were not present in the GDK2.0 can be tested for
// only at compile-time; when running the program (compiled with a recent GDK)
// on a system with an older GDK lib we can be sure there won't be problems
// because event->type will never assume those values corresponding to
// new event types (since new event types are always added in GDK with non
// conflicting values for ABI compatibility).
wxEventCategory cat = wxEVT_CATEGORY_UNKNOWN;
switch (event->type)
@@ -145,11 +152,12 @@ static void wxgtk_main_do_event(GdkEvent *event, wxGUIEventLoop* evtloop)
case GDK_SELECTION_REQUEST:
case GDK_SELECTION_NOTIFY:
case GDK_SELECTION_CLEAR:
#if GTK_CHECK_VERSION(2,6,0)
case GDK_OWNER_CHANGE:
#endif
cat = wxEVT_CATEGORY_CLIPBOARD;
break;
case GDK_KEY_PRESS:
case GDK_KEY_RELEASE:
case GDK_BUTTON_PRESS:
@@ -188,7 +196,12 @@ static void wxgtk_main_do_event(GdkEvent *event, wxGUIEventLoop* evtloop)
case GDK_DRAG_STATUS:
case GDK_DROP_START:
case GDK_DROP_FINISHED:
#if GTK_CHECK_VERSION(2,8,0)
case GDK_GRAB_BROKEN:
#endif
#if GTK_CHECK_VERSION(2,14,0)
case GDK_DAMAGE:
#endif
cat = wxEVT_CATEGORY_UI;
break;