[evolution/wip/webkit2] Attachment's List View passes mouse events to the parent widget



commit 4787baf7612d58c2f2c36e2c51eda3030e86ed70
Author: Milan Crha <mcrha redhat com>
Date:   Thu Nov 26 15:39:40 2015 +0100

    Attachment's List View passes mouse events to the parent widget
    
    That means that the parent widget, like EWebView, processes the event,
    even when it was used by the GtkTreeView descendant, which results in
    undesired behaviour, like a new mail message composer being opened
    for one of the message recipients (click on an address in the To/CC
    headers). The icon view doesn't do that, it reports the event as being
    used, but let's make it the same for both views.
    
    Reported downstream: https://bugzilla.redhat.com/show_bug.cgi?id=1285698

 e-util/e-attachment-icon-view.c |   36 +++++++++++++++++++++---------------
 e-util/e-attachment-tree-view.c |   36 +++++++++++++++++++++---------------
 2 files changed, 42 insertions(+), 30 deletions(-)
---
diff --git a/e-util/e-attachment-icon-view.c b/e-util/e-attachment-icon-view.c
index 98a7d87..c591f4a 100644
--- a/e-util/e-attachment-icon-view.c
+++ b/e-util/e-attachment-icon-view.c
@@ -197,12 +197,14 @@ attachment_icon_view_button_press_event (GtkWidget *widget,
 {
        EAttachmentView *view = E_ATTACHMENT_VIEW (widget);
 
-       if (e_attachment_view_button_press_event (view, event))
-               return TRUE;
+       if (!e_attachment_view_button_press_event (view, event)) {
+               /* Chain up to parent's button_press_event() method. */
+               GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)->
+                       button_press_event (widget, event);
+       }
 
-       /* Chain up to parent's button_press_event() method. */
-       return GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)->
-               button_press_event (widget, event);
+       /* Never propagate the event to the parent */
+       return TRUE;
 }
 
 static gboolean
@@ -211,12 +213,14 @@ attachment_icon_view_button_release_event (GtkWidget *widget,
 {
        EAttachmentView *view = E_ATTACHMENT_VIEW (widget);
 
-       if (e_attachment_view_button_release_event (view, event))
-               return TRUE;
+       if (!e_attachment_view_button_release_event (view, event)) {
+               /* Chain up to parent's button_release_event() method. */
+               GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)->
+                       button_release_event (widget, event);
+       }
 
-       /* Chain up to parent's button_release_event() method. */
-       return GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)->
-               button_release_event (widget, event);
+       /* Never propagate the event to the parent */
+       return TRUE;
 }
 
 static gboolean
@@ -225,12 +229,14 @@ attachment_icon_view_motion_notify_event (GtkWidget *widget,
 {
        EAttachmentView *view = E_ATTACHMENT_VIEW (widget);
 
-       if (e_attachment_view_motion_notify_event (view, event))
-               return TRUE;
+       if (!e_attachment_view_motion_notify_event (view, event)) {
+               /* Chain up to parent's motion_notify_event() method. */
+               GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)->
+                       motion_notify_event (widget, event);
+       }
 
-       /* Chain up to parent's motion_notify_event() method. */
-       return GTK_WIDGET_CLASS (e_attachment_icon_view_parent_class)->
-               motion_notify_event (widget, event);
+       /* Never propagate the event to the parent */
+       return TRUE;
 }
 
 static gboolean
diff --git a/e-util/e-attachment-tree-view.c b/e-util/e-attachment-tree-view.c
index 399b1c7..3d912b1 100644
--- a/e-util/e-attachment-tree-view.c
+++ b/e-util/e-attachment-tree-view.c
@@ -150,12 +150,14 @@ attachment_tree_view_button_press_event (GtkWidget *widget,
 {
        EAttachmentView *view = E_ATTACHMENT_VIEW (widget);
 
-       if (e_attachment_view_button_press_event (view, event))
-               return TRUE;
+       if (!e_attachment_view_button_press_event (view, event)) {
+               /* Chain up to parent's button_press_event() method. */
+               GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)->
+                       button_press_event (widget, event);
+       }
 
-       /* Chain up to parent's button_press_event() method. */
-       return GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)->
-               button_press_event (widget, event);
+       /* Never propagate the event to the parent */
+       return TRUE;
 }
 
 static gboolean
@@ -164,12 +166,14 @@ attachment_tree_view_button_release_event (GtkWidget *widget,
 {
        EAttachmentView *view = E_ATTACHMENT_VIEW (widget);
 
-       if (e_attachment_view_button_release_event (view, event))
-               return TRUE;
+       if (!e_attachment_view_button_release_event (view, event)) {
+               /* Chain up to parent's button_release_event() method. */
+               GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)->
+                       button_release_event (widget, event);
+       }
 
-       /* Chain up to parent's button_release_event() method. */
-       return GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)->
-               button_release_event (widget, event);
+       /* Never propagate the event to the parent */
+       return TRUE;
 }
 
 static gboolean
@@ -178,12 +182,14 @@ attachment_tree_view_motion_notify_event (GtkWidget *widget,
 {
        EAttachmentView *view = E_ATTACHMENT_VIEW (widget);
 
-       if (e_attachment_view_motion_notify_event (view, event))
-               return TRUE;
+       if (!e_attachment_view_motion_notify_event (view, event)) {
+               /* Chain up to parent's motion_notify_event() method. */
+               GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)->
+                       motion_notify_event (widget, event);
+       }
 
-       /* Chain up to parent's motion_notify_event() method. */
-       return GTK_WIDGET_CLASS (e_attachment_tree_view_parent_class)->
-               motion_notify_event (widget, event);
+       /* Never propagate the event to the parent */
+       return TRUE;
 }
 
 static gboolean


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