theme: Get rid of x/y_offset usage when drawing frames
Commit aa65f94c672df8cc345575269d7e9dedf0e7ef24 that started passing cairo_t around broke offsets. Since passing cairo_t makes them unnecessary, this patches removes them rather than fixing them. This patch changes API. https://bugzilla.gnome.org/show_bug.cgi?id=630203
This commit is contained in:
parent
a2b3f9aeb0
commit
b265e8099a
@ -83,9 +83,7 @@ static void meta_frames_attach_style (MetaFrames *frames,
|
|||||||
|
|
||||||
static void meta_frames_paint (MetaFrames *frames,
|
static void meta_frames_paint (MetaFrames *frames,
|
||||||
MetaUIFrame *frame,
|
MetaUIFrame *frame,
|
||||||
cairo_t *cr,
|
cairo_t *cr);
|
||||||
int x_offset,
|
|
||||||
int y_offset);
|
|
||||||
|
|
||||||
static void meta_frames_set_window_background (MetaFrames *frames,
|
static void meta_frames_set_window_background (MetaFrames *frames,
|
||||||
MetaUIFrame *frame);
|
MetaUIFrame *frame);
|
||||||
@ -2112,11 +2110,12 @@ generate_pixmap (MetaFrames *frames,
|
|||||||
rect->width, rect->height);
|
rect->width, rect->height);
|
||||||
|
|
||||||
cr = meta_pixmap_cairo_create (result);
|
cr = meta_pixmap_cairo_create (result);
|
||||||
|
cairo_translate (cr, -rect->x, -rect->y);
|
||||||
|
|
||||||
setup_bg_cr (cr, frame->window, rect->x, rect->y);
|
setup_bg_cr (cr, frame->window, 0, 0);
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
|
|
||||||
meta_frames_paint (frames, frame, cr, -rect->x, -rect->y);
|
meta_frames_paint (frames, frame, cr);
|
||||||
|
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
|
|
||||||
@ -2341,7 +2340,7 @@ meta_frames_draw (GtkWidget *widget,
|
|||||||
|
|
||||||
cairo_push_group (cr);
|
cairo_push_group (cr);
|
||||||
|
|
||||||
meta_frames_paint (frames, frame, cr, 0, 0);
|
meta_frames_paint (frames, frame, cr);
|
||||||
|
|
||||||
cairo_pop_group_to_source (cr);
|
cairo_pop_group_to_source (cr);
|
||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
@ -2405,7 +2404,7 @@ meta_frames_expose_event (GtkWidget *widget,
|
|||||||
/* no need to clip, begin_paint_region ensures the pixmap
|
/* no need to clip, begin_paint_region ensures the pixmap
|
||||||
* is only as big as the rect we use. */
|
* is only as big as the rect we use. */
|
||||||
|
|
||||||
meta_frames_paint (frames, frame, cr, 0, 0);
|
meta_frames_paint (frames, frame, cr);
|
||||||
|
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
gdk_window_end_paint (event->window);
|
gdk_window_end_paint (event->window);
|
||||||
@ -2424,9 +2423,7 @@ meta_frames_expose_event (GtkWidget *widget,
|
|||||||
static void
|
static void
|
||||||
meta_frames_paint (MetaFrames *frames,
|
meta_frames_paint (MetaFrames *frames,
|
||||||
MetaUIFrame *frame,
|
MetaUIFrame *frame,
|
||||||
cairo_t *cr,
|
cairo_t *cr)
|
||||||
int x_offset,
|
|
||||||
int y_offset)
|
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
MetaFrameFlags flags;
|
MetaFrameFlags flags;
|
||||||
@ -2556,7 +2553,6 @@ meta_frames_paint (MetaFrames *frames,
|
|||||||
frame->style,
|
frame->style,
|
||||||
widget,
|
widget,
|
||||||
cr,
|
cr,
|
||||||
x_offset, y_offset,
|
|
||||||
type,
|
type,
|
||||||
flags,
|
flags,
|
||||||
w, h,
|
w, h,
|
||||||
|
@ -233,8 +233,10 @@ meta_preview_expose (GtkWidget *widget,
|
|||||||
};
|
};
|
||||||
|
|
||||||
ensure_info (preview);
|
ensure_info (preview);
|
||||||
|
cairo_save (cr);
|
||||||
|
|
||||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
|
cairo_translate (cr, border_width, border_width);
|
||||||
|
|
||||||
client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2;
|
client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2;
|
||||||
client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2;
|
client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2;
|
||||||
@ -247,8 +249,6 @@ meta_preview_expose (GtkWidget *widget,
|
|||||||
meta_theme_draw_frame (preview->theme,
|
meta_theme_draw_frame (preview->theme,
|
||||||
widget,
|
widget,
|
||||||
cr,
|
cr,
|
||||||
border_width,
|
|
||||||
border_width,
|
|
||||||
preview->type,
|
preview->type,
|
||||||
preview->flags,
|
preview->flags,
|
||||||
client_width, client_height,
|
client_width, client_height,
|
||||||
@ -259,6 +259,7 @@ meta_preview_expose (GtkWidget *widget,
|
|||||||
meta_preview_get_mini_icon (),
|
meta_preview_get_mini_icon (),
|
||||||
meta_preview_get_icon ());
|
meta_preview_get_icon ());
|
||||||
|
|
||||||
|
cairo_restore (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_GTK3
|
#ifdef USE_GTK3
|
||||||
|
@ -1016,7 +1016,6 @@ run_theme_benchmark (void)
|
|||||||
meta_theme_draw_frame (global_theme,
|
meta_theme_draw_frame (global_theme,
|
||||||
widget,
|
widget,
|
||||||
cr,
|
cr,
|
||||||
0, 0,
|
|
||||||
META_FRAME_TYPE_NORMAL,
|
META_FRAME_TYPE_NORMAL,
|
||||||
get_flags (widget),
|
get_flags (widget),
|
||||||
client_width, client_height,
|
client_width, client_height,
|
||||||
|
@ -4358,8 +4358,6 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
|
|||||||
GtkStyle *style_gtk,
|
GtkStyle *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
const MetaFrameGeometry *fgeom,
|
const MetaFrameGeometry *fgeom,
|
||||||
int client_width,
|
int client_width,
|
||||||
int client_height,
|
int client_height,
|
||||||
@ -4546,9 +4544,6 @@ meta_frame_style_draw_with_style (MetaFrameStyle *style,
|
|||||||
{
|
{
|
||||||
button_rect (j, fgeom, middle_bg_offset, &rect);
|
button_rect (j, fgeom, middle_bg_offset, &rect);
|
||||||
|
|
||||||
rect.x += x_offset;
|
|
||||||
rect.y += y_offset;
|
|
||||||
|
|
||||||
op_list = get_button (style, j, button_states[j]);
|
op_list = get_button (style, j, button_states[j]);
|
||||||
|
|
||||||
if (op_list)
|
if (op_list)
|
||||||
@ -4598,8 +4593,6 @@ void
|
|||||||
meta_frame_style_draw (MetaFrameStyle *style,
|
meta_frame_style_draw (MetaFrameStyle *style,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
const MetaFrameGeometry *fgeom,
|
const MetaFrameGeometry *fgeom,
|
||||||
int client_width,
|
int client_width,
|
||||||
int client_height,
|
int client_height,
|
||||||
@ -4610,8 +4603,7 @@ meta_frame_style_draw (MetaFrameStyle *style,
|
|||||||
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 (widget), widget,
|
||||||
cr, x_offset, y_offset,
|
cr, fgeom, client_width, client_height,
|
||||||
fgeom, client_width, client_height,
|
|
||||||
title_layout, text_height,
|
title_layout, text_height,
|
||||||
button_states, mini_icon, icon);
|
button_states, mini_icon, icon);
|
||||||
}
|
}
|
||||||
@ -5181,8 +5173,6 @@ meta_theme_draw_frame_with_style (MetaTheme *theme,
|
|||||||
GtkStyle *style_gtk,
|
GtkStyle *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
MetaFrameType type,
|
MetaFrameType type,
|
||||||
MetaFrameFlags flags,
|
MetaFrameFlags flags,
|
||||||
int client_width,
|
int client_width,
|
||||||
@ -5217,7 +5207,6 @@ meta_theme_draw_frame_with_style (MetaTheme *theme,
|
|||||||
style_gtk,
|
style_gtk,
|
||||||
widget,
|
widget,
|
||||||
cr,
|
cr,
|
||||||
x_offset, y_offset,
|
|
||||||
&fgeom,
|
&fgeom,
|
||||||
client_width, client_height,
|
client_width, client_height,
|
||||||
title_layout,
|
title_layout,
|
||||||
@ -5230,8 +5219,6 @@ void
|
|||||||
meta_theme_draw_frame (MetaTheme *theme,
|
meta_theme_draw_frame (MetaTheme *theme,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
MetaFrameType type,
|
MetaFrameType type,
|
||||||
MetaFrameFlags flags,
|
MetaFrameFlags flags,
|
||||||
int client_width,
|
int client_width,
|
||||||
@ -5244,7 +5231,7 @@ meta_theme_draw_frame (MetaTheme *theme,
|
|||||||
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 (widget), widget,
|
||||||
cr, x_offset, y_offset, type,flags,
|
cr, type,flags,
|
||||||
client_width, client_height,
|
client_width, client_height,
|
||||||
title_layout, text_height,
|
title_layout, text_height,
|
||||||
button_layout, button_states,
|
button_layout, button_states,
|
||||||
@ -5255,8 +5242,6 @@ void
|
|||||||
meta_theme_draw_frame_by_name (MetaTheme *theme,
|
meta_theme_draw_frame_by_name (MetaTheme *theme,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
const gchar *style_name,
|
const gchar *style_name,
|
||||||
MetaFrameFlags flags,
|
MetaFrameFlags flags,
|
||||||
int client_width,
|
int client_width,
|
||||||
@ -5288,7 +5273,6 @@ meta_theme_draw_frame_by_name (MetaTheme *theme,
|
|||||||
meta_frame_style_draw (style,
|
meta_frame_style_draw (style,
|
||||||
widget,
|
widget,
|
||||||
cr,
|
cr,
|
||||||
x_offset, y_offset,
|
|
||||||
&fgeom,
|
&fgeom,
|
||||||
client_width, client_height,
|
client_width, client_height,
|
||||||
title_layout,
|
title_layout,
|
||||||
|
@ -1010,8 +1010,6 @@ void meta_frame_style_unref (MetaFrameStyle *style);
|
|||||||
void meta_frame_style_draw (MetaFrameStyle *style,
|
void meta_frame_style_draw (MetaFrameStyle *style,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
const MetaFrameGeometry *fgeom,
|
const MetaFrameGeometry *fgeom,
|
||||||
int client_width,
|
int client_width,
|
||||||
int client_height,
|
int client_height,
|
||||||
@ -1026,8 +1024,6 @@ void meta_frame_style_draw_with_style (MetaFrameStyle *style,
|
|||||||
GtkStyle *style_gtk,
|
GtkStyle *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
const MetaFrameGeometry *fgeom,
|
const MetaFrameGeometry *fgeom,
|
||||||
int client_width,
|
int client_width,
|
||||||
int client_height,
|
int client_height,
|
||||||
@ -1073,8 +1069,6 @@ double meta_theme_get_title_scale (MetaTheme *theme,
|
|||||||
void meta_theme_draw_frame (MetaTheme *theme,
|
void meta_theme_draw_frame (MetaTheme *theme,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
MetaFrameType type,
|
MetaFrameType type,
|
||||||
MetaFrameFlags flags,
|
MetaFrameFlags flags,
|
||||||
int client_width,
|
int client_width,
|
||||||
@ -1089,8 +1083,6 @@ void meta_theme_draw_frame (MetaTheme *theme,
|
|||||||
void meta_theme_draw_frame_by_name (MetaTheme *theme,
|
void meta_theme_draw_frame_by_name (MetaTheme *theme,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
const gchar *style_name,
|
const gchar *style_name,
|
||||||
MetaFrameFlags flags,
|
MetaFrameFlags flags,
|
||||||
int client_width,
|
int client_width,
|
||||||
@ -1106,8 +1098,6 @@ void meta_theme_draw_frame_with_style (MetaTheme *theme,
|
|||||||
GtkStyle *style_gtk,
|
GtkStyle *style_gtk,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
int x_offset,
|
|
||||||
int y_offset,
|
|
||||||
MetaFrameType type,
|
MetaFrameType type,
|
||||||
MetaFrameFlags flags,
|
MetaFrameFlags flags,
|
||||||
int client_width,
|
int client_width,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user