mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
ui: Port draw_workspace() to take a cairo_t
https://bugzilla.gnome.org/show_bug.cgi?id=630203
This commit is contained in:
parent
1083a4c0b7
commit
1c31e8ffc2
@ -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);
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ typedef struct
|
||||
} WnckWindowDisplayInfo;
|
||||
|
||||
void wnck_draw_workspace (GtkWidget *widget,
|
||||
GdkDrawable *drawable,
|
||||
cairo_t *cr,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user