mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 20:12:06 +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
|
static void
|
||||||
draw_window (GtkWidget *widget,
|
draw_window (GtkWidget *widget,
|
||||||
GdkDrawable *drawable,
|
cairo_t *cr,
|
||||||
const WnckWindowDisplayInfo *win,
|
const WnckWindowDisplayInfo *win,
|
||||||
const GdkRectangle *winrect,
|
const GdkRectangle *winrect,
|
||||||
GtkStateType state)
|
GtkStateType state)
|
||||||
{
|
{
|
||||||
cairo_t *cr;
|
|
||||||
GdkPixbuf *icon;
|
GdkPixbuf *icon;
|
||||||
int icon_x, icon_y, icon_w, icon_h;
|
int icon_x, icon_y, icon_w, icon_h;
|
||||||
gboolean is_active;
|
gboolean is_active;
|
||||||
@ -81,7 +80,8 @@ draw_window (GtkWidget *widget,
|
|||||||
|
|
||||||
is_active = win->is_active;
|
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_rectangle (cr, winrect->x, winrect->y, winrect->width, winrect->height);
|
||||||
cairo_clip (cr);
|
cairo_clip (cr);
|
||||||
|
|
||||||
@ -159,12 +159,12 @@ draw_window (GtkWidget *widget,
|
|||||||
MAX (0, winrect->width - 1), MAX (0, winrect->height - 1));
|
MAX (0, winrect->width - 1), MAX (0, winrect->height - 1));
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
|
|
||||||
cairo_destroy (cr);
|
cairo_restore (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wnck_draw_workspace (GtkWidget *widget,
|
wnck_draw_workspace (GtkWidget *widget,
|
||||||
GdkDrawable *drawable,
|
cairo_t *cr,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int width,
|
int width,
|
||||||
@ -180,7 +180,6 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
GdkRectangle workspace_rect;
|
GdkRectangle workspace_rect;
|
||||||
GtkStateType state;
|
GtkStateType state;
|
||||||
GtkStyle *style;
|
GtkStyle *style;
|
||||||
cairo_t *cr;
|
|
||||||
|
|
||||||
workspace_rect.x = x;
|
workspace_rect.x = x;
|
||||||
workspace_rect.y = y;
|
workspace_rect.y = y;
|
||||||
@ -195,7 +194,8 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
state = GTK_STATE_NORMAL;
|
state = GTK_STATE_NORMAL;
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
style = gtk_widget_get_style (widget);
|
||||||
cr = gdk_cairo_create (drawable);
|
|
||||||
|
cairo_save (cr);
|
||||||
|
|
||||||
if (workspace_background)
|
if (workspace_background)
|
||||||
{
|
{
|
||||||
@ -209,8 +209,6 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_destroy (cr);
|
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < n_windows)
|
while (i < n_windows)
|
||||||
{
|
{
|
||||||
@ -221,11 +219,14 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
screen_height, &workspace_rect, &winrect);
|
screen_height, &workspace_rect, &winrect);
|
||||||
|
|
||||||
draw_window (widget,
|
draw_window (widget,
|
||||||
drawable,
|
cr,
|
||||||
win,
|
win,
|
||||||
&winrect,
|
&winrect,
|
||||||
state);
|
state);
|
||||||
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cairo_restore (cr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ typedef struct
|
|||||||
} WnckWindowDisplayInfo;
|
} WnckWindowDisplayInfo;
|
||||||
|
|
||||||
void wnck_draw_workspace (GtkWidget *widget,
|
void wnck_draw_workspace (GtkWidget *widget,
|
||||||
GdkDrawable *drawable,
|
cairo_t *cr,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int width,
|
int width,
|
||||||
|
@ -957,8 +957,10 @@ meta_select_workspace_expose_event (GtkWidget *widget,
|
|||||||
window = gtk_widget_get_window (widget);
|
window = gtk_widget_get_window (widget);
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
|
|
||||||
|
cr = gdk_cairo_create (window);
|
||||||
|
|
||||||
wnck_draw_workspace (widget,
|
wnck_draw_workspace (widget,
|
||||||
window,
|
cr,
|
||||||
SELECT_OUTLINE_WIDTH,
|
SELECT_OUTLINE_WIDTH,
|
||||||
SELECT_OUTLINE_WIDTH,
|
SELECT_OUTLINE_WIDTH,
|
||||||
allocation.width - SELECT_OUTLINE_WIDTH * 2,
|
allocation.width - SELECT_OUTLINE_WIDTH * 2,
|
||||||
@ -975,7 +977,6 @@ meta_select_workspace_expose_event (GtkWidget *widget,
|
|||||||
if (META_SELECT_WORKSPACE (widget)->selected)
|
if (META_SELECT_WORKSPACE (widget)->selected)
|
||||||
{
|
{
|
||||||
style = gtk_widget_get_style (widget);
|
style = gtk_widget_get_style (widget);
|
||||||
cr = gdk_cairo_create (window);
|
|
||||||
|
|
||||||
gdk_cairo_set_source_color (cr,
|
gdk_cairo_set_source_color (cr,
|
||||||
&style->fg[gtk_widget_get_state (widget)]);
|
&style->fg[gtk_widget_get_state (widget)]);
|
||||||
@ -986,10 +987,10 @@ meta_select_workspace_expose_event (GtkWidget *widget,
|
|||||||
allocation.width - SELECT_OUTLINE_WIDTH,
|
allocation.width - SELECT_OUTLINE_WIDTH,
|
||||||
allocation.height - SELECT_OUTLINE_WIDTH);
|
allocation.height - SELECT_OUTLINE_WIDTH);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
|
|
||||||
cairo_destroy (cr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cairo_destroy (cr);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user