ui: Port to GtkStyleContext
GtkStyle has been deprecated in favor of GtkStyleContext. A full port would involve replacing GdkColor with GdkRGBA - leave this out for the time being. Bump the required version of GTK+. https://bugzilla.gnome.org/show_bug.cgi?id=637761
This commit is contained in:
parent
42fdd4f4d8
commit
565f002bc4
@ -55,13 +55,11 @@ draw_handler (GtkWidget *tooltips,
|
|||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
gtk_paint_flat_box (gtk_widget_get_style (tip),
|
gtk_render_background (gtk_widget_get_style_context (tooltips),
|
||||||
cr,
|
cr,
|
||||||
GTK_STATE_NORMAL, GTK_SHADOW_OUT,
|
0, 0,
|
||||||
tip, "tooltip",
|
gtk_widget_get_allocated_width (tooltips),
|
||||||
0, 0,
|
gtk_widget_get_allocated_height (tooltips));
|
||||||
gtk_widget_get_allocated_width (tip),
|
|
||||||
gtk_widget_get_allocated_height (tip));
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -43,12 +43,11 @@
|
|||||||
|
|
||||||
#define DEFAULT_INNER_BUTTON_BORDER 3
|
#define DEFAULT_INNER_BUTTON_BORDER 3
|
||||||
|
|
||||||
static void meta_frames_destroy (GtkWidget *object);
|
static void meta_frames_destroy (GtkWidget *object);
|
||||||
static void meta_frames_finalize (GObject *object);
|
static void meta_frames_finalize (GObject *object);
|
||||||
static void meta_frames_style_set (GtkWidget *widget,
|
static void meta_frames_style_updated (GtkWidget *widget);
|
||||||
GtkStyle *prev_style);
|
static void meta_frames_map (GtkWidget *widget);
|
||||||
static void meta_frames_map (GtkWidget *widget);
|
static void meta_frames_unmap (GtkWidget *widget);
|
||||||
static void meta_frames_unmap (GtkWidget *widget);
|
|
||||||
|
|
||||||
static void meta_frames_update_prelit_control (MetaFrames *frames,
|
static void meta_frames_update_prelit_control (MetaFrames *frames,
|
||||||
MetaUIFrame *frame,
|
MetaUIFrame *frame,
|
||||||
@ -137,7 +136,7 @@ meta_frames_class_init (MetaFramesClass *class)
|
|||||||
|
|
||||||
widget_class->destroy = meta_frames_destroy;
|
widget_class->destroy = meta_frames_destroy;
|
||||||
|
|
||||||
widget_class->style_set = meta_frames_style_set;
|
widget_class->style_updated = meta_frames_style_updated;
|
||||||
|
|
||||||
widget_class->map = meta_frames_map;
|
widget_class->map = meta_frames_map;
|
||||||
widget_class->unmap = meta_frames_unmap;
|
widget_class->unmap = meta_frames_unmap;
|
||||||
@ -422,8 +421,7 @@ reattach_style_func (gpointer key, gpointer value, gpointer data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_frames_style_set (GtkWidget *widget,
|
meta_frames_style_updated (GtkWidget *widget)
|
||||||
GtkStyle *prev_style)
|
|
||||||
{
|
{
|
||||||
MetaFrames *frames;
|
MetaFrames *frames;
|
||||||
|
|
||||||
@ -434,7 +432,7 @@ meta_frames_style_set (GtkWidget *widget,
|
|||||||
g_hash_table_foreach (frames->frames,
|
g_hash_table_foreach (frames->frames,
|
||||||
reattach_style_func, frames);
|
reattach_style_func, frames);
|
||||||
|
|
||||||
GTK_WIDGET_CLASS (meta_frames_parent_class)->style_set (widget, prev_style);
|
GTK_WIDGET_CLASS (meta_frames_parent_class)->style_updated (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -577,12 +575,9 @@ meta_frames_attach_style (MetaFrames *frames,
|
|||||||
MetaUIFrame *frame)
|
MetaUIFrame *frame)
|
||||||
{
|
{
|
||||||
if (frame->style != NULL)
|
if (frame->style != NULL)
|
||||||
gtk_style_detach (frame->style);
|
g_object_unref (frame->style);
|
||||||
|
|
||||||
/* Weirdly, gtk_style_attach() steals a reference count from the style passed in */
|
frame->style = g_object_ref (gtk_widget_get_style_context (GTK_WIDGET (frames)));
|
||||||
g_object_ref (gtk_widget_get_style (GTK_WIDGET (frames)));
|
|
||||||
frame->style = gtk_style_attach (gtk_widget_get_style (GTK_WIDGET (frames)),
|
|
||||||
frame->window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -653,7 +648,7 @@ meta_frames_unmanage_window (MetaFrames *frames,
|
|||||||
|
|
||||||
g_hash_table_remove (frames->frames, &frame->xwindow);
|
g_hash_table_remove (frames->frames, &frame->xwindow);
|
||||||
|
|
||||||
gtk_style_detach (frame->style);
|
g_object_unref (frame->style);
|
||||||
|
|
||||||
gdk_window_destroy (frame->window);
|
gdk_window_destroy (frame->window);
|
||||||
|
|
||||||
@ -2469,8 +2464,7 @@ meta_frames_set_window_background (MetaFrames *frames,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_style_set_background (frame->style,
|
gtk_style_context_set_background (frame->style, frame->window);
|
||||||
frame->window, GTK_STATE_NORMAL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ struct _MetaUIFrame
|
|||||||
{
|
{
|
||||||
Window xwindow;
|
Window xwindow;
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
GtkStyle *style;
|
GtkStyleContext *style;
|
||||||
MetaFrameStyle *cache_style;
|
MetaFrameStyle *cache_style;
|
||||||
PangoLayout *layout;
|
PangoLayout *layout;
|
||||||
int text_height;
|
int text_height;
|
||||||
|
@ -255,6 +255,7 @@ meta_accel_label_draw (GtkWidget *widget,
|
|||||||
|
|
||||||
if (allocation.width >= requisition.width + ac_width)
|
if (allocation.width >= requisition.width + ac_width)
|
||||||
{
|
{
|
||||||
|
GtkStyleContext *style;
|
||||||
PangoLayout *label_layout;
|
PangoLayout *label_layout;
|
||||||
PangoLayout *accel_layout;
|
PangoLayout *accel_layout;
|
||||||
GtkLabel *label = GTK_LABEL (widget);
|
GtkLabel *label = GTK_LABEL (widget);
|
||||||
@ -302,14 +303,15 @@ meta_accel_label_draw (GtkWidget *widget,
|
|||||||
|
|
||||||
y = (allocation.height - (requisition.height - ypad * 2)) * yalign + 1.5;
|
y = (allocation.height - (requisition.height - ypad * 2)) * yalign + 1.5;
|
||||||
|
|
||||||
gtk_paint_layout (gtk_widget_get_style (widget),
|
style = gtk_widget_get_style_context (widget);
|
||||||
cr,
|
gtk_style_context_save (style);
|
||||||
gtk_widget_get_state (widget),
|
gtk_style_context_set_state (style,
|
||||||
FALSE,
|
gtk_widget_get_state_flags (widget));
|
||||||
widget,
|
gtk_render_layout (gtk_widget_get_style_context (widget),
|
||||||
"accellabel",
|
cr,
|
||||||
x, y,
|
x, y,
|
||||||
accel_layout);
|
accel_layout);
|
||||||
|
gtk_style_context_restore (style);
|
||||||
|
|
||||||
g_object_unref (accel_layout);
|
g_object_unref (accel_layout);
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,6 @@ outline_window_draw (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
MetaTabPopup *popup;
|
MetaTabPopup *popup;
|
||||||
TabEntry *te;
|
TabEntry *te;
|
||||||
GtkStyle *style;
|
|
||||||
|
|
||||||
popup = data;
|
popup = data;
|
||||||
|
|
||||||
@ -86,10 +85,9 @@ outline_window_draw (GtkWidget *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
te = popup->current_selected_entry;
|
te = popup->current_selected_entry;
|
||||||
style = gtk_widget_get_style (widget);
|
|
||||||
|
|
||||||
cairo_set_line_width (cr, 1.0);
|
cairo_set_line_width (cr, 1.0);
|
||||||
gdk_cairo_set_source_color (cr, &style->white);
|
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
0.5, 0.5,
|
0.5, 0.5,
|
||||||
@ -479,6 +477,7 @@ display_entry (MetaTabPopup *popup,
|
|||||||
{
|
{
|
||||||
cairo_region_t *region;
|
cairo_region_t *region;
|
||||||
cairo_region_t *inner_region;
|
cairo_region_t *inner_region;
|
||||||
|
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
|
||||||
|
|
||||||
window = gtk_widget_get_window (popup->outline_window);
|
window = gtk_widget_get_window (popup->outline_window);
|
||||||
|
|
||||||
@ -495,9 +494,7 @@ display_entry (MetaTabPopup *popup,
|
|||||||
te->rect.x, te->rect.y,
|
te->rect.x, te->rect.y,
|
||||||
te->rect.width, te->rect.height);
|
te->rect.width, te->rect.height);
|
||||||
|
|
||||||
gdk_window_set_background (window,
|
gdk_window_set_background_rgba (window, &black);
|
||||||
>k_widget_get_style (popup->outline_window)->black);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
region = cairo_region_create_rectangle (&rect);
|
region = cairo_region_create_rectangle (&rect);
|
||||||
@ -709,9 +706,9 @@ meta_select_image_draw (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkMisc *misc;
|
GtkMisc *misc;
|
||||||
GtkRequisition requisition;
|
GtkRequisition requisition;
|
||||||
GtkStyle *style;
|
GtkStyleContext *context;
|
||||||
GtkStateType state;
|
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
|
GdkRGBA color;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
gint xpad, ypad;
|
gint xpad, ypad;
|
||||||
gfloat xalign, yalign;
|
gfloat xalign, yalign;
|
||||||
@ -732,11 +729,15 @@ meta_select_image_draw (GtkWidget *widget,
|
|||||||
h = requisition.height - OUTSIDE_SELECT_RECT * 2 - 1;
|
h = requisition.height - OUTSIDE_SELECT_RECT * 2 - 1;
|
||||||
|
|
||||||
window = gtk_widget_get_window (widget);
|
window = gtk_widget_get_window (widget);
|
||||||
style = gtk_widget_get_style (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
state = gtk_widget_get_state (widget);
|
|
||||||
|
gtk_style_context_set_state (context,
|
||||||
|
gtk_widget_get_state_flags (widget));
|
||||||
|
|
||||||
|
gtk_style_context_lookup_color (context, "color", &color);
|
||||||
|
|
||||||
cairo_set_line_width (cr, 2.0);
|
cairo_set_line_width (cr, 2.0);
|
||||||
gdk_cairo_set_source_color (cr, &style->fg[state]);
|
cairo_set_source_rgb (cr, color.red, color.green, color.blue);
|
||||||
|
|
||||||
cairo_rectangle (cr, x, y, w + 1, h + 1);
|
cairo_rectangle (cr, x, y, w + 1, h + 1);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
@ -891,7 +892,6 @@ meta_select_workspace_draw (GtkWidget *widget,
|
|||||||
MetaWorkspace *workspace;
|
MetaWorkspace *workspace;
|
||||||
WnckWindowDisplayInfo *windows;
|
WnckWindowDisplayInfo *windows;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
GtkStyle *style;
|
|
||||||
int i, n_windows;
|
int i, n_windows;
|
||||||
GList *tmp, *list;
|
GList *tmp, *list;
|
||||||
|
|
||||||
@ -949,11 +949,18 @@ meta_select_workspace_draw (GtkWidget *widget,
|
|||||||
|
|
||||||
if (META_SELECT_WORKSPACE (widget)->selected)
|
if (META_SELECT_WORKSPACE (widget)->selected)
|
||||||
{
|
{
|
||||||
style = gtk_widget_get_style (widget);
|
GtkStyleContext *context;
|
||||||
|
GdkRGBA color;
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
|
gtk_style_context_set_state (context,
|
||||||
|
gtk_widget_get_state_flags (widget));
|
||||||
|
|
||||||
|
gtk_style_context_lookup_color (context, "color", &color);
|
||||||
|
|
||||||
gdk_cairo_set_source_color (cr,
|
|
||||||
&style->fg[gtk_widget_get_state (widget)]);
|
|
||||||
cairo_set_line_width (cr, SELECT_OUTLINE_WIDTH);
|
cairo_set_line_width (cr, SELECT_OUTLINE_WIDTH);
|
||||||
|
cairo_set_source_rgb (cr, color.red, color.green, color.blue);
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
SELECT_OUTLINE_WIDTH / 2.0, SELECT_OUTLINE_WIDTH / 2.0,
|
SELECT_OUTLINE_WIDTH / 2.0, SELECT_OUTLINE_WIDTH / 2.0,
|
||||||
|
@ -224,11 +224,17 @@ draw_callback (GtkWidget *widget,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
RenderGradientFunc func = data;
|
RenderGradientFunc func = data;
|
||||||
GtkStyle *style;
|
GtkStyleContext *style;
|
||||||
|
GdkRGBA color;
|
||||||
|
|
||||||
style = gtk_widget_get_style (widget);
|
style = gtk_widget_get_style_context (widget);
|
||||||
|
|
||||||
gdk_cairo_set_source_color (cr, &style->fg[gtk_widget_get_state (widget)]);
|
gtk_style_context_save (style);
|
||||||
|
gtk_style_context_set_state (style, gtk_widget_get_state_flags (widget));
|
||||||
|
gtk_style_context_lookup_color (style, "foreground-color", &color);
|
||||||
|
gtk_style_context_restore (style);
|
||||||
|
|
||||||
|
cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
|
||||||
|
|
||||||
(* func) (cr,
|
(* func) (cr,
|
||||||
gtk_widget_get_allocated_width (widget),
|
gtk_widget_get_allocated_width (widget),
|
||||||
|
@ -975,7 +975,7 @@ void meta_draw_op_draw (const MetaDrawOp *op,
|
|||||||
MetaRectangle logical_region);
|
MetaRectangle logical_region);
|
||||||
|
|
||||||
void meta_draw_op_draw_with_style (const MetaDrawOp *op,
|
void meta_draw_op_draw_with_style (const MetaDrawOp *op,
|
||||||
GtkStyle *style_gtk,
|
GtkStyleContext *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
@ -991,7 +991,7 @@ void meta_draw_op_list_draw (const MetaDrawOpList *op_list,
|
|||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
MetaRectangle rect);
|
MetaRectangle rect);
|
||||||
void meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
|
void meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
|
||||||
GtkStyle *style_gtk,
|
GtkStyleContext *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
@ -1035,7 +1035,7 @@ void meta_frame_style_draw (MetaFrameStyle *style,
|
|||||||
|
|
||||||
|
|
||||||
void meta_frame_style_draw_with_style (MetaFrameStyle *style,
|
void meta_frame_style_draw_with_style (MetaFrameStyle *style,
|
||||||
GtkStyle *style_gtk,
|
GtkStyleContext *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
const MetaFrameGeometry *fgeom,
|
const MetaFrameGeometry *fgeom,
|
||||||
@ -1101,7 +1101,7 @@ void meta_theme_draw_frame_by_name (MetaTheme *theme,
|
|||||||
GdkPixbuf *icon);
|
GdkPixbuf *icon);
|
||||||
|
|
||||||
void meta_theme_draw_frame_with_style (MetaTheme *theme,
|
void meta_theme_draw_frame_with_style (MetaTheme *theme,
|
||||||
GtkStyle *style_gtk,
|
GtkStyleContext *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
MetaFrameType type,
|
MetaFrameType type,
|
||||||
|
@ -472,7 +472,7 @@ get_window_flags (MetaFrameType type)
|
|||||||
|
|
||||||
static GtkWidget*
|
static GtkWidget*
|
||||||
preview_collection (int font_size,
|
preview_collection (int font_size,
|
||||||
PangoFontDescription *base_desc)
|
const PangoFontDescription *base_desc)
|
||||||
{
|
{
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
GtkWidget *sw;
|
GtkWidget *sw;
|
||||||
@ -780,7 +780,8 @@ benchmark_summary (void)
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
GtkStyle *style;
|
GtkStyleContext *style;
|
||||||
|
const PangoFontDescription *font_desc;
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GtkWidget *collection;
|
GtkWidget *collection;
|
||||||
GError *err;
|
GError *err;
|
||||||
@ -857,28 +858,29 @@ main (int argc, char **argv)
|
|||||||
G_CALLBACK (gtk_main_quit), NULL);
|
G_CALLBACK (gtk_main_quit), NULL);
|
||||||
|
|
||||||
gtk_widget_realize (window);
|
gtk_widget_realize (window);
|
||||||
style = gtk_widget_get_style (window);
|
style = gtk_widget_get_style_context (window);
|
||||||
|
font_desc = gtk_style_context_get_font (style, 0);
|
||||||
|
|
||||||
g_assert (style);
|
g_assert (style);
|
||||||
g_assert (style->font_desc);
|
g_assert (font_desc);
|
||||||
|
|
||||||
notebook = gtk_notebook_new ();
|
notebook = gtk_notebook_new ();
|
||||||
gtk_container_add (GTK_CONTAINER (window), notebook);
|
gtk_container_add (GTK_CONTAINER (window), notebook);
|
||||||
|
|
||||||
collection = preview_collection (FONT_SIZE_NORMAL,
|
collection = preview_collection (FONT_SIZE_NORMAL,
|
||||||
style->font_desc);
|
font_desc);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||||
collection,
|
collection,
|
||||||
gtk_label_new (_("Normal Title Font")));
|
gtk_label_new (_("Normal Title Font")));
|
||||||
|
|
||||||
collection = preview_collection (FONT_SIZE_SMALL,
|
collection = preview_collection (FONT_SIZE_SMALL,
|
||||||
style->font_desc);
|
font_desc);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||||
collection,
|
collection,
|
||||||
gtk_label_new (_("Small Title Font")));
|
gtk_label_new (_("Small Title Font")));
|
||||||
|
|
||||||
collection = preview_collection (FONT_SIZE_LARGE,
|
collection = preview_collection (FONT_SIZE_LARGE,
|
||||||
style->font_desc);
|
font_desc);
|
||||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||||
collection,
|
collection,
|
||||||
gtk_label_new (_("Large Title Font")));
|
gtk_label_new (_("Large Title Font")));
|
||||||
@ -929,7 +931,12 @@ get_flags (GtkWidget *widget)
|
|||||||
static int
|
static int
|
||||||
get_text_height (GtkWidget *widget)
|
get_text_height (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
return meta_pango_font_desc_get_text_height (gtk_widget_get_style (widget)->font_desc,
|
GtkStyleContext *style;
|
||||||
|
const PangoFontDescription *font_desc;
|
||||||
|
|
||||||
|
style = gtk_widget_get_style_context (widget);
|
||||||
|
font_desc = gtk_style_context_get_font (style, 0);
|
||||||
|
return meta_pango_font_desc_get_text_height (font_desc,
|
||||||
gtk_widget_get_pango_context (widget));
|
gtk_widget_get_pango_context (widget));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
171
src/ui/theme.c
171
src/ui/theme.c
@ -3472,6 +3472,30 @@ fill_env (MetaPositionExprEnv *env,
|
|||||||
env->theme = meta_current_theme;
|
env->theme = meta_current_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GtkStateFlags
|
||||||
|
state_flags_from_gtk_state (GtkStateType state)
|
||||||
|
{
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case GTK_STATE_NORMAL:
|
||||||
|
return 0;
|
||||||
|
case GTK_STATE_PRELIGHT:
|
||||||
|
return GTK_STATE_FLAG_PRELIGHT;
|
||||||
|
case GTK_STATE_ACTIVE:
|
||||||
|
return GTK_STATE_FLAG_ACTIVE;
|
||||||
|
case GTK_STATE_SELECTED:
|
||||||
|
return GTK_STATE_FLAG_SELECTED;
|
||||||
|
case GTK_STATE_INSENSITIVE:
|
||||||
|
return GTK_STATE_FLAG_INSENSITIVE;
|
||||||
|
case GTK_STATE_INCONSISTENT:
|
||||||
|
return GTK_STATE_FLAG_INCONSISTENT;
|
||||||
|
case GTK_STATE_FOCUSED:
|
||||||
|
return GTK_STATE_FLAG_FOCUSED;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* This code was originally rendering anti-aliased using X primitives, and
|
/* This code was originally rendering anti-aliased using X primitives, and
|
||||||
* now has been switched to draw anti-aliased using cairo. In general, the
|
* now has been switched to draw anti-aliased using cairo. In general, the
|
||||||
* closest correspondence between X rendering and cairo rendering is given
|
* closest correspondence between X rendering and cairo rendering is given
|
||||||
@ -3485,7 +3509,7 @@ fill_env (MetaPositionExprEnv *env,
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
||||||
GtkStyle *style_gtk,
|
GtkStyleContext *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
@ -3495,6 +3519,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
|||||||
GdkColor color;
|
GdkColor color;
|
||||||
|
|
||||||
cairo_save (cr);
|
cairo_save (cr);
|
||||||
|
gtk_style_context_save (style_gtk);
|
||||||
|
|
||||||
cairo_set_line_width (cr, 1.0);
|
cairo_set_line_width (cr, 1.0);
|
||||||
|
|
||||||
@ -3744,21 +3769,36 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
|||||||
case META_DRAW_GTK_ARROW:
|
case META_DRAW_GTK_ARROW:
|
||||||
{
|
{
|
||||||
int rx, ry, rwidth, rheight;
|
int rx, ry, rwidth, rheight;
|
||||||
|
double angle = 0, size;
|
||||||
|
|
||||||
rx = parse_x_position_unchecked (op->data.gtk_arrow.x, env);
|
rx = parse_x_position_unchecked (op->data.gtk_arrow.x, env);
|
||||||
ry = parse_y_position_unchecked (op->data.gtk_arrow.y, env);
|
ry = parse_y_position_unchecked (op->data.gtk_arrow.y, env);
|
||||||
rwidth = parse_size_unchecked (op->data.gtk_arrow.width, env);
|
rwidth = parse_size_unchecked (op->data.gtk_arrow.width, env);
|
||||||
rheight = parse_size_unchecked (op->data.gtk_arrow.height, env);
|
rheight = parse_size_unchecked (op->data.gtk_arrow.height, env);
|
||||||
|
|
||||||
gtk_paint_arrow (style_gtk,
|
size = MAX(rwidth, rheight);
|
||||||
cr,
|
|
||||||
op->data.gtk_arrow.state,
|
switch (op->data.gtk_arrow.arrow)
|
||||||
op->data.gtk_arrow.shadow,
|
{
|
||||||
widget,
|
case GTK_ARROW_UP:
|
||||||
"metacity",
|
angle = 0;
|
||||||
op->data.gtk_arrow.arrow,
|
break;
|
||||||
op->data.gtk_arrow.filled,
|
case GTK_ARROW_RIGHT:
|
||||||
rx, ry, rwidth, rheight);
|
angle = M_PI / 2;
|
||||||
|
break;
|
||||||
|
case GTK_ARROW_DOWN:
|
||||||
|
angle = M_PI;
|
||||||
|
break;
|
||||||
|
case GTK_ARROW_LEFT:
|
||||||
|
angle = 3 * M_PI / 2;
|
||||||
|
break;
|
||||||
|
case GTK_ARROW_NONE:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_style_context_set_state (style_gtk,
|
||||||
|
state_flags_from_gtk_state (op->data.gtk_arrow.state));
|
||||||
|
gtk_render_arrow (style_gtk, cr, angle, rx, ry, size);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3771,13 +3811,10 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
|||||||
rwidth = parse_size_unchecked (op->data.gtk_box.width, env);
|
rwidth = parse_size_unchecked (op->data.gtk_box.width, env);
|
||||||
rheight = parse_size_unchecked (op->data.gtk_box.height, env);
|
rheight = parse_size_unchecked (op->data.gtk_box.height, env);
|
||||||
|
|
||||||
gtk_paint_box (style_gtk,
|
gtk_style_context_set_state (style_gtk,
|
||||||
cr,
|
state_flags_from_gtk_state (op->data.gtk_box.state));
|
||||||
op->data.gtk_box.state,
|
gtk_render_background (style_gtk, cr, rx, ry, rwidth, rheight);
|
||||||
op->data.gtk_box.shadow,
|
gtk_render_frame (style_gtk, cr, rx, ry, rwidth, rheight);
|
||||||
widget,
|
|
||||||
"metacity",
|
|
||||||
rx, ry, rwidth, rheight);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3789,12 +3826,9 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
|||||||
ry1 = parse_y_position_unchecked (op->data.gtk_vline.y1, env);
|
ry1 = parse_y_position_unchecked (op->data.gtk_vline.y1, env);
|
||||||
ry2 = parse_y_position_unchecked (op->data.gtk_vline.y2, env);
|
ry2 = parse_y_position_unchecked (op->data.gtk_vline.y2, env);
|
||||||
|
|
||||||
gtk_paint_vline (style_gtk,
|
gtk_style_context_set_state (style_gtk,
|
||||||
cr,
|
state_flags_from_gtk_state (op->data.gtk_vline.state));
|
||||||
op->data.gtk_vline.state,
|
gtk_render_line (style_gtk, cr, rx, ry1, rx, ry2);
|
||||||
widget,
|
|
||||||
"metacity",
|
|
||||||
ry1, ry2, rx);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3939,15 +3973,16 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cairo_restore (cr);
|
cairo_restore (cr);
|
||||||
|
gtk_style_context_restore (style_gtk);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_draw_op_draw_with_style (const MetaDrawOp *op,
|
meta_draw_op_draw_with_style (const MetaDrawOp *op,
|
||||||
GtkStyle *style_gtk,
|
GtkStyleContext *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
MetaRectangle logical_region)
|
MetaRectangle logical_region)
|
||||||
{
|
{
|
||||||
MetaPositionExprEnv env;
|
MetaPositionExprEnv env;
|
||||||
|
|
||||||
@ -3966,8 +4001,8 @@ meta_draw_op_draw (const MetaDrawOp *op,
|
|||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
MetaRectangle logical_region)
|
MetaRectangle logical_region)
|
||||||
{
|
{
|
||||||
meta_draw_op_draw_with_style (op, gtk_widget_get_style (widget), widget,
|
meta_draw_op_draw_with_style (op, gtk_widget_get_style_context (widget),
|
||||||
cr, info, logical_region);
|
widget, cr, info, logical_region);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4023,11 +4058,11 @@ meta_draw_op_list_unref (MetaDrawOpList *op_list)
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
|
meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
|
||||||
GtkStyle *style_gtk,
|
GtkStyleContext *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
MetaRectangle rect)
|
MetaRectangle rect)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
MetaPositionExprEnv env;
|
MetaPositionExprEnv env;
|
||||||
@ -4088,7 +4123,7 @@ meta_draw_op_list_draw (const MetaDrawOpList *op_list,
|
|||||||
MetaRectangle rect)
|
MetaRectangle rect)
|
||||||
|
|
||||||
{
|
{
|
||||||
meta_draw_op_list_draw_with_style (op_list, gtk_widget_get_style (widget), widget,
|
meta_draw_op_list_draw_with_style (op_list, gtk_widget_get_style_context (widget), widget,
|
||||||
cr, info, rect);
|
cr, info, rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4472,17 +4507,17 @@ button_rect (MetaButtonType type,
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_frame_style_draw_with_style (MetaFrameStyle *style,
|
meta_frame_style_draw_with_style (MetaFrameStyle *style,
|
||||||
GtkStyle *style_gtk,
|
GtkStyleContext *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
const MetaFrameGeometry *fgeom,
|
const MetaFrameGeometry *fgeom,
|
||||||
int client_width,
|
int client_width,
|
||||||
int client_height,
|
int client_height,
|
||||||
PangoLayout *title_layout,
|
PangoLayout *title_layout,
|
||||||
int text_height,
|
int text_height,
|
||||||
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
|
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
|
||||||
GdkPixbuf *mini_icon,
|
GdkPixbuf *mini_icon,
|
||||||
GdkPixbuf *icon)
|
GdkPixbuf *icon)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
GdkRectangle titlebar_rect;
|
GdkRectangle titlebar_rect;
|
||||||
@ -4640,10 +4675,10 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
|
|||||||
m_rect = meta_rect (rect.x, rect.y, rect.width, rect.height);
|
m_rect = meta_rect (rect.x, rect.y, rect.width, rect.height);
|
||||||
meta_draw_op_list_draw_with_style (op_list,
|
meta_draw_op_list_draw_with_style (op_list,
|
||||||
style_gtk,
|
style_gtk,
|
||||||
widget,
|
widget,
|
||||||
cr,
|
cr,
|
||||||
&draw_info,
|
&draw_info,
|
||||||
m_rect);
|
m_rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4723,7 +4758,7 @@ meta_frame_style_draw (MetaFrameStyle *style,
|
|||||||
GdkPixbuf *mini_icon,
|
GdkPixbuf *mini_icon,
|
||||||
GdkPixbuf *icon)
|
GdkPixbuf *icon)
|
||||||
{
|
{
|
||||||
meta_frame_style_draw_with_style (style, gtk_widget_get_style (widget), widget,
|
meta_frame_style_draw_with_style (style, gtk_widget_get_style_context (widget), widget,
|
||||||
cr, fgeom, client_width, client_height,
|
cr, fgeom, client_width, client_height,
|
||||||
title_layout, text_height,
|
title_layout, text_height,
|
||||||
button_states, mini_icon, icon);
|
button_states, mini_icon, icon);
|
||||||
@ -5336,19 +5371,19 @@ meta_theme_get_title_scale (MetaTheme *theme,
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_theme_draw_frame_with_style (MetaTheme *theme,
|
meta_theme_draw_frame_with_style (MetaTheme *theme,
|
||||||
GtkStyle *style_gtk,
|
GtkStyleContext *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
MetaFrameType type,
|
MetaFrameType type,
|
||||||
MetaFrameFlags flags,
|
MetaFrameFlags flags,
|
||||||
int client_width,
|
int client_width,
|
||||||
int client_height,
|
int client_height,
|
||||||
PangoLayout *title_layout,
|
PangoLayout *title_layout,
|
||||||
int text_height,
|
int text_height,
|
||||||
const MetaButtonLayout *button_layout,
|
const MetaButtonLayout *button_layout,
|
||||||
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
|
MetaButtonState button_states[META_BUTTON_TYPE_LAST],
|
||||||
GdkPixbuf *mini_icon,
|
GdkPixbuf *mini_icon,
|
||||||
GdkPixbuf *icon)
|
GdkPixbuf *icon)
|
||||||
{
|
{
|
||||||
MetaFrameGeometry fgeom;
|
MetaFrameGeometry fgeom;
|
||||||
MetaFrameStyle *style;
|
MetaFrameStyle *style;
|
||||||
@ -5396,7 +5431,7 @@ meta_theme_draw_frame (MetaTheme *theme,
|
|||||||
GdkPixbuf *mini_icon,
|
GdkPixbuf *mini_icon,
|
||||||
GdkPixbuf *icon)
|
GdkPixbuf *icon)
|
||||||
{
|
{
|
||||||
meta_theme_draw_frame_with_style (theme, gtk_widget_get_style (widget), widget,
|
meta_theme_draw_frame_with_style (theme, gtk_widget_get_style_context (widget), widget,
|
||||||
cr, type,flags,
|
cr, type,flags,
|
||||||
client_width, client_height,
|
client_width, client_height,
|
||||||
title_layout, text_height,
|
title_layout, text_height,
|
||||||
@ -5783,11 +5818,13 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget,
|
|||||||
double scale,
|
double scale,
|
||||||
const PangoFontDescription *override)
|
const PangoFontDescription *override)
|
||||||
{
|
{
|
||||||
|
GtkStyleContext *style;
|
||||||
PangoFontDescription *font_desc;
|
PangoFontDescription *font_desc;
|
||||||
|
|
||||||
g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
|
g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
|
||||||
|
|
||||||
font_desc = pango_font_description_copy (gtk_widget_get_style (widget)->font_desc);
|
style = gtk_widget_get_style_context (widget);
|
||||||
|
font_desc = pango_font_description_copy (gtk_style_context_get_font (style, 0));
|
||||||
|
|
||||||
if (override)
|
if (override)
|
||||||
pango_font_description_merge (font_desc, override, TRUE);
|
pango_font_description_merge (font_desc, override, TRUE);
|
||||||
|
@ -36,8 +36,7 @@ struct _MetaTilePreview {
|
|||||||
GtkWidget *preview_window;
|
GtkWidget *preview_window;
|
||||||
gulong create_serial;
|
gulong create_serial;
|
||||||
|
|
||||||
GdkColor *preview_color;
|
GdkRGBA *preview_color;
|
||||||
guchar preview_alpha;
|
|
||||||
|
|
||||||
MetaRectangle tile_rect;
|
MetaRectangle tile_rect;
|
||||||
|
|
||||||
@ -57,22 +56,23 @@ meta_tile_preview_draw (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
/* Fill the preview area with a transparent color */
|
/* Fill the preview area with a transparent color */
|
||||||
cairo_set_source_rgba (cr,
|
cairo_set_source_rgba (cr,
|
||||||
(double)preview->preview_color->red / 0xFFFF,
|
preview->preview_color->red,
|
||||||
(double)preview->preview_color->green / 0xFFFF,
|
preview->preview_color->green,
|
||||||
(double)preview->preview_color->blue / 0xFFFF,
|
preview->preview_color->blue,
|
||||||
(double)preview->preview_alpha / 0xFF);
|
preview->preview_color->alpha);
|
||||||
|
|
||||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
|
|
||||||
/* Use the opaque color for the border */
|
/* Use the opaque color for the border */
|
||||||
gdk_cairo_set_source_color (cr, preview->preview_color);
|
cairo_set_source_rgb (cr,
|
||||||
|
preview->preview_color->red,
|
||||||
|
preview->preview_color->green,
|
||||||
|
preview->preview_color->blue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GtkStyle *style = gtk_widget_get_style (preview->preview_window);
|
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
|
||||||
|
|
||||||
gdk_cairo_set_source_color (cr, &style->white);
|
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
OUTLINE_WIDTH - 0.5, OUTLINE_WIDTH - 0.5,
|
OUTLINE_WIDTH - 0.5, OUTLINE_WIDTH - 0.5,
|
||||||
@ -90,37 +90,6 @@ meta_tile_preview_draw (GtkWidget *widget,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
on_preview_window_style_set (GtkWidget *widget,
|
|
||||||
GtkStyle *previous,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
MetaTilePreview *preview = user_data;
|
|
||||||
GtkStyle *style;
|
|
||||||
|
|
||||||
style = gtk_rc_get_style_by_paths (gtk_widget_get_settings (widget),
|
|
||||||
"GtkWindow.GtkIconView",
|
|
||||||
"GtkWindow.GtkIconView",
|
|
||||||
GTK_TYPE_ICON_VIEW);
|
|
||||||
|
|
||||||
if (style != NULL)
|
|
||||||
g_object_ref (style);
|
|
||||||
else
|
|
||||||
style = gtk_style_new ();
|
|
||||||
|
|
||||||
gtk_style_get (style, GTK_TYPE_ICON_VIEW,
|
|
||||||
"selection-box-color", &preview->preview_color,
|
|
||||||
"selection-box-alpha", &preview->preview_alpha,
|
|
||||||
NULL);
|
|
||||||
if (!preview->preview_color)
|
|
||||||
{
|
|
||||||
GdkColor selection = style->base[GTK_STATE_SELECTED];
|
|
||||||
preview->preview_color = gdk_color_copy (&selection);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (style);
|
|
||||||
}
|
|
||||||
|
|
||||||
MetaTilePreview *
|
MetaTilePreview *
|
||||||
meta_tile_preview_new (int screen_number,
|
meta_tile_preview_new (int screen_number,
|
||||||
gboolean composited)
|
gboolean composited)
|
||||||
@ -138,7 +107,6 @@ meta_tile_preview_new (int screen_number,
|
|||||||
gtk_widget_set_app_paintable (preview->preview_window, TRUE);
|
gtk_widget_set_app_paintable (preview->preview_window, TRUE);
|
||||||
|
|
||||||
preview->preview_color = NULL;
|
preview->preview_color = NULL;
|
||||||
preview->preview_alpha = 0xFF;
|
|
||||||
|
|
||||||
preview->tile_rect.x = preview->tile_rect.y = 0;
|
preview->tile_rect.x = preview->tile_rect.y = 0;
|
||||||
preview->tile_rect.width = preview->tile_rect.height = 0;
|
preview->tile_rect.width = preview->tile_rect.height = 0;
|
||||||
@ -148,11 +116,38 @@ meta_tile_preview_new (int screen_number,
|
|||||||
|
|
||||||
if (preview->has_alpha)
|
if (preview->has_alpha)
|
||||||
{
|
{
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkWidgetPath *path;
|
||||||
|
guchar selection_alpha = 0xFF;
|
||||||
|
|
||||||
gtk_widget_set_visual (preview->preview_window,
|
gtk_widget_set_visual (preview->preview_window,
|
||||||
gdk_screen_get_rgba_visual (screen));
|
gdk_screen_get_rgba_visual (screen));
|
||||||
|
|
||||||
g_signal_connect (preview->preview_window, "style-set",
|
path = gtk_widget_path_new ();
|
||||||
G_CALLBACK (on_preview_window_style_set), preview);
|
gtk_widget_path_append_type (path, GTK_TYPE_ICON_VIEW);
|
||||||
|
|
||||||
|
context = gtk_style_context_new ();
|
||||||
|
gtk_style_context_set_path (context, path);
|
||||||
|
gtk_style_context_add_class (context,
|
||||||
|
GTK_STYLE_CLASS_RUBBERBAND);
|
||||||
|
|
||||||
|
gtk_widget_path_free (path);
|
||||||
|
|
||||||
|
gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED,
|
||||||
|
"background-color", &preview->preview_color,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
/* The background-color for the .rubberband class should probably
|
||||||
|
* contain the correct alpha value - unfortunately, at least for now
|
||||||
|
* it doesn't. Hopefully the following workaround can be removed
|
||||||
|
* when GtkIconView gets ported to GtkStyleContext.
|
||||||
|
*/
|
||||||
|
gtk_style_context_get_style (context,
|
||||||
|
"selection-box-alpha", &selection_alpha,
|
||||||
|
NULL);
|
||||||
|
preview->preview_color->alpha = (double)selection_alpha / 0xFF;
|
||||||
|
|
||||||
|
g_object_unref (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We make an assumption that XCreateWindow will be the first operation
|
/* We make an assumption that XCreateWindow will be the first operation
|
||||||
@ -173,7 +168,7 @@ meta_tile_preview_free (MetaTilePreview *preview)
|
|||||||
gtk_widget_destroy (preview->preview_window);
|
gtk_widget_destroy (preview->preview_window);
|
||||||
|
|
||||||
if (preview->preview_color)
|
if (preview->preview_color)
|
||||||
gdk_color_free (preview->preview_color);
|
gdk_rgba_free (preview->preview_color);
|
||||||
|
|
||||||
g_free (preview);
|
g_free (preview);
|
||||||
}
|
}
|
||||||
@ -214,10 +209,9 @@ meta_tile_preview_show (MetaTilePreview *preview,
|
|||||||
{
|
{
|
||||||
cairo_region_t *outer_region, *inner_region;
|
cairo_region_t *outer_region, *inner_region;
|
||||||
GdkRectangle outer_rect, inner_rect;
|
GdkRectangle outer_rect, inner_rect;
|
||||||
GdkColor black;
|
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
|
||||||
|
|
||||||
black = gtk_widget_get_style (preview->preview_window)->black;
|
gdk_window_set_background_rgba (window, &black);
|
||||||
gdk_window_set_background (window, &black);
|
|
||||||
|
|
||||||
outer_rect.x = outer_rect.y = 0;
|
outer_rect.x = outer_rect.y = 0;
|
||||||
outer_rect.width = preview->tile_rect.width;
|
outer_rect.width = preview->tile_rect.width;
|
||||||
|
@ -713,9 +713,9 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
|
|||||||
int *right_width)
|
int *right_width)
|
||||||
{
|
{
|
||||||
int text_height;
|
int text_height;
|
||||||
|
GtkStyleContext *style = NULL;
|
||||||
PangoContext *context;
|
PangoContext *context;
|
||||||
const PangoFontDescription *font_desc;
|
const PangoFontDescription *font_desc;
|
||||||
GtkStyle *default_style;
|
|
||||||
|
|
||||||
if (meta_ui_have_a_theme ())
|
if (meta_ui_have_a_theme ())
|
||||||
{
|
{
|
||||||
@ -724,8 +724,8 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
|
|||||||
|
|
||||||
if (!font_desc)
|
if (!font_desc)
|
||||||
{
|
{
|
||||||
default_style = gtk_widget_get_default_style ();
|
style = gtk_style_context_new ();
|
||||||
font_desc = default_style->font_desc;
|
font_desc = gtk_style_context_get_font (style, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
text_height = meta_pango_font_desc_get_text_height (font_desc, context);
|
text_height = meta_pango_font_desc_get_text_height (font_desc, context);
|
||||||
@ -739,6 +739,9 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
|
|||||||
{
|
{
|
||||||
*top_height = *bottom_height = *left_width = *right_width = 0;
|
*top_height = *bottom_height = *left_width = *right_width = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (style != NULL)
|
||||||
|
g_object_unref (style);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user