Commit d30343b9 authored by Owen Taylor's avatar Owen Taylor

gdk/gdkgc.c: If gdk_gc_set_clip_rectangle is called with

  rectangle = NULL, remove clip mask, instead of segfaulting.
gtk/gtknotebook.c: Set clip mask before redrawing, so that
  we don't overwrite things outside of exposed areas when
  drawing the shadows. (Based on a patch from
  Lars Hamann <hamann@braunschweig.netsurf.de> and Stefan Jeske)

                                        -owt
parent 30e8968f
......@@ -535,13 +535,18 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
private = (GdkGCPrivate*) gc;
xrectangle.x = rectangle->x;
xrectangle.y = rectangle->y;
xrectangle.width = rectangle->width;
xrectangle.height = rectangle->height;
XSetClipRectangles (private->xdisplay, private->xgc, 0, 0,
&xrectangle, 1, Unsorted);
if (rectangle)
{
xrectangle.x = rectangle->x;
xrectangle.y = rectangle->y;
xrectangle.width = rectangle->width;
xrectangle.height = rectangle->height;
XSetClipRectangles (private->xdisplay, private->xgc, 0, 0,
&xrectangle, 1, Unsorted);
}
else
XSetClipMask (private->xdisplay, private->xgc, None);
}
void
......
......@@ -51,6 +51,9 @@ static void gtk_notebook_foreach (GtkContainer *container,
gpointer callback_data);
static void gtk_notebook_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page);
static void gtk_notebook_set_clip_rect (GtkNotebook *notebook,
GtkStateType state_type,
GdkRectangle *area);
static void gtk_notebook_draw_tab (GtkNotebook *notebook,
GtkNotebookPage *page,
GdkRectangle *area);
......@@ -735,6 +738,11 @@ gtk_notebook_paint (GtkWidget *widget,
{
notebook = GTK_NOTEBOOK (widget);
/* Set the clip rectangle here, so we don't overwrite things
* outside of exposed area when drawing shadows */
gtk_notebook_set_clip_rect (notebook, GTK_STATE_ACTIVE, area);
gtk_notebook_set_clip_rect (notebook, GTK_STATE_NORMAL, area);
gdk_window_clear_area (widget->window,
area->x, area->y,
area->width, area->height);
......@@ -866,6 +874,9 @@ gtk_notebook_paint (GtkWidget *widget,
x, y, width, height);
}
}
gtk_notebook_set_clip_rect (notebook, GTK_STATE_ACTIVE, NULL);
gtk_notebook_set_clip_rect (notebook, GTK_STATE_NORMAL, NULL);
}
}
......@@ -940,7 +951,6 @@ gtk_notebook_button_press (GtkWidget *widget,
while (children)
{
page = children->data;
children = children->next;
if (GTK_WIDGET_VISIBLE (page->child) &&
(event->x >= page->allocation.x) &&
......@@ -951,6 +961,7 @@ gtk_notebook_button_press (GtkWidget *widget,
gtk_notebook_switch_page (notebook, page);
break;
}
children = children->next;
}
return FALSE;
......@@ -1060,6 +1071,19 @@ gtk_notebook_switch_page (GtkNotebook *notebook,
}
}
static void
gtk_notebook_set_clip_rect (GtkNotebook *notebook,
GtkStateType state_type,
GdkRectangle *area)
{
GtkWidget *widget = GTK_WIDGET (notebook);
gdk_gc_set_clip_rectangle (widget->style->bg_gc[state_type], area);
gdk_gc_set_clip_rectangle (widget->style->light_gc[state_type], area);
gdk_gc_set_clip_rectangle (widget->style->dark_gc[state_type], area);
gdk_gc_set_clip_rectangle (widget->style->black_gc, area);
}
static void
gtk_notebook_draw_tab (GtkNotebook *notebook,
GtkNotebookPage *page,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment