mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
draw-workspace: Update to current GTK style API
Move from GtkStyle to GtkStyleContext. https://bugzilla.gnome.org/show_bug.cgi?id=650586
This commit is contained in:
parent
f8d900c3ea
commit
03457029f7
@ -26,6 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "draw-workspace.h"
|
#include "draw-workspace.h"
|
||||||
|
#include "theme-private.h"
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -70,13 +71,13 @@ draw_window (GtkWidget *widget,
|
|||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
const WnckWindowDisplayInfo *win,
|
const WnckWindowDisplayInfo *win,
|
||||||
const GdkRectangle *winrect,
|
const GdkRectangle *winrect,
|
||||||
GtkStateType state)
|
GtkStateFlags state)
|
||||||
{
|
{
|
||||||
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;
|
||||||
GdkColor *color;
|
GdkRGBA color;
|
||||||
GtkStyle *style;
|
GtkStyleContext *style;
|
||||||
|
|
||||||
is_active = win->is_active;
|
is_active = win->is_active;
|
||||||
|
|
||||||
@ -85,15 +86,12 @@ draw_window (GtkWidget *widget,
|
|||||||
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);
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
style = gtk_widget_get_style_context (widget);
|
||||||
if (is_active)
|
if (is_active)
|
||||||
color = &style->light[state];
|
meta_gtk_style_get_light_color (style, state, &color);
|
||||||
else
|
else
|
||||||
color = &style->bg[state];
|
gtk_style_context_get_background_color (style, state, &color);
|
||||||
cairo_set_source_rgb (cr,
|
gdk_cairo_set_source_rgba (cr, &color);
|
||||||
color->red / 65535.,
|
|
||||||
color->green / 65535.,
|
|
||||||
color->blue / 65535.);
|
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
winrect->x + 1, winrect->y + 1,
|
winrect->x + 1, winrect->y + 1,
|
||||||
@ -144,15 +142,8 @@ draw_window (GtkWidget *widget,
|
|||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_active)
|
gtk_style_context_get_color (style, state, &color);
|
||||||
color = &style->fg[state];
|
gdk_cairo_set_source_rgba (cr, &color);
|
||||||
else
|
|
||||||
color = &style->fg[state];
|
|
||||||
|
|
||||||
cairo_set_source_rgb (cr,
|
|
||||||
color->red / 65535.,
|
|
||||||
color->green / 65535.,
|
|
||||||
color->blue / 65535.);
|
|
||||||
cairo_set_line_width (cr, 1.0);
|
cairo_set_line_width (cr, 1.0);
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
winrect->x + 0.5, winrect->y + 0.5,
|
winrect->x + 0.5, winrect->y + 0.5,
|
||||||
@ -178,8 +169,8 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GdkRectangle workspace_rect;
|
GdkRectangle workspace_rect;
|
||||||
GtkStateType state;
|
GtkStateFlags state;
|
||||||
GtkStyle *style;
|
GtkStyleContext *style;
|
||||||
|
|
||||||
workspace_rect.x = x;
|
workspace_rect.x = x;
|
||||||
workspace_rect.y = y;
|
workspace_rect.y = y;
|
||||||
@ -187,13 +178,13 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
workspace_rect.height = height;
|
workspace_rect.height = height;
|
||||||
|
|
||||||
if (is_active)
|
if (is_active)
|
||||||
state = GTK_STATE_SELECTED;
|
state = GTK_STATE_FLAG_SELECTED;
|
||||||
else if (workspace_background)
|
else if (workspace_background)
|
||||||
state = GTK_STATE_PRELIGHT;
|
state = GTK_STATE_FLAG_PRELIGHT;
|
||||||
else
|
else
|
||||||
state = GTK_STATE_NORMAL;
|
state = GTK_STATE_FLAG_NORMAL;
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
style = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
|
|
||||||
@ -204,7 +195,10 @@ wnck_draw_workspace (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdk_cairo_set_source_color (cr, &style->dark[state]);
|
GdkRGBA color;
|
||||||
|
|
||||||
|
meta_gtk_style_get_dark_color (style,state, &color);
|
||||||
|
gdk_cairo_set_source_rgba (cr, &color);
|
||||||
cairo_rectangle (cr, x, y, width, height);
|
cairo_rectangle (cr, x, y, width, height);
|
||||||
cairo_fill (cr);
|
cairo_fill (cr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user