[Commits] [SCM] claws branch, master, updated. 3.17.0-147-ge098133

ticho at claws-mail.org ticho at claws-mail.org
Tue Nov 6 00:17:50 CET 2018


The branch, master has been updated
       via  e0981338ea10b5216764d66663298026fa30cab8 (commit)
      from  09541526d2781d4adfed9108ecb254dd517af3a2 (commit)

Summary of changes:
 src/addressbook.c     |    4 ++++
 src/editgroup.c       |    2 ++
 src/folderview.c      |    1 +
 src/grouplistdialog.c |    1 +
 src/gtk/gtkcmctree.h  |    4 ++++
 src/gtk/gtksctree.h   |    4 ++++
 src/summaryview.c     |    1 +
 7 files changed, 17 insertions(+)


- Log -----------------------------------------------------------------
commit e0981338ea10b5216764d66663298026fa30cab8
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Tue Nov 6 00:05:17 2018 +0100

    Make sure all users of GtkCMCList do not blindly assume that a button-press-event happens inside of the tree view.
    
    If clicking on the header row, the event's x,y coordinates
    were pointing to a different spot than what the event handler
    code expected, since those coordinates are relative to the
    relevant GDK window, and header row has its own. Calls to
    gtk_cmclist_get_selection_info() or gtk_sctree_is_hot_spot()
    in such cases therefore returned bogus info.
    
    This fixes things like folderview expanding/collapsing
    selected folder when double-clicking its header column, or
    selecting first row when single-clicking it.

diff --git a/src/addressbook.c b/src/addressbook.c
index 6592385..3c95609 100644
--- a/src/addressbook.c
+++ b/src/addressbook.c
@@ -2482,6 +2482,7 @@ static gboolean addressbook_list_button_pressed(GtkWidget *widget,
 						gpointer data)
 {
 	if( ! event ) return FALSE;
+	if( event->window != GTK_CMCLIST(widget)->clist_window ) return FALSE;
 
 	addressbook_list_menu_setup();
 
@@ -2539,6 +2540,9 @@ static gboolean addressbook_tree_button_pressed(GtkWidget *ctree,
 	if( ! event ) return FALSE;
 /*	if( ! event || event->type != GDK_BUTTON_PRESS) return FALSE;*/
 
+	if( event->window != clist->clist_window )
+		return FALSE;
+
 	if (event->button == 1) {
 		if (event->type == GDK_2BUTTON_PRESS) {
 			if( gtk_cmclist_get_selection_info( clist, event->x, event->y, &row, &column ) ) {
diff --git a/src/editgroup.c b/src/editgroup.c
index 21e77f2..22f16a8 100644
--- a/src/editgroup.c
+++ b/src/editgroup.c
@@ -215,6 +215,7 @@ static void edit_group_to_avail( GtkWidget *widget, gpointer data ) {
 
 static gboolean edit_group_list_group_button( GtkCMCList *clist, GdkEventButton *event, gpointer data ) {
 	if( ! event ) return FALSE;
+	if( event->window != clist->clist_window ) return FALSE;
 
 	if( event->button == 1 ) {
 		if( event->type == GDK_2BUTTON_PRESS ) {
@@ -226,6 +227,7 @@ static gboolean edit_group_list_group_button( GtkCMCList *clist, GdkEventButton
 
 static gboolean edit_group_list_avail_button( GtkCMCList *clist, GdkEventButton *event, gpointer data ) {
 	if( ! event ) return FALSE;
+	if( event->window != clist->clist_window ) return FALSE;
 
 	if( event->button == 1 ) {
 		if( event->type == GDK_2BUTTON_PRESS ) {
diff --git a/src/folderview.c b/src/folderview.c
index 63cabc2..2679320 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -2023,6 +2023,7 @@ static gboolean folderview_button_pressed(GtkWidget *ctree, GdkEventButton *even
 	gint prev_row = -1, row = -1, column = -1;
 
 	if (!event) return FALSE;
+	if (event->window != clist->clist_window) return FALSE;
 
 	if (event->button == 1 || event->button == 2) {
 		if (!gtk_sctree_is_hot_spot (GTK_SCTREE(clist), event->x, event->y))
diff --git a/src/grouplistdialog.c b/src/grouplistdialog.c
index 9ff8b25..429e57e 100644
--- a/src/grouplistdialog.c
+++ b/src/grouplistdialog.c
@@ -565,6 +565,7 @@ static gboolean button_press_cb(GtkCMCTree *ctree, GdkEventButton *button,
 
 	if (button->type != GDK_BUTTON_PRESS) return TRUE;
 	if (button->button != 1) return TRUE;
+	if (button->window != GTK_CMCLIST(ctree)->clist_window) return TRUE;
 
 	if (!gtk_cmclist_get_selection_info(GTK_CMCLIST(ctree), 
 				     button->x, button->y, &row, &col))
diff --git a/src/gtk/gtkcmctree.h b/src/gtk/gtkcmctree.h
index 54a0235..07b8ea1 100644
--- a/src/gtk/gtkcmctree.h
+++ b/src/gtk/gtkcmctree.h
@@ -253,6 +253,10 @@ GList * gtk_cmctree_find_all_by_row_data_custom    (GtkCMCTree     *ctree,
 						  GtkCMCTreeNode *node,
 						  gpointer      data,
 						  GCompareFunc  func);
+
+/* This assumes that x and y coordinates are inside the clist_window.
+ * Returns true if the coordinates are inside a tree expander on
+ * one of the rows. */
 gboolean gtk_cmctree_is_hot_spot                   (GtkCMCTree     *ctree,
 					          gint          x,
 					          gint          y);
diff --git a/src/gtk/gtksctree.h b/src/gtk/gtksctree.h
index b310f96..79b4f2f 100644
--- a/src/gtk/gtksctree.h
+++ b/src/gtk/gtksctree.h
@@ -119,6 +119,10 @@ void gtk_sctree_set_column_tooltip	    (GtkSCTree		*sctree,
 void gtk_sctree_set_use_markup		    (GtkSCTree		*sctree,
 					     int		 column,
 					     gboolean		 markup);
+
+/* This assumes that x and y coordinates are inside the clist_window.
+ * Returns true if the coordinates are inside a tree expander on
+ * one of the rows. */
 gboolean
 gtk_sctree_is_hot_spot (GtkSCTree *ctree, 
 		       gint      x, 
diff --git a/src/summaryview.c b/src/summaryview.c
index 2bc9e05..e4976bf 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -6846,6 +6846,7 @@ static gboolean summary_button_pressed(GtkWidget *ctree, GdkEventButton *event,
 				       SummaryView *summaryview)
 {
 	if (!event) return FALSE;
+	if (event->window != GTK_CMCLIST(ctree)->clist_window) return FALSE;
 
 	if (event->button == 3) {
 		/* right clicked */

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list