[gtk+/gtk-3-10] listbox: return GDK_EVENT_STOP if button events were handled



commit 65a1283b1842507edc4503942efa5dd44a8f544d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Jan 28 16:44:01 2014 +0100

    listbox: return GDK_EVENT_STOP if button events were handled
    
    The button press/release handlers did invariably return FALSE, even
    though it shouldn't if a row was found on the event coordinates. Also,
    use GDK_EVENT_* defines for the return values.

 gtk/gtklistbox.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index d2376b6..8eb139b 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -1220,6 +1220,7 @@ gtk_list_box_real_button_press_event (GtkWidget      *widget,
 {
   GtkListBox *list_box = GTK_LIST_BOX (widget);
   GtkListBoxPrivate *priv = gtk_list_box_get_instance_private (list_box);
+  gboolean retval = GDK_EVENT_PROPAGATE;
   gboolean ctrl_pressed;
   GdkWindow *window;
   double x, y;
@@ -1269,13 +1270,14 @@ gtk_list_box_real_button_press_event (GtkWidget      *widget,
               gtk_widget_queue_draw (GTK_WIDGET (list_box));
             }
 
+          retval = GDK_EVENT_STOP;
         }
       /* TODO:
          Should mark as active while down,
          and handle grab breaks */
     }
 
-  return FALSE;
+  return retval;
 }
 
 static gboolean
@@ -1284,6 +1286,7 @@ gtk_list_box_real_button_release_event (GtkWidget      *widget,
 {
   GtkListBox *list_box = GTK_LIST_BOX (widget);
   GtkListBoxPrivate *priv = gtk_list_box_get_instance_private (list_box);
+  gboolean retval = GDK_EVENT_PROPAGATE;
 
   /* Take a ref to protect against reentrancy (i.e. the activation may destroy the widget) */
   g_object_ref (list_box);
@@ -1301,6 +1304,7 @@ gtk_list_box_real_button_release_event (GtkWidget      *widget,
           else
             gtk_list_box_update_selected (list_box, priv->active_row);
 
+          retval = GDK_EVENT_STOP;
         }
       priv->active_row = NULL;
       priv->active_row_active = FALSE;
@@ -1309,7 +1313,7 @@ gtk_list_box_real_button_release_event (GtkWidget      *widget,
 
   g_object_unref (list_box);
 
-  return FALSE;
+  return retval;
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]