[Commits] gtkcmclist.c 1.1.2.21 1.1.2.22 gtkcmctree.c 1.1.2.22 1.1.2.23

colin at claws-mail.org colin at claws-mail.org
Tue Oct 25 21:28:06 CEST 2011


Update of /home/claws-mail/claws/src/gtk
In directory claws-mail:/tmp/cvs-serv3858/src/gtk

Modified Files:
      Tag: gtk2
	gtkcmclist.c gtkcmctree.c 
Log Message:
2011-10-25 [colin]	3.7.10cvs52

	* src/gtk/gtkcmclist.c
	* src/gtk/gtkcmctree.c
		Fix focus things.

Index: gtkcmclist.c
===================================================================
RCS file: /home/claws-mail/claws/src/gtk/Attic/gtkcmclist.c,v
retrieving revision 1.1.2.21
retrieving revision 1.1.2.22
diff -u -d -r1.1.2.21 -r1.1.2.22
--- gtkcmclist.c	25 Oct 2011 06:11:12 -0000	1.1.2.21
+++ gtkcmclist.c	25 Oct 2011 19:28:04 -0000	1.1.2.22
@@ -5861,16 +5861,16 @@
       gtk_widget_get_can_focus (widget) && gtk_widget_has_focus(widget))
     {
       if (!area) {
-	cairo_rectangle(cr, row_rectangle.x + 1, row_rectangle.y,
-			    row_rectangle.width - 1, row_rectangle.height);
+	cairo_rectangle(cr, row_rectangle.x, row_rectangle.y,
+			    row_rectangle.width + 1, row_rectangle.height);
 	gdk_cairo_set_source_color(cr, &style->fg[GTK_STATE_NORMAL]);
 	cairo_stroke(cr);
       }
       else if (gdk_rectangle_intersect (area, &row_rectangle,
 					&intersect_rectangle))
 	{
-	  cairo_rectangle(cr, row_rectangle.x + 1, row_rectangle.y,
-			    row_rectangle.width - 1, row_rectangle.height);
+	  cairo_rectangle(cr, row_rectangle.x, row_rectangle.y,
+			    row_rectangle.width + 1, row_rectangle.height);
 	  gdk_cairo_set_source_color(cr, &style->fg[GTK_STATE_NORMAL]);
 	  cairo_stroke(cr);
 	}
@@ -5929,11 +5929,19 @@
 
   if (!area) {
     int w, h, y;
-    gdk_drawable_get_size (GDK_DRAWABLE (clist->clist_window), &w, &h);
+    cairo_t *cr;
+#if GTK_CHECK_VERSION(2,24,0)
+    w = gdk_window_get_width(clist->clist_window);
+    h = gdk_window_get_height(clist->clist_window);
+#else
+    gdk_drawable_get_size(clist->clist_window, &w, &h);
+#endif
+    cr = gdk_cairo_create(clist->clist_window);
     y = ROW_TOP_YPIXEL (clist, i);
-    gdk_window_clear_area (clist->clist_window,
-                           0, y,
-                           w, h - y);
+    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);
   }
 }
 
@@ -6239,18 +6247,19 @@
   if (gtk_widget_is_drawable (GTK_WIDGET(clist)))
     {
       GtkWidget *focus_child = gtk_container_get_focus_child (container);
+ 
+      gdk_window_scroll (clist->clist_window, dx, 0);
+      gdk_window_process_updates (clist->clist_window, FALSE);
+
       if (gtk_widget_get_can_focus(GTK_WIDGET(clist)) && 
           gtk_widget_has_focus(GTK_WIDGET(clist)) &&
           !focus_child && GTK_CMCLIST_ADD_MODE(clist))
         {
           y = ROW_TOP_YPIXEL (clist, clist->focus_row);
-	  cairo_rectangle(cr, 0, y, clist->clist_window_width - 1,
-                              clist->row_height - 1);
+	  cairo_rectangle(cr, 0, y, clist->clist_window_width + 1,
+                              clist->row_height);
 	  cairo_stroke(cr);
         }
- 
-      gdk_window_scroll (clist->clist_window, dx, 0);
-      gdk_window_process_updates (clist->clist_window, FALSE);
 
       if (gtk_widget_get_can_focus(GTK_WIDGET(clist)) && 
           gtk_widget_has_focus(GTK_WIDGET(clist)) &&
@@ -6265,35 +6274,11 @@
               draw_rows (clist, &area);
               clist->focus_row = focus_row;
 	  
-	      cairo_rectangle(cr, 0, y, clist->clist_window_width - 1,
-                              clist->row_height - 1);
+	      cairo_rectangle(cr, 0, y, clist->clist_window_width + 1,
+                              clist->row_height);
 	      cairo_stroke(cr);
               return;
             }
-          else if (ABS(dx) < clist->clist_window_width - 1)
-            {
-              gint x0;
-              gint x1;
-	  
-              if (dx > 0)
-                {
-                  x0 = clist->clist_window_width - 1;
-                  x1 = dx;
-                }
-              else
-                {
-                  x0 = 0;
-                  x1 = clist->clist_window_width - 1 + dx;
-                }
-
-              y = ROW_TOP_YPIXEL (clist, clist->focus_row);
-	      cairo_move_to(cr, x0, y + 1);
-	      cairo_line_to(cr, x0, y + clist->row_height - 2);
-	      cairo_stroke(cr);
-	      cairo_move_to(cr, x1, y + 1);
-	      cairo_line_to(cr, x1, y + clist->row_height - 2);
-	      cairo_stroke(cr);
-            }
         }
     }
     cairo_destroy(cr);
@@ -6556,8 +6541,8 @@
     cairo_dash_from_add_mode(clist, cr);
     cairo_set_line_width(cr, 1.0);
     cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
-    cairo_rectangle(cr, 1, ROW_TOP_YPIXEL(clist, clist->focus_row),
-			clist->clist_window_width - 1,
+    cairo_rectangle(cr, 0, ROW_TOP_YPIXEL(clist, clist->focus_row),
+			clist->clist_window_width + 1,
 			clist->row_height);
     cairo_stroke(cr);
     cairo_destroy(cr);
@@ -6568,17 +6553,32 @@
 gtk_cmclist_undraw_focus (GtkWidget *widget)
 {
   GtkCMCList *clist;
-
+  int row;
   cm_return_if_fail (GTK_IS_CMCLIST (widget));
 
+  clist = GTK_CMCLIST(widget);
+
+  if (clist->focus_row < 0)
+    return;
+
   if (!gtk_widget_is_drawable (widget) || !gtk_widget_get_can_focus (widget))
     return;
 
   clist = GTK_CMCLIST (widget);
   if (clist->focus_row >= 0) {
-    GTK_CMCLIST_GET_CLASS(clist)->draw_row(clist, NULL, clist->focus_row, 
-	ROW_ELEMENT (clist, clist->focus_row)->data);
+    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),
+			clist->clist_window_width + 1,
+			clist->row_height);
+    cairo_stroke(cr);
+    cairo_destroy(cr);
   }
+
+  row = clist->focus_row;
+  GTK_CMCLIST_GET_CLASS(GTK_CMCLIST(widget))->draw_row(clist, NULL, row, ROW_ELEMENT (clist, row)->data);
 }
 
 static gint

Index: gtkcmctree.c
===================================================================
RCS file: /home/claws-mail/claws/src/gtk/Attic/gtkcmctree.c,v
retrieving revision 1.1.2.22
retrieving revision 1.1.2.23
diff -u -d -r1.1.2.22 -r1.1.2.23
--- gtkcmctree.c	23 Oct 2011 22:22:19 -0000	1.1.2.22
+++ gtkcmctree.c	25 Oct 2011 19:28:04 -0000	1.1.2.23
@@ -638,7 +638,7 @@
   static GdkColor greybg={0, 0, 0, 0};
   static gboolean color_change = TRUE;
   cairo_t *cr;
-  GdkColor *fgcolor, *bgcolor, *focuscolor;
+  GdkColor *fgcolor, *bgcolor;
 
   cm_return_if_fail (clist != NULL);
   widget = GTK_WIDGET (clist);
@@ -700,10 +700,8 @@
   if (prefs_common.use_stripes_everywhere && GTK_SCTREE(ctree)->show_stripes
       && color_change && row % 2) {
     bgcolor = &greybg;
-    focuscolor = &greybg;
   } else {
     bgcolor = &style->base[GTK_STATE_NORMAL];
-    focuscolor = &style->base[GTK_STATE_NORMAL];
   }
   state = clist_row->state;
 
@@ -716,7 +714,7 @@
       crect = &intersect_rectangle;
 
       if (gdk_rectangle_intersect (area, &cell_rectangle, crect)) {
-        gdk_cairo_rectangle(cr, crect);
+        gdk_cairo_rectangle(cr, &cell_rectangle);
 	gdk_cairo_set_source_color(cr, &style->base[GTK_STATE_NORMAL]);
 	cairo_fill(cr);
       }
@@ -726,7 +724,7 @@
       rect = &clip_rectangle;
       crect = &cell_rectangle;
 
-      gdk_cairo_rectangle(cr, crect);
+      gdk_cairo_rectangle(cr, &cell_rectangle);
       gdk_cairo_set_source_color(cr, &style->base[GTK_STATE_NORMAL]);
       cairo_fill(cr);
     }
@@ -780,12 +778,6 @@
       pixbuf_width = 0;
       height = 0;
 
-          gdk_cairo_rectangle(cr, &cell_rectangle);
-	  if (state == GTK_STATE_NORMAL)
-		gdk_cairo_set_source_color(cr, bgcolor);
-	  else
-		gdk_cairo_set_source_color(cr, &style->base[state]);
-	  cairo_fill(cr);
       if (area && !gdk_rectangle_intersect (area, &cell_rectangle,
 					    &intersect_rectangle))
 	{
@@ -794,6 +786,13 @@
 	}
       else
 	{
+	  gdk_cairo_rectangle(cr, &cell_rectangle);
+	  if (state == GTK_STATE_NORMAL)
+		gdk_cairo_set_source_color(cr, bgcolor);
+	  else
+		gdk_cairo_set_source_color(cr, &style->base[state]);
+	  cairo_fill(cr);
+
 	  layout = create_cell_layout (clist, clist_row, i);
 	  if (layout)
 	    {
@@ -954,6 +953,22 @@
           g_object_unref (G_OBJECT (layout));
 	}
     }
+   /* draw focus rectangle */
+  if (clist->focus_row == row &&
+      gtk_widget_get_can_focus (widget) && gtk_widget_has_focus (widget))
+    {
+      if (!area || gdk_rectangle_intersect (area, &row_rectangle,
+					&intersect_rectangle))
+	{
+	    cairo_set_line_width(cr, 1.0);
+	    cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
+	    gdk_cairo_set_source_color(cr, &style->fg[GTK_STATE_NORMAL]);
+	    cairo_rectangle(cr, row_rectangle.x, row_rectangle.y,
+			      row_rectangle.width + 1,
+			      row_rectangle.height);
+	    cairo_stroke(cr);
+	}
+     }
     cairo_destroy(cr);
 }
 



More information about the Commits mailing list