diff --git a/src/ui/draw-workspace.c b/src/ui/draw-workspace.c index f43821ac8..590fa2d45 100644 --- a/src/ui/draw-workspace.c +++ b/src/ui/draw-workspace.c @@ -67,12 +67,11 @@ get_window_rect (const WnckWindowDisplayInfo *win, static void draw_window (GtkWidget *widget, - GdkDrawable *drawable, + cairo_t *cr, const WnckWindowDisplayInfo *win, const GdkRectangle *winrect, GtkStateType state) { - cairo_t *cr; GdkPixbuf *icon; int icon_x, icon_y, icon_w, icon_h; gboolean is_active; @@ -81,7 +80,8 @@ draw_window (GtkWidget *widget, is_active = win->is_active; - cr = gdk_cairo_create (drawable); + cairo_save (cr); + cairo_rectangle (cr, winrect->x, winrect->y, winrect->width, winrect->height); cairo_clip (cr); @@ -159,12 +159,12 @@ draw_window (GtkWidget *widget, MAX (0, winrect->width - 1), MAX (0, winrect->height - 1)); cairo_stroke (cr); - cairo_destroy (cr); + cairo_restore (cr); } void wnck_draw_workspace (GtkWidget *widget, - GdkDrawable *drawable, + cairo_t *cr, int x, int y, int width, @@ -180,7 +180,6 @@ wnck_draw_workspace (GtkWidget *widget, GdkRectangle workspace_rect; GtkStateType state; GtkStyle *style; - cairo_t *cr; workspace_rect.x = x; workspace_rect.y = y; @@ -195,8 +194,9 @@ wnck_draw_workspace (GtkWidget *widget, state = GTK_STATE_NORMAL; style = gtk_widget_get_style (widget); - cr = gdk_cairo_create (drawable); + cairo_save (cr); + if (workspace_background) { gdk_cairo_set_source_pixbuf (cr, workspace_background, x, y); @@ -209,8 +209,6 @@ wnck_draw_workspace (GtkWidget *widget, cairo_fill (cr); } - cairo_destroy (cr); - i = 0; while (i < n_windows) { @@ -221,11 +219,14 @@ wnck_draw_workspace (GtkWidget *widget, screen_height, &workspace_rect, &winrect); draw_window (widget, - drawable, + cr, win, &winrect, state); ++i; } + + cairo_restore (cr); + } diff --git a/src/ui/draw-workspace.h b/src/ui/draw-workspace.h index 10018aa88..7aa04918f 100644 --- a/src/ui/draw-workspace.h +++ b/src/ui/draw-workspace.h @@ -46,7 +46,7 @@ typedef struct } WnckWindowDisplayInfo; void wnck_draw_workspace (GtkWidget *widget, - GdkDrawable *drawable, + cairo_t *cr, int x, int y, int width, diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c index a7c1ee57b..face14c5a 100644 --- a/src/ui/tabpopup.c +++ b/src/ui/tabpopup.c @@ -957,8 +957,10 @@ meta_select_workspace_expose_event (GtkWidget *widget, window = gtk_widget_get_window (widget); gtk_widget_get_allocation (widget, &allocation); + cr = gdk_cairo_create (window); + wnck_draw_workspace (widget, - window, + cr, SELECT_OUTLINE_WIDTH, SELECT_OUTLINE_WIDTH, allocation.width - SELECT_OUTLINE_WIDTH * 2, @@ -975,7 +977,6 @@ meta_select_workspace_expose_event (GtkWidget *widget, if (META_SELECT_WORKSPACE (widget)->selected) { style = gtk_widget_get_style (widget); - cr = gdk_cairo_create (window); gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]); @@ -986,10 +987,10 @@ meta_select_workspace_expose_event (GtkWidget *widget, allocation.width - SELECT_OUTLINE_WIDTH, allocation.height - SELECT_OUTLINE_WIDTH); cairo_stroke (cr); - - cairo_destroy (cr); } + cairo_destroy (cr); + return TRUE; }