summaryrefslogtreecommitdiff
path: root/gtk/gtkhandlebox.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-06-17 03:34:22 +0000
committerArturo Espinosa <unammx@src.gnome.org>1998-06-17 03:34:22 +0000
commited1e531c3643784c16b338e64310c086323d6e45 (patch)
treeec14a0904da72345db019096fba0c3e2cb81fbfc /gtk/gtkhandlebox.c
parentb7f7f3d98d3ece10978d38b7a120022d91f3c12f (diff)
downloadgdk-pixbuf-ed1e531c3643784c16b338e64310c086323d6e45.tar.gz
Now accepts an extra "clip" parameter, which is the clipping rectangle to
1998-06-16 Federico Mena Quintero <federico@nuclecu.unam.mx> * gtk/gtkhandlebox.c (draw_textured_frame): Now accepts an extra "clip" parameter, which is the clipping rectangle to use. This eliminates the extremely annoying flicker when exposing parts of the handlebox.
Diffstat (limited to 'gtk/gtkhandlebox.c')
-rw-r--r--gtk/gtkhandlebox.c69
1 files changed, 37 insertions, 32 deletions
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
index dc45477ce..6a9e6ece8 100644
--- a/gtk/gtkhandlebox.c
+++ b/gtk/gtkhandlebox.c
@@ -611,44 +611,49 @@ gtk_handle_box_draw_ghost (GtkHandleBox *hb)
}
static void
-draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow)
+draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, GtkShadowType shadow,
+ GdkRectangle *clip)
{
int x, y;
int xthick, ythick;
GdkGC *light_gc, *dark_gc;
+ GdkRectangle dest;
- gdk_draw_rectangle (window,
- widget->style->bg_gc[GTK_STATE_NORMAL],
- TRUE,
- rect->x, rect->y,
- rect->width, rect->height);
-
- light_gc = widget->style->light_gc[GTK_STATE_NORMAL];
- dark_gc = widget->style->dark_gc[GTK_STATE_NORMAL];
-
- xthick = widget->style->klass->xthickness;
- ythick = widget->style->klass->ythickness;
-
- gdk_gc_set_clip_rectangle (light_gc, rect);
- gdk_gc_set_clip_rectangle (dark_gc, rect);
-
- for (y = rect->y + ythick; y < (rect->y + rect->height - ythick); y += 3)
- for (x = rect->x + xthick; x < (rect->x + rect->width - xthick); x += 6)
- {
- gdk_draw_point (window, light_gc, x, y);
- gdk_draw_point (window, dark_gc, x + 1, y + 1);
-
- gdk_draw_point (window, light_gc, x + 3, y + 1);
- gdk_draw_point (window, dark_gc, x + 4, y + 2);
- }
+ if (gdk_rectangle_intersect (rect, clip, &dest))
+ {
+ gdk_draw_rectangle (window,
+ widget->style->bg_gc[GTK_STATE_NORMAL],
+ TRUE,
+ dest.x, dest.y,
+ dest.width, dest.height);
+
+ light_gc = widget->style->light_gc[GTK_STATE_NORMAL];
+ dark_gc = widget->style->dark_gc[GTK_STATE_NORMAL];
+
+ xthick = widget->style->klass->xthickness;
+ ythick = widget->style->klass->ythickness;
+
+ gdk_gc_set_clip_rectangle (light_gc, &dest);
+ gdk_gc_set_clip_rectangle (dark_gc, &dest);
+
+ for (y = rect->y + ythick; y < (rect->y + rect->height - ythick); y += 3)
+ for (x = rect->x + xthick; x < (rect->x + rect->width - xthick); x += 6)
+ {
+ gdk_draw_point (window, light_gc, x, y);
+ gdk_draw_point (window, dark_gc, x + 1, y + 1);
+
+ gdk_draw_point (window, light_gc, x + 3, y + 1);
+ gdk_draw_point (window, dark_gc, x + 4, y + 2);
+ }
- gdk_gc_set_clip_rectangle (light_gc, NULL);
- gdk_gc_set_clip_rectangle (dark_gc, NULL);
+ gdk_gc_set_clip_rectangle (light_gc, NULL);
+ gdk_gc_set_clip_rectangle (dark_gc, NULL);
- gtk_draw_shadow (widget->style, window,
- GTK_STATE_NORMAL, shadow,
- rect->x, rect->y,
- rect->width, rect->height);
+ gtk_draw_shadow (widget->style, window,
+ GTK_STATE_NORMAL, shadow,
+ rect->x, rect->y,
+ rect->width, rect->height);
+ }
}
static void
@@ -706,7 +711,7 @@ gtk_handle_box_paint (GtkWidget *widget,
rect.width = (hb->handle_position == GTK_POS_LEFT) ? DRAG_HANDLE_SIZE : width;
rect.height = (hb->handle_position == GTK_POS_TOP) ? DRAG_HANDLE_SIZE : height;
- draw_textured_frame (widget, hb->bin_window, &rect, GTK_SHADOW_OUT);
+ draw_textured_frame (widget, hb->bin_window, &rect, GTK_SHADOW_OUT, event ? &event->area : area);
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
{