[Commits] [SCM] claws branch, gtk3, updated. 3.99.0-73-g31d6518f5

paul at claws-mail.org paul at claws-mail.org
Wed Apr 14 14:04:26 CEST 2021


The branch, gtk3 has been updated
       via  31d6518f57b8a5a42e2c0c6d2381e589658a64c2 (commit)
      from  6417ca7fcb7ed8be27cd4226f8ce270e30745e80 (commit)

Summary of changes:
 src/gtk/gtkcmclist.c | 78 +++++++++++++++++++++++++++++++++-------------------
 src/gtk/gtkcmclist.h |  1 +
 src/gtk/gtkcmctree.c |  6 ++++
 3 files changed, 56 insertions(+), 29 deletions(-)


- Log -----------------------------------------------------------------
commit 31d6518f57b8a5a42e2c0c6d2381e589658a64c2
Author: paul <paul at claws-mail.org>
Date:   Wed Apr 14 13:04:22 2021 +0100

    fix bug 4366, 'On Wayland, selecting a message list row does not immediately highlight the row'
    
    based on patch by Manuel Stoeckl

diff --git a/src/gtk/gtkcmclist.c b/src/gtk/gtkcmclist.c
index daf1b0fdc..f27d78647 100644
--- a/src/gtk/gtkcmclist.c
+++ b/src/gtk/gtkcmclist.c
@@ -1124,6 +1124,8 @@ gtk_cmclist_constructor (GType                  type,
    * isn't there
    */
   column_button_create (clist, 0);
+
+  clist->draw_now = 1;
   
   return object;
 }
@@ -4797,6 +4799,7 @@ gtk_cmclist_draw (GtkWidget *widget,
   if (gtk_widget_is_drawable (widget))
     {
       clist = GTK_CMCLIST (widget);
+      clist->draw_now = 0;
 
       /* Draw clist_window */
       if (gtk_cairo_should_draw_window (cr, clist->clist_window))
@@ -4855,8 +4858,8 @@ gtk_cmclist_draw (GtkWidget *widget,
               }
             }
         }
+       clist->draw_now = 1;
     }
-
   return FALSE;
 }
 
@@ -5668,6 +5671,11 @@ draw_row (GtkCMCList     *clist,
   cairo_t *cr;
   cm_return_if_fail (clist != NULL);
 
+  if (clist->draw_now) {
+      gtk_widget_queue_draw(clist);
+      return;
+  }
+
   /* bail now if we arn't drawable yet */
   if (!gtk_widget_is_drawable (GTK_WIDGET(clist)) || row < 0 || row >= clist->rows)
     return;
@@ -5948,16 +5956,20 @@ draw_rows (GtkCMCList     *clist,
     }
 
   if (!area) {
-    int w, h, y;
-    cairo_t *cr;
-    w = gdk_window_get_width(clist->clist_window);
-    h = gdk_window_get_height(clist->clist_window);
-    cr = gdk_cairo_create(clist->clist_window);
-    y = ROW_TOP_YPIXEL (clist, i);
-    gdk_cairo_set_source_color(cr, &gtk_widget_get_style(GTK_WIDGET(clist))->base[GTK_STATE_NORMAL]);
-    cairo_rectangle(cr, 0, y, w, h - y);
-    cairo_fill(cr);
-    cairo_destroy(cr);
+    if (!clist->draw_now) {
+      int w, h, y;
+      cairo_t *cr;
+      w = gdk_window_get_width(clist->clist_window);
+      h = gdk_window_get_height(clist->clist_window);
+      cr = gdk_cairo_create(clist->clist_window);
+      y = ROW_TOP_YPIXEL (clist, i);
+      gdk_cairo_set_source_color(cr, &gtk_widget_get_style(GTK_WIDGET(clist))->base[GTK_STATE_NORMAL]);
+      cairo_rectangle(cr, 0, y, w, h - y);
+      cairo_fill(cr);
+      cairo_destroy(cr);
+    } else {
+      gtk_widget_queue_draw(clist);
+    }
   }
 }
 
@@ -6521,15 +6533,19 @@ gtk_cmclist_draw_focus (GtkWidget *widget)
 
   clist = GTK_CMCLIST (widget);
   if (clist->focus_row >= 0) {
-    cr = gdk_cairo_create(clist->clist_window);
-    cairo_dash_from_add_mode(clist, cr);
-    cairo_set_line_width(cr, 1.0);
-    cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
-    cairo_rectangle(cr, 0, ROW_TOP_YPIXEL(clist, clist->focus_row) + 0.5,
-			clist->clist_window_width + 1,
-			clist->row_height - 0.5);
-    cairo_stroke(cr);
-    cairo_destroy(cr);
+    if (!clist->draw_now) {
+      cr = gdk_cairo_create(clist->clist_window);
+      cairo_dash_from_add_mode(clist, cr);
+      cairo_set_line_width(cr, 1.0);
+      cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
+      cairo_rectangle(cr, 0, ROW_TOP_YPIXEL(clist, clist->focus_row) + 0.5,
+              clist->clist_window_width + 1,
+              clist->row_height - 0.5);
+      cairo_stroke(cr);
+      cairo_destroy(cr);
+    } else {
+      gtk_widget_queue_draw(clist);
+    }
   }
 }
 
@@ -6550,15 +6566,19 @@ gtk_cmclist_undraw_focus (GtkWidget *widget)
 
   clist = GTK_CMCLIST (widget);
   if (clist->focus_row >= 0) {
-    cairo_t *cr = gdk_cairo_create(clist->clist_window);
-    cairo_set_line_width(cr, 1.0);
-    gdk_cairo_set_source_color(cr, &gtk_widget_get_style(widget)->base[GTK_STATE_NORMAL]);
-    cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
-    cairo_rectangle(cr, 0, ROW_TOP_YPIXEL(clist, clist->focus_row) + 0.5,
-			clist->clist_window_width + 1,
-			clist->row_height - 0.5);
-    cairo_stroke(cr);
-    cairo_destroy(cr);
+    if (!clist->draw_now) {
+      cairo_t *cr = gdk_cairo_create(clist->clist_window);
+      cairo_set_line_width(cr, 1.0);
+      gdk_cairo_set_source_color(cr, &gtk_widget_get_style(widget)->base[GTK_STATE_NORMAL]);
+      cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
+      cairo_rectangle(cr, 0, ROW_TOP_YPIXEL(clist, clist->focus_row) + 0.5,
+              clist->clist_window_width + 1,
+              clist->row_height - 0.5);
+      cairo_stroke(cr);
+      cairo_destroy(cr);
+    } else {
+      gtk_widget_queue_draw(clist);
+    }
   }
 
   row = clist->focus_row;
diff --git a/src/gtk/gtkcmclist.h b/src/gtk/gtkcmclist.h
index ea2de3d2b..07a3a47b3 100644
--- a/src/gtk/gtkcmclist.h
+++ b/src/gtk/gtkcmclist.h
@@ -235,6 +235,7 @@ struct _GtkCMCList
 
   gint drag_highlight_row;
   GtkCMCListDragPos drag_highlight_pos;
+  int draw_now;
 };
 
 struct _GtkCMCListClass
diff --git a/src/gtk/gtkcmctree.c b/src/gtk/gtkcmctree.c
index 69580d525..78e3ddab6 100644
--- a/src/gtk/gtkcmctree.c
+++ b/src/gtk/gtkcmctree.c
@@ -602,6 +602,12 @@ draw_row (GtkCMCList     *clist,
   GdkColor *fgcolor, *bgcolor;
 
   cm_return_if_fail (clist != NULL);
+
+  if (clist->draw_now) {
+      gtk_widget_queue_draw(GTK_WIDGET (clist));
+      return;
+  }
+
   widget = GTK_WIDGET (clist);
 
   /* if the function is passed the pointer to the row instead of null,

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list