summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-07-09 22:44:25 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-07-10 11:08:54 +0300
commitecaf4d9c0f2cb028261d8800fac17a1545de842b (patch)
tree48395bc0b5c4cb2bd7a65aba0c94fe3067d17d81
parent1fa001e4aead3fb2442f032d649b6fe8deda8991 (diff)
downloadmetacity-ecaf4d9c0f2cb028261d8800fac17a1545de842b.tar.gz
libmetacity: replace ints with doubles in few places
When we draw decorations we scale down client width and height. This causes problem when client width or height is odd number - decorations is not drawn in full size. Replace ints with doubles to make sure that cairo scales decorations to correct size. Improves HiDPI support.
-rw-r--r--libmetacity/Makefile.am1
-rw-r--r--libmetacity/meta-draw-op-private.h6
-rw-r--r--libmetacity/meta-draw-op.c62
-rw-r--r--libmetacity/meta-draw-spec-private.h40
-rw-r--r--libmetacity/meta-draw-spec.c32
-rw-r--r--libmetacity/meta-gradient-spec-private.h16
-rw-r--r--libmetacity/meta-gradient-spec.c16
-rw-r--r--libmetacity/meta-rectangle-private.h35
-rw-r--r--libmetacity/meta-theme-gtk.c28
-rw-r--r--libmetacity/meta-theme-metacity.c57
10 files changed, 168 insertions, 125 deletions
diff --git a/libmetacity/Makefile.am b/libmetacity/Makefile.am
index e2d0f48e..4928b4b0 100644
--- a/libmetacity/Makefile.am
+++ b/libmetacity/Makefile.am
@@ -15,6 +15,7 @@ libmetacity_la_SOURCES = \
meta-color-spec-private.h \
meta-css-provider.c \
meta-css-provider-private.h \
+ meta-rectangle-private.h \
meta-draw-op.c \
meta-draw-op-private.h \
meta-draw-spec.c \
diff --git a/libmetacity/meta-draw-op-private.h b/libmetacity/meta-draw-op-private.h
index 21759959..138ecec4 100644
--- a/libmetacity/meta-draw-op-private.h
+++ b/libmetacity/meta-draw-op-private.h
@@ -88,8 +88,8 @@ struct _MetaDrawInfo
gint top_height;
gint bottom_height;
- gint width;
- gint height;
+ gdouble width;
+ gdouble height;
};
/**
@@ -261,7 +261,7 @@ void meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_lis
GtkStyleContext *context,
cairo_t *cr,
const MetaDrawInfo *info,
- GdkRectangle rect);
+ MetaRectangleDouble rect);
G_GNUC_INTERNAL
void meta_draw_op_list_append (MetaDrawOpList *op_list,
diff --git a/libmetacity/meta-draw-op.c b/libmetacity/meta-draw-op.c
index 108e9953..def8033b 100644
--- a/libmetacity/meta-draw-op.c
+++ b/libmetacity/meta-draw-op.c
@@ -51,11 +51,11 @@ struct _MetaDrawOpList
static void
fill_env (MetaPositionExprEnv *env,
const MetaDrawInfo *info,
- GdkRectangle logical_region)
+ MetaRectangleDouble rect)
{
/* FIXME this stuff could be raised into draw_op_list_draw() probably
*/
- env->rect = logical_region;
+ env->rect = rect;
env->object_width = -1;
env->object_height = -1;
@@ -63,8 +63,8 @@ fill_env (MetaPositionExprEnv *env,
env->right_width = info->right_width;
env->top_height = info->top_height;
env->bottom_height = info->bottom_height;
- env->frame_x_center = info->width / 2 - logical_region.x;
- env->frame_y_center = info->height / 2 - logical_region.y;
+ env->frame_x_center = info->width / 2 - rect.x;
+ env->frame_y_center = info->height / 2 - rect.y;
env->mini_icon_width = info->mini_icon ? gdk_pixbuf_get_width (info->mini_icon) : 0;
env->mini_icon_height = info->mini_icon ? gdk_pixbuf_get_height (info->mini_icon) : 0;
@@ -78,8 +78,8 @@ fill_env (MetaPositionExprEnv *env,
static cairo_surface_t *
scale_surface (GdkPixbuf *src,
MetaImageFillType fill_type,
- gint width,
- gint height,
+ gdouble width,
+ gdouble height,
gboolean vertical_stripes,
gboolean horizontal_stripes)
{
@@ -219,8 +219,8 @@ static cairo_surface_t *
draw_op_as_surface (const MetaDrawOp *op,
GtkStyleContext *context,
const MetaDrawInfo *info,
- gint width,
- gint height)
+ gdouble width,
+ gdouble height)
{
cairo_surface_t *surface;
@@ -337,7 +337,6 @@ draw_op_draw_with_env (const MetaDrawOp *op,
GtkStyleContext *context,
cairo_t *cr,
const MetaDrawInfo *info,
- GdkRectangle rect,
MetaPositionExprEnv *env)
{
GdkRGBA color;
@@ -350,7 +349,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
{
case META_DRAW_LINE:
{
- int x1, x2, y1, y2;
+ gdouble x1, x2, y1, y2;
meta_color_spec_render (op->data.line.color_spec, context, &color);
gdk_cairo_set_source_rgba (cr, &color);
@@ -370,9 +369,8 @@ draw_op_draw_with_env (const MetaDrawOp *op,
x1 = meta_draw_spec_parse_x_position (op->data.line.x1, env);
y1 = meta_draw_spec_parse_y_position (op->data.line.y1, env);
- if (!op->data.line.x2 &&
- !op->data.line.y2 &&
- op->data.line.width==0)
+ if (!op->data.line.x2 && !op->data.line.y2 &&
+ op->data.line.width == 0)
{
cairo_rectangle (cr, x1, y1, 1, 1);
cairo_fill (cr);
@@ -425,7 +423,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_RECTANGLE:
{
- int rx, ry, rwidth, rheight;
+ gdouble rx, ry, rwidth, rheight;
meta_color_spec_render (op->data.rectangle.color_spec, context, &color);
gdk_cairo_set_source_rgba (cr, &color);
@@ -453,7 +451,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_ARC:
{
- int rx, ry, rwidth, rheight;
+ gdouble rx, ry, rwidth, rheight;
double start_angle, end_angle;
double center_x, center_y;
@@ -498,7 +496,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_TINT:
{
- int rx, ry, rwidth, rheight;
+ gdouble rx, ry, rwidth, rheight;
rx = meta_draw_spec_parse_x_position (op->data.tint.x, env);
ry = meta_draw_spec_parse_y_position (op->data.tint.y, env);
@@ -513,7 +511,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_GRADIENT:
{
- int rx, ry, rwidth, rheight;
+ gdouble rx, ry, rwidth, rheight;
rx = meta_draw_spec_parse_x_position (op->data.gradient.x, env);
ry = meta_draw_spec_parse_y_position (op->data.gradient.y, env);
@@ -528,7 +526,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_IMAGE:
{
- int rx, ry, rwidth, rheight;
+ gdouble rx, ry, rwidth, rheight;
cairo_surface_t *surface;
if (op->data.image.pixbuf)
@@ -573,7 +571,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_GTK_ARROW:
{
- int rx, ry, rwidth, rheight;
+ gdouble rx, ry, rwidth, rheight;
double angle = 0, size;
rx = meta_draw_spec_parse_x_position (op->data.gtk_arrow.x, env);
@@ -610,7 +608,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_GTK_BOX:
{
- int rx, ry, rwidth, rheight;
+ gdouble rx, ry, rwidth, rheight;
rx = meta_draw_spec_parse_x_position (op->data.gtk_box.x, env);
ry = meta_draw_spec_parse_y_position (op->data.gtk_box.y, env);
@@ -625,7 +623,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_GTK_VLINE:
{
- int rx, ry1, ry2;
+ gdouble rx, ry1, ry2;
rx = meta_draw_spec_parse_x_position (op->data.gtk_vline.x, env);
ry1 = meta_draw_spec_parse_y_position (op->data.gtk_vline.y1, env);
@@ -638,7 +636,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_ICON:
{
- int rx, ry, rwidth, rheight;
+ gdouble rx, ry, rwidth, rheight;
cairo_surface_t *surface;
rwidth = meta_draw_spec_parse_size (op->data.icon.width, env);
@@ -678,7 +676,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_TITLE:
if (info->title_layout)
{
- int rx, ry;
+ gdouble rx, ry;
PangoRectangle ink_rect, logical_rect;
meta_color_spec_render (op->data.title.color_spec, context, &color);
@@ -689,7 +687,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
if (op->data.title.ellipsize_width)
{
- int ellipsize_width;
+ gdouble ellipsize_width;
int right_bearing;
ellipsize_width = meta_draw_spec_parse_x_position (op->data.title.ellipsize_width, env);
@@ -757,7 +755,7 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_OP_LIST:
{
- GdkRectangle d_rect;
+ MetaRectangleDouble d_rect;
d_rect.x = meta_draw_spec_parse_x_position (op->data.op_list.x, env);
d_rect.y = meta_draw_spec_parse_y_position (op->data.op_list.y, env);
@@ -771,9 +769,9 @@ draw_op_draw_with_env (const MetaDrawOp *op,
case META_DRAW_TILE:
{
- int rx, ry, rwidth, rheight;
- int tile_xoffset, tile_yoffset;
- GdkRectangle tile;
+ gdouble rx, ry, rwidth, rheight;
+ gdouble tile_xoffset, tile_yoffset;
+ MetaRectangleDouble tile;
rx = meta_draw_spec_parse_x_position (op->data.tile.x, env);
ry = meta_draw_spec_parse_y_position (op->data.tile.y, env);
@@ -788,8 +786,8 @@ draw_op_draw_with_env (const MetaDrawOp *op,
tile_xoffset = meta_draw_spec_parse_x_position (op->data.tile.tile_xoffset, env);
tile_yoffset = meta_draw_spec_parse_y_position (op->data.tile.tile_yoffset, env);
/* tile offset should not include x/y */
- tile_xoffset -= rect.x;
- tile_yoffset -= rect.y;
+ tile_xoffset -= env->rect.x;
+ tile_yoffset -= env->rect.y;
tile.width = meta_draw_spec_parse_size (op->data.tile.tile_width, env);
tile.height = meta_draw_spec_parse_size (op->data.tile.tile_height, env);
@@ -1107,7 +1105,7 @@ meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
GtkStyleContext *context,
cairo_t *cr,
const MetaDrawInfo *info,
- GdkRectangle rect)
+ MetaRectangleDouble rect)
{
int i;
MetaPositionExprEnv env;
@@ -1146,7 +1144,7 @@ meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
}
else if (gdk_cairo_get_clip_rectangle (cr, NULL))
{
- draw_op_draw_with_env (op, context, cr, info, rect, &env);
+ draw_op_draw_with_env (op, context, cr, info, &env);
}
}
diff --git a/libmetacity/meta-draw-spec-private.h b/libmetacity/meta-draw-spec-private.h
index 5a36dfc8..0730a4eb 100644
--- a/libmetacity/meta-draw-spec-private.h
+++ b/libmetacity/meta-draw-spec-private.h
@@ -21,6 +21,8 @@
#include <gdk/gdk.h>
+#include "meta-rectangle-private.h"
+
G_BEGIN_DECLS
typedef struct _MetaDrawSpec MetaDrawSpec;
@@ -29,23 +31,25 @@ typedef struct _MetaPositionExprEnv MetaPositionExprEnv;
struct _MetaPositionExprEnv
{
- GdkRectangle rect;
+ MetaRectangleDouble rect;
+
/* size of an object being drawn, if it has a natural size */
- int object_width;
- int object_height;
+ gdouble object_width;
+ gdouble object_height;
+
/* global object sizes, always available */
- int left_width;
- int right_width;
- int top_height;
- int bottom_height;
- int title_width;
- int title_height;
- int frame_x_center;
- int frame_y_center;
- int mini_icon_width;
- int mini_icon_height;
- int icon_width;
- int icon_height;
+ gdouble left_width;
+ gdouble right_width;
+ gdouble top_height;
+ gdouble bottom_height;
+ gdouble title_width;
+ gdouble title_height;
+ gdouble frame_x_center;
+ gdouble frame_y_center;
+ gdouble mini_icon_width;
+ gdouble mini_icon_height;
+ gdouble icon_width;
+ gdouble icon_height;
};
G_GNUC_INTERNAL
@@ -57,15 +61,15 @@ G_GNUC_INTERNAL
void meta_draw_spec_free (MetaDrawSpec *spec);
G_GNUC_INTERNAL
-gint meta_draw_spec_parse_x_position (MetaDrawSpec *spec,
+gdouble meta_draw_spec_parse_x_position (MetaDrawSpec *spec,
const MetaPositionExprEnv *env);
G_GNUC_INTERNAL
-gint meta_draw_spec_parse_y_position (MetaDrawSpec *spec,
+gdouble meta_draw_spec_parse_y_position (MetaDrawSpec *spec,
const MetaPositionExprEnv *env);
G_GNUC_INTERNAL
-gint meta_draw_spec_parse_size (MetaDrawSpec *spec,
+gdouble meta_draw_spec_parse_size (MetaDrawSpec *spec,
const MetaPositionExprEnv *env);
G_END_DECLS
diff --git a/libmetacity/meta-draw-spec.c b/libmetacity/meta-draw-spec.c
index bd9f816e..3935f76a 100644
--- a/libmetacity/meta-draw-spec.c
+++ b/libmetacity/meta-draw-spec.c
@@ -94,7 +94,7 @@ struct _MetaDrawSpec
* If this spec is constant, this is the value of the constant;
* otherwise it is zero.
*/
- int value;
+ gdouble value;
/** A list of tokens in the expression. */
PosToken *tokens;
@@ -505,7 +505,7 @@ replace_constants (MetaThemeMetacity *metacity,
*/
static gboolean
pos_eval_get_variable (const PosToken *token,
- int *result,
+ gdouble *result,
const MetaPositionExprEnv *env,
GError **err)
{
@@ -957,13 +957,13 @@ pos_eval_helper (PosToken *tokens,
return FALSE;
case POS_TOKEN_VARIABLE:
- exprs[n_exprs].type = POS_EXPR_INT;
+ exprs[n_exprs].type = POS_EXPR_DOUBLE;
/* FIXME we should just dump all this crap
* in a hash, maybe keep width/height out
* for optimization purposes
*/
- if (!pos_eval_get_variable (t, &exprs[n_exprs].d.int_val, env, err))
+ if (!pos_eval_get_variable (t, &exprs[n_exprs].d.double_val, env, err))
return FALSE;
++n_exprs;
@@ -1076,7 +1076,7 @@ pos_eval_helper (PosToken *tokens,
static gboolean
pos_eval (MetaDrawSpec *spec,
const MetaPositionExprEnv *env,
- int *val_p,
+ gdouble *val_p,
GError **err)
{
PosExpr expr;
@@ -1112,8 +1112,8 @@ pos_eval (MetaDrawSpec *spec,
static gboolean
parse_position_expression (MetaDrawSpec *spec,
const MetaPositionExprEnv *env,
- int *x_return,
- int *y_return,
+ gdouble *x_return,
+ gdouble *y_return,
GError **err)
{
/* All positions are in a coordinate system with x, y at the origin.
@@ -1122,7 +1122,7 @@ parse_position_expression (MetaDrawSpec *spec,
* optionally "object_width" and object_height". Negative numbers
* aren't allowed.
*/
- int val;
+ gdouble val;
if (spec->constant)
val = spec->value;
@@ -1148,10 +1148,10 @@ parse_position_expression (MetaDrawSpec *spec,
static gboolean
parse_size_expression (MetaDrawSpec *spec,
const MetaPositionExprEnv *env,
- int *val_return,
+ gdouble *val_return,
GError **err)
{
- int val;
+ gdouble val;
if (spec->constant)
val = spec->value;
@@ -1212,11 +1212,11 @@ meta_draw_spec_free (MetaDrawSpec *spec)
g_slice_free (MetaDrawSpec, spec);
}
-gint
+gdouble
meta_draw_spec_parse_x_position (MetaDrawSpec *spec,
const MetaPositionExprEnv *env)
{
- int retval;
+ gdouble retval;
GError *error;
retval = 0;
@@ -1232,11 +1232,11 @@ meta_draw_spec_parse_x_position (MetaDrawSpec *spec,
return retval;
}
-gint
+gdouble
meta_draw_spec_parse_y_position (MetaDrawSpec *spec,
const MetaPositionExprEnv *env)
{
- int retval;
+ gdouble retval;
GError *error;
retval = 0;
@@ -1252,11 +1252,11 @@ meta_draw_spec_parse_y_position (MetaDrawSpec *spec,
return retval;
}
-gint
+gdouble
meta_draw_spec_parse_size (MetaDrawSpec *spec,
const MetaPositionExprEnv *env)
{
- int retval;
+ gdouble retval;
GError *error;
retval = 0;
diff --git a/libmetacity/meta-gradient-spec-private.h b/libmetacity/meta-gradient-spec-private.h
index aaa883b9..acb7732f 100644
--- a/libmetacity/meta-gradient-spec-private.h
+++ b/libmetacity/meta-gradient-spec-private.h
@@ -43,10 +43,10 @@ void meta_gradient_spec_render (const MetaGradientS
const MetaAlphaGradientSpec *alpha_spec,
cairo_t *cr,
GtkStyleContext *context,
- gint x,
- gint y,
- gint width,
- gint height);
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height);
G_GNUC_INTERNAL
gboolean meta_gradient_spec_validate (MetaGradientSpec *spec,
@@ -72,10 +72,10 @@ G_GNUC_INTERNAL
void meta_alpha_gradient_spec_render (MetaAlphaGradientSpec *spec,
GdkRGBA color,
cairo_t *cr,
- gint x,
- gint y,
- gint width,
- gint height);
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height);
G_GNUC_INTERNAL
cairo_pattern_t *meta_alpha_gradient_spec_get_mask (const MetaAlphaGradientSpec *spec);
diff --git a/libmetacity/meta-gradient-spec.c b/libmetacity/meta-gradient-spec.c
index cb99a692..5da0b1db 100644
--- a/libmetacity/meta-gradient-spec.c
+++ b/libmetacity/meta-gradient-spec.c
@@ -137,10 +137,10 @@ meta_gradient_spec_render (const MetaGradientSpec *spec,
const MetaAlphaGradientSpec *alpha_spec,
cairo_t *cr,
GtkStyleContext *context,
- gint x,
- gint y,
- gint width,
- gint height)
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height)
{
cairo_pattern_t *pattern;
@@ -224,10 +224,10 @@ void
meta_alpha_gradient_spec_render (MetaAlphaGradientSpec *spec,
GdkRGBA color,
cairo_t *cr,
- gint x,
- gint y,
- gint width,
- gint height)
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height)
{
if (!spec || spec->n_alphas == 1)
{
diff --git a/libmetacity/meta-rectangle-private.h b/libmetacity/meta-rectangle-private.h
new file mode 100644
index 00000000..2d625f25
--- /dev/null
+++ b/libmetacity/meta-rectangle-private.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef META_RECTANGE_PRIVATE_H
+#define META_RECTANGE_PRIVATE_H
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef struct
+{
+ gdouble x;
+ gdouble y;
+ gdouble width;
+ gdouble height;
+} MetaRectangleDouble;
+
+G_END_DECLS
+
+#endif
diff --git a/libmetacity/meta-theme-gtk.c b/libmetacity/meta-theme-gtk.c
index bd3e3431..33e70520 100644
--- a/libmetacity/meta-theme-gtk.c
+++ b/libmetacity/meta-theme-gtk.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
+#include "meta-rectangle-private.h"
#include "meta-frame-layout-private.h"
#include "meta-frame-style-private.h"
#include "meta-theme-gtk-private.h"
@@ -744,13 +745,12 @@ meta_theme_gtk_draw_frame (MetaThemeImpl *impl,
GdkPixbuf *mini_icon,
GdkPixbuf *icon)
{
- int scale;
+ gdouble scale;
GtkStyleContext *context;
GtkStateFlags state;
MetaButtonType button_type;
- GdkRectangle visible_rect;
- GdkRectangle titlebar_rect;
- GdkRectangle button_rect;
+ MetaRectangleDouble visible_rect;
+ MetaRectangleDouble titlebar_rect;
const MetaFrameBorders *borders;
/* We opt out of GTK+ HiDPI handling, so we have to do the scaling
@@ -803,7 +803,7 @@ meta_theme_gtk_draw_frame (MetaThemeImpl *impl,
if (style->layout->has_title && title_layout)
{
PangoRectangle logical;
- int text_width, x, y;
+ gdouble text_width, x, y;
pango_layout_set_width (title_layout, -1);
pango_layout_get_pixel_extents (title_layout, NULL, &logical);
@@ -832,19 +832,14 @@ meta_theme_gtk_draw_frame (MetaThemeImpl *impl,
{
MetaButtonState button_state;
const char *button_class;
+ GdkRectangle tmp_rect;
+ MetaRectangleDouble button_rect;
button_class = get_class_from_button_type (button_type);
if (button_class)
gtk_style_context_add_class (context, button_class);
- get_button_rect (button_type, fgeom, 0, &button_rect);
-
- button_rect.x /= scale;
- button_rect.y /= scale;
- button_rect.width /= scale;
- button_rect.height /= scale;
-
button_state = map_button_state (button_type, fgeom, 0, button_states);
if (button_state == META_BUTTON_STATE_PRELIGHT)
@@ -856,6 +851,13 @@ meta_theme_gtk_draw_frame (MetaThemeImpl *impl,
cairo_save (cr);
+ get_button_rect (button_type, fgeom, 0, &tmp_rect);
+
+ button_rect.x = tmp_rect.x / scale;
+ button_rect.y = tmp_rect.y / scale;
+ button_rect.width = tmp_rect.width / scale;
+ button_rect.height = tmp_rect.height / scale;
+
if (button_rect.width > 0 && button_rect.height > 0)
{
GdkPixbuf *pixbuf = NULL;
@@ -923,7 +925,7 @@ meta_theme_gtk_draw_frame (MetaThemeImpl *impl,
if (pixbuf)
{
float width, height;
- int x, y;
+ gdouble x, y;
width = gdk_pixbuf_get_width (pixbuf) / scale;
height = gdk_pixbuf_get_height (pixbuf) / scale;
diff --git a/libmetacity/meta-theme-metacity.c b/libmetacity/meta-theme-metacity.c
index 8235a920..94d27580 100644
--- a/libmetacity/meta-theme-metacity.c
+++ b/libmetacity/meta-theme-metacity.c
@@ -5218,14 +5218,14 @@ meta_theme_metacity_calc_geometry (MetaThemeImpl *impl,
static void
clip_to_rounded_corners (cairo_t *cr,
- GdkRectangle rect,
+ MetaRectangleDouble rect,
const MetaFrameGeometry *fgeom,
gint scale)
{
- gint x;
- gint y;
- gint width;
- gint height;
+ gdouble x;
+ gdouble y;
+ gdouble width;
+ gdouble height;
gint radius;
x = rect.x;
@@ -5299,15 +5299,17 @@ meta_theme_metacity_draw_frame (MetaThemeImpl *impl,
GdkPixbuf *mini_icon,
GdkPixbuf *icon)
{
- int scale;
+ gdouble scale;
int i, j;
- GdkRectangle visible_rect;
- GdkRectangle titlebar_rect;
- GdkRectangle left_titlebar_edge;
- GdkRectangle right_titlebar_edge;
- GdkRectangle bottom_titlebar_edge;
- GdkRectangle top_titlebar_edge;
- GdkRectangle left_edge, right_edge, bottom_edge;
+ MetaRectangleDouble visible_rect;
+ MetaRectangleDouble titlebar_rect;
+ MetaRectangleDouble left_titlebar_edge;
+ MetaRectangleDouble right_titlebar_edge;
+ MetaRectangleDouble bottom_titlebar_edge;
+ MetaRectangleDouble top_titlebar_edge;
+ MetaRectangleDouble left_edge;
+ MetaRectangleDouble right_edge;
+ MetaRectangleDouble bottom_edge;
PangoRectangle extents;
MetaDrawInfo draw_info;
const MetaFrameBorders *borders;
@@ -5415,7 +5417,7 @@ meta_theme_metacity_draw_frame (MetaThemeImpl *impl,
i = 0;
while (i < META_FRAME_PIECE_LAST)
{
- GdkRectangle rect;
+ MetaRectangleDouble rect;
switch ((MetaFramePiece) i)
{
@@ -5451,12 +5453,10 @@ meta_theme_metacity_draw_frame (MetaThemeImpl *impl,
break;
case META_FRAME_PIECE_TITLE:
- rect = fgeom->title_rect;
-
- rect.x /= scale;
- rect.y /= scale;
- rect.width /= scale;
- rect.height /= scale;
+ rect.x = fgeom->title_rect.x / scale;
+ rect.y = fgeom->title_rect.y / scale;
+ rect.width = fgeom->title_rect.width / scale;
+ rect.height = fgeom->title_rect.height / scale;
break;
case META_FRAME_PIECE_LEFT_EDGE:
@@ -5483,7 +5483,7 @@ meta_theme_metacity_draw_frame (MetaThemeImpl *impl,
cairo_save (cr);
- gdk_cairo_rectangle (cr, &rect);
+ cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
cairo_clip (cr);
if (gdk_cairo_get_clip_rectangle (cr, NULL))
@@ -5518,14 +5518,15 @@ meta_theme_metacity_draw_frame (MetaThemeImpl *impl,
j = 0;
while (j < META_BUTTON_TYPE_LAST)
{
+ GdkRectangle tmp_rect;
MetaButtonState button_state;
- get_button_rect (j, fgeom, middle_bg_offset, &rect);
+ get_button_rect (j, fgeom, middle_bg_offset, &tmp_rect);
- rect.x /= scale;
- rect.y /= scale;
- rect.width /= scale;
- rect.height /= scale;
+ rect.x = tmp_rect.x / scale;
+ rect.y = tmp_rect.y / scale;
+ rect.width = tmp_rect.width / scale;
+ rect.height = tmp_rect.height / scale;
button_state = map_button_state (j, fgeom, middle_bg_offset, button_states);
op_list = meta_frame_style_get_button (style, j, button_state);
@@ -5533,7 +5534,8 @@ meta_theme_metacity_draw_frame (MetaThemeImpl *impl,
if (op_list)
{
cairo_save (cr);
- gdk_cairo_rectangle (cr, &rect);
+
+ cairo_rectangle (cr, rect.x, rect.y, rect.width, rect.height);
cairo_clip (cr);
if (gdk_cairo_get_clip_rectangle (cr, NULL))
@@ -5541,6 +5543,7 @@ meta_theme_metacity_draw_frame (MetaThemeImpl *impl,
meta_draw_op_list_draw_with_style (op_list, context, cr,
&draw_info, rect);
}
+
cairo_restore (cr);
}