]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/evtloop.cpp
Fix deprecating warning introduced in r72446.
[wxWidgets.git] / src / gtk / evtloop.cpp
index 58e5a4f478cd3f591a7376e94f60c68aa39d0ddb..c58b0b1c4722a812711833975a0cf65376f1c9c0 100644 (file)
@@ -95,6 +95,8 @@ static gboolean wx_on_channel_event(GIOChannel *channel,
                                     GIOCondition condition,
                                     gpointer data)
 {
                                     GIOCondition condition,
                                     gpointer data)
 {
+    wxUnusedVar(channel); // Unused if !wxUSE_LOG || !wxDEBUG_LEVEL
+
     wxLogTrace(wxTRACE_EVT_SOURCE,
                "wx_on_channel_event, fd=%d, condition=%08x",
                g_io_channel_unix_get_fd(channel), condition);
     wxLogTrace(wxTRACE_EVT_SOURCE,
                "wx_on_channel_event, fd=%d, condition=%08x",
                g_io_channel_unix_get_fd(channel), condition);
@@ -227,15 +229,17 @@ static void wxgtk_main_do_event(GdkEvent* event, void* data)
     //       new event types (since new event types are always added in GDK with non
     //       conflicting values for ABI compatibility).
 
     //       new event types (since new event types are always added in GDK with non
     //       conflicting values for ABI compatibility).
 
-    wxEventCategory cat = wxEVT_CATEGORY_UNKNOWN;
+    // Some events (currently only a single one) may be used for more than one
+    // category, so we need 2 variables. The second one will remain "unknown"
+    // in most cases.
+    wxEventCategory cat = wxEVT_CATEGORY_UNKNOWN,
+                    cat2 = wxEVT_CATEGORY_UNKNOWN;
     switch (event->type)
     {
     case GDK_SELECTION_REQUEST:
     case GDK_SELECTION_NOTIFY:
     case GDK_SELECTION_CLEAR:
     switch (event->type)
     {
     case GDK_SELECTION_REQUEST:
     case GDK_SELECTION_NOTIFY:
     case GDK_SELECTION_CLEAR:
-#if GTK_CHECK_VERSION(2,6,0)
     case GDK_OWNER_CHANGE:
     case GDK_OWNER_CHANGE:
-#endif
         cat = wxEVT_CATEGORY_CLIPBOARD;
         break;
 
         cat = wxEVT_CATEGORY_CLIPBOARD;
         break;
 
@@ -250,6 +254,14 @@ static void wxgtk_main_do_event(GdkEvent* event, void* data)
         cat = wxEVT_CATEGORY_USER_INPUT;
         break;
 
         cat = wxEVT_CATEGORY_USER_INPUT;
         break;
 
+    case GDK_PROPERTY_NOTIFY:
+        // This one is special: it can be used for UI purposes but also for
+        // clipboard operations, so allow it in both cases (we probably could
+        // examine the event itself to distinguish between the two cases but
+        // this would be unnecessarily complicated).
+        cat2 = wxEVT_CATEGORY_CLIPBOARD;
+        // Fall through.
+
     case GDK_PROXIMITY_IN:
     case GDK_PROXIMITY_OUT:
 
     case GDK_PROXIMITY_IN:
     case GDK_PROXIMITY_OUT:
 
@@ -257,7 +269,6 @@ static void wxgtk_main_do_event(GdkEvent* event, void* data)
     case GDK_ENTER_NOTIFY:
     case GDK_LEAVE_NOTIFY:
     case GDK_VISIBILITY_NOTIFY:
     case GDK_ENTER_NOTIFY:
     case GDK_LEAVE_NOTIFY:
     case GDK_VISIBILITY_NOTIFY:
-    case GDK_PROPERTY_NOTIFY:
 
     case GDK_FOCUS_CHANGE:
     case GDK_CONFIGURE:
 
     case GDK_FOCUS_CHANGE:
     case GDK_CONFIGURE:
@@ -267,7 +278,9 @@ static void wxgtk_main_do_event(GdkEvent* event, void* data)
     case GDK_DESTROY:
 
     case GDK_EXPOSE:
     case GDK_DESTROY:
 
     case GDK_EXPOSE:
+#ifndef __WXGTK3__
     case GDK_NO_EXPOSE:
     case GDK_NO_EXPOSE:
+#endif
     case GDK_MAP:
     case GDK_UNMAP:
 
     case GDK_MAP:
     case GDK_UNMAP:
 
@@ -294,11 +307,19 @@ static void wxgtk_main_do_event(GdkEvent* event, void* data)
     wxGUIEventLoop* evtloop = static_cast<wxGUIEventLoop*>(data);
 
     // is this event allowed now?
     wxGUIEventLoop* evtloop = static_cast<wxGUIEventLoop*>(data);
 
     // is this event allowed now?
-    if (evtloop->IsEventAllowedInsideYield(cat))
-        gtk_main_do_event(event);         // process it now
+    if (evtloop->IsEventAllowedInsideYield(cat) ||
+            (cat2 != wxEVT_CATEGORY_UNKNOWN &&
+                evtloop->IsEventAllowedInsideYield(cat2)))
+    {
+        // process it now
+        gtk_main_do_event(event);
+    }
     else if (event->type != GDK_NOTHING)
     else if (event->type != GDK_NOTHING)
+    {
+        // process it later (but make a copy; the caller will free the event
+        // pointer)
         evtloop->StoreGdkEventForLaterProcessing(gdk_event_copy(event));
         evtloop->StoreGdkEventForLaterProcessing(gdk_event_copy(event));
-            // process it later (but make a copy; the caller will free the event pointer)
+    }
 }
 }
 
 }
 }