]> git.saurik.com Git - wxWidgets.git/commitdiff
changed GTKCallbackCommonPrologue() to return -1 in addition to true and false to...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 25 Aug 2006 13:22:32 +0000 (13:22 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 25 Aug 2006 13:22:32 +0000 (13:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40818 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/window.h
src/gtk/window.cpp

index 8106f545cded1703f8864db24af4697e0c6d9926..87003b1e6982eb3fbd25434d2fb2f2242efc1a11 100644 (file)
@@ -161,8 +161,10 @@ public:
     virtual GtkWidget* GetConnectWidget();
     void ConnectWidget( GtkWidget *widget );
 
-    // Called from several event handlers
-    bool GTKCallbackCommonPrologue(struct _GdkEventAny *event) const;
+    // Called from several event handlers, if it returns true or false, the
+    // same value should be immediately returned by the handler without doing
+    // anything else. If it returns -1, the handler should continue as usual
+    int GTKCallbackCommonPrologue(struct _GdkEventAny *event) const;
 
 protected:
     // Override GTKWidgetNeedsMnemonic and return true if your
index b5ebaaea800a0633dc38a74dfb50aa0da092edff..c52acc624112c934fd7d6717f547c65dcbb21ba7 100644 (file)
@@ -1410,7 +1410,7 @@ wxWindowGTK *FindWindowForMouseEvent(wxWindowGTK *win, wxCoord& x, wxCoord& y)
 // common event handlers helpers
 // ----------------------------------------------------------------------------
 
-bool wxWindowGTK::GTKCallbackCommonPrologue(GdkEventAny *event) const
+int wxWindowGTK::GTKCallbackCommonPrologue(GdkEventAny *event) const
 {
     DEBUG_MAIN_THREAD
 
@@ -1418,23 +1418,23 @@ bool wxWindowGTK::GTKCallbackCommonPrologue(GdkEventAny *event) const
         wxapp_install_idle_handler();
 
     if (!m_hasVMT)
-        return false;
+        return FALSE;
     if (g_blockEventsOnDrag)
-        return true;
+        return TRUE;
     if (g_blockEventsOnScroll)
-        return true;
+        return TRUE;
 
     if (!GTKIsOwnWindow(event->window))
-        return false;
+        return FALSE;
 
-    return true;
+    return -1;
 }
 
 // overloads for all GDK event types we use here: we need to have this as
 // GdkEventXXX can't be implicitly cast to GdkEventAny even if it, in fact,
 // derives from it in the sense that the structs have the same layout
 #define wxDEFINE_COMMON_PROLOGUE_OVERLOAD(T)                                  \
-    static bool wxGtkCallbackCommonPrologue(T *event, wxWindowGTK *win)       \
+    static int wxGtkCallbackCommonPrologue(T *event, wxWindowGTK *win)        \
     {                                                                         \
         return win->GTKCallbackCommonPrologue((GdkEventAny *)event);          \
     }
@@ -1445,6 +1445,11 @@ wxDEFINE_COMMON_PROLOGUE_OVERLOAD(GdkEventCrossing)
 
 #undef wxDEFINE_COMMON_PROLOGUE_OVERLOAD
 
+#define wxCOMMON_CALLBACK_PROLOGUE(event, win)                                \
+    const int rc = wxGtkCallbackCommonPrologue(event, win);                   \
+    if ( rc != -1 )                                                           \
+        return rc
+
 // send the wxChildFocusEvent and wxFocusEvent, common code of
 // gtk_window_focus_in_callback() and SetFocus()
 static bool DoSendFocusEvents(wxWindow *win)
@@ -1473,8 +1478,7 @@ gtk_window_button_press_callback( GtkWidget *widget,
                                   GdkEventButton *gdk_event,
                                   wxWindowGTK *win )
 {
-    if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
-        return FALSE;
+    wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
 
     if (win->m_wxwindow && (g_focusWindow != win) && win->AcceptsFocus())
     {
@@ -1646,8 +1650,7 @@ gtk_window_button_release_callback( GtkWidget *widget,
                                     GdkEventButton *gdk_event,
                                     wxWindowGTK *win )
 {
-    if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
-        return FALSE;
+    wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
 
     wxEventType event_type = wxEVT_NULL;
 
@@ -1703,8 +1706,7 @@ gtk_window_motion_notify_callback( GtkWidget *widget,
                                    GdkEventMotion *gdk_event,
                                    wxWindowGTK *win )
 {
-    if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
-        return FALSE;
+    wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
 
     if (gdk_event->is_hint)
     {
@@ -1956,8 +1958,7 @@ gtk_window_enter_callback( GtkWidget *widget,
                            GdkEventCrossing *gdk_event,
                            wxWindowGTK *win )
 {
-    if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
-        return FALSE;
+    wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
 
     // Event was emitted after a grab
     if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE;
@@ -2001,8 +2002,7 @@ gtk_window_leave_callback( GtkWidget *widget,
                            GdkEventCrossing *gdk_event,
                            wxWindowGTK *win )
 {
-    if ( !wxGtkCallbackCommonPrologue(gdk_event, win) )
-        return FALSE;
+    wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
 
     // Event was emitted after an ungrab
     if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE;