Erasing bug in GTK examples/gtkdial



    The pointer in examples/gtkdial (gtk+-1.2.6 through gtk+-snap20000810,
at least) doesn't erase completely when moved.  This is due to two
bugs in the widget's code, gtkdial.c .

    A fix for both is below.  The added comment explains the first.
The second changes the 'fill' argument of the gtk_draw_polygon() that
does the erasing to match that used for drawing (TRUE, i.e., filled).

Bruce Jerrick
Portland, Oregon, USA
email:   bjerrick easystreet com


--- examples/gtkdial/gtkdial.c.0	Fri Aug 18 05:29:10 2000
+++ examples/gtkdial/gtkdial.c	Wed Oct 11 23:48:58 2000
@@ -322,21 +322,26 @@
   points[4].y = points[0].y;
 
   blankstyle = gtk_style_new ();
+  /*
+   * Use bg_gc for all gc's used by gtk_default_draw_polygon()
+   *  (bg_gc, dark_gc, light_gc, black_gc).
+   * Widget's style was set using GTK_STATE_ACTIVE, so use that bg_gc.
+   */
   blankstyle->bg_gc[GTK_STATE_NORMAL] =
-                widget->style->bg_gc[GTK_STATE_NORMAL];
+                widget->style->bg_gc[GTK_STATE_ACTIVE];
   blankstyle->dark_gc[GTK_STATE_NORMAL] =
-                widget->style->bg_gc[GTK_STATE_NORMAL];
+                widget->style->bg_gc[GTK_STATE_ACTIVE];
   blankstyle->light_gc[GTK_STATE_NORMAL] =
-                widget->style->bg_gc[GTK_STATE_NORMAL];
+                widget->style->bg_gc[GTK_STATE_ACTIVE];
   blankstyle->black_gc =
-                widget->style->bg_gc[GTK_STATE_NORMAL];
+                widget->style->bg_gc[GTK_STATE_ACTIVE];
 
   gtk_draw_polygon (blankstyle,
                     widget->window,
                     GTK_STATE_NORMAL,
                     GTK_SHADOW_OUT,
                     points, 5,
-                    FALSE);
+                    TRUE);
 
   gtk_style_unref(blankstyle);
 





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