[goffice] Fix mouse events for widgets inside a GtkContainer. [#696533]



commit ae7e2956ee4a0207ad2fda041e2b728bfa7350a7
Author: Jean Brefort <jean brefort normalesup org>
Date:   Wed Mar 27 17:49:57 2013 +0100

    Fix mouse events for widgets inside a GtkContainer. [#696533]

 ChangeLog                   |    6 ++++++
 NEWS                        |    1 +
 goffice/canvas/goc-widget.c |   21 +++++++++++++++++----
 3 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 14bd42c..e3919fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2013-03-27  Jean Brefort  <jean brefort normalesup org>
 
+       * goffice/canvas/goc-widget.c (goc_widget_connect_signals),
+       (goc_widget_set_widget): connetc the signals to all widgets including those
+        inside a container. [#696533]
+
+2013-03-27  Jean Brefort  <jean brefort normalesup org>
+
        * goffice/canvas/goc-widget.c (goc_widget_distance): fixed distance
        evaluation. This ensure that the cursor is correctly updated.
 
diff --git a/NEWS b/NEWS
index b726b30..d6ee48b 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ goffice 0.10.2:
 Jean:
        * Don't use uninitialized values in bar/column plots. [#696569]
        * Fix currency selector visibility. [#696647]
+       * Fix mouse events for widgets inside a GtkContainer. [#696533]
 
 Morten:
        * Fix problems with cspline boxed type. [#695550]
diff --git a/goffice/canvas/goc-widget.c b/goffice/canvas/goc-widget.c
index bf70dd7..f5cac2d 100644
--- a/goffice/canvas/goc-widget.c
+++ b/goffice/canvas/goc-widget.c
@@ -576,6 +576,22 @@ cb_canvas_changed (GocWidget *item, G_GNUC_UNUSED GParamSpec *pspec,
 }
 
 static void
+goc_widget_connect_signals (GtkWidget *widget, GocWidget *item)
+{
+               if (GTK_IS_CONTAINER (widget)) {
+                       GList *ptr = gtk_container_get_children (GTK_CONTAINER (widget));
+                       while (ptr && ptr->data) {
+                               goc_widget_connect_signals (ptr->data, item);
+                               ptr = ptr->next;
+                       }
+               }
+               g_signal_connect (widget, "enter-notify-event",
+                                 G_CALLBACK (enter_notify_cb), item);
+               g_signal_connect (widget, "button-press-event",
+                                 G_CALLBACK (button_press_cb), item);
+}
+
+static void
 goc_widget_set_widget (GocWidget *item, GtkWidget *widget)
 {
        if (widget == item->widget)
@@ -612,10 +628,7 @@ goc_widget_set_widget (GocWidget *item, GtkWidget *widget)
                                        item->ofbox, item->x, item->y);
                goc_widget_notify_scrolled (GOC_ITEM (item));
                /* we need to propagate some signals to the parent item */
-               g_signal_connect (widget, "enter-notify-event",
-                                 G_CALLBACK (enter_notify_cb), item);
-               g_signal_connect (widget, "button-press-event",
-                                 G_CALLBACK (button_press_cb), item);
+               goc_widget_connect_signals (widget, item);
        }
 }
 


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