clutter: Remove window scaling feature

Window scaling is a clutter feature used to enable automatic scaling of
stage windows when running under as an application in windowing system.
Clutter in mutter does not support running as a stand-alone application
toolkit, so lets remove this unused feature.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-03-29 14:48:12 +08:00
parent 6791d1b8e2
commit 20fcb88632
12 changed files with 58 additions and 404 deletions

View File

@ -76,9 +76,6 @@ struct _ClutterCanvasPrivate
gboolean dirty;
CoglBitmap *buffer;
int scale_factor;
guint scale_factor_set : 1;
};
enum
@ -87,8 +84,6 @@ enum
PROP_WIDTH,
PROP_HEIGHT,
PROP_SCALE_FACTOR,
PROP_SCALE_FACTOR_SET,
LAST_PROP
};
@ -185,11 +180,6 @@ clutter_canvas_set_property (GObject *gobject,
}
break;
case PROP_SCALE_FACTOR:
clutter_canvas_set_scale_factor (CLUTTER_CANVAS (gobject),
g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -214,17 +204,6 @@ clutter_canvas_get_property (GObject *gobject,
g_value_set_int (value, priv->height);
break;
case PROP_SCALE_FACTOR:
if (priv->scale_factor_set)
g_value_set_int (value, priv->scale_factor);
else
g_value_set_int (value, -1);
break;
case PROP_SCALE_FACTOR_SET:
g_value_set_boolean (value, priv->scale_factor_set);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -268,46 +247,6 @@ clutter_canvas_class_init (ClutterCanvasClass *klass)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
/**
* ClutterCanvas:scale-factor-set:
*
* Whether the #ClutterCanvas:scale-factor property is set.
*
* If the #ClutterCanvas:scale-factor-set property is %FALSE
* then #ClutterCanvas will use the #ClutterSettings:window-scaling-factor
* property.
*
* Since: 1.18
*/
obj_props[PROP_SCALE_FACTOR_SET] =
g_param_spec_boolean ("scale-factor-set",
P_("Scale Factor Set"),
P_("Whether the scale-factor property is set"),
FALSE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* ClutterCanvas:scale-factor:
*
* The scaling factor to be applied to the Cairo surface used for
* drawing.
*
* If #ClutterCanvas:scale-factor is set to a negative value, the
* value of the #ClutterSettings:window-scaling-factor property is
* used instead.
*
* Use #ClutterCanvas:scale-factor-set to check if the scale factor
* is set.
*
* Since: 1.18
*/
obj_props[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor",
P_("Scale Factor"),
P_("The scaling factor for the surface"),
-1, 1000,
-1,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
/**
* ClutterCanvas::draw:
@ -354,7 +293,6 @@ clutter_canvas_init (ClutterCanvas *self)
self->priv->width = -1;
self->priv->height = -1;
self->priv->scale_factor = -1;
}
static void
@ -397,7 +335,6 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
gboolean mapped_buffer;
unsigned char *data;
CoglBuffer *buffer;
int window_scale = 1;
gboolean res;
cairo_t *cr;
@ -405,20 +342,11 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
priv->dirty = TRUE;
if (priv->scale_factor_set)
window_scale = priv->scale_factor;
else
g_object_get (clutter_settings_get_default (),
"window-scaling-factor", &window_scale,
NULL);
real_width = priv->width;
real_height = priv->height;
real_width = priv->width * window_scale;
real_height = priv->height * window_scale;
CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d (real: %d x %d, scale: %d)",
priv->width, priv->height,
real_width, real_height,
window_scale);
CLUTTER_NOTE (MISC, "Creating Cairo surface with size %d x %d",
priv->width, priv->height);
if (priv->buffer == NULL)
{
@ -461,8 +389,6 @@ clutter_canvas_emit_draw (ClutterCanvas *self)
mapped_buffer = FALSE;
}
cairo_surface_set_device_scale (surface, window_scale, window_scale);
self->priv->cr = cr = cairo_create (surface);
g_signal_emit (self, canvas_signals[DRAW], 0,
@ -636,81 +562,3 @@ clutter_canvas_set_size (ClutterCanvas *canvas,
return clutter_canvas_invalidate_internal (canvas, width, height);
}
/**
* clutter_canvas_set_scale_factor:
* @canvas: a #ClutterCanvas
* @scale: the scale factor, or -1 for the default
*
* Sets the scaling factor for the Cairo surface used by @canvas.
*
* This function should rarely be used.
*
* The default scaling factor of a #ClutterCanvas content uses the
* #ClutterSettings:window-scaling-factor property, which is set by
* the windowing system. By using this function it is possible to
* override that setting.
*
* Changing the scale factor will invalidate the @canvas.
*
* Since: 1.18
*/
void
clutter_canvas_set_scale_factor (ClutterCanvas *canvas,
int scale)
{
ClutterCanvasPrivate *priv;
GObject *obj;
g_return_if_fail (CLUTTER_IS_CANVAS (canvas));
g_return_if_fail (scale != 0);
priv = canvas->priv;
if (scale < 0)
{
if (!priv->scale_factor_set)
return;
priv->scale_factor_set = FALSE;
priv->scale_factor = -1;
}
else
{
if (priv->scale_factor_set && priv->scale_factor == scale)
return;
priv->scale_factor_set = TRUE;
priv->scale_factor = scale;
}
clutter_content_invalidate (CLUTTER_CONTENT (canvas));
obj = G_OBJECT (canvas);
g_object_notify_by_pspec (obj, obj_props[PROP_SCALE_FACTOR]);
g_object_notify_by_pspec (obj, obj_props[PROP_SCALE_FACTOR_SET]);
}
/**
* clutter_canvas_get_scale_factor:
* @canvas: a #ClutterCanvas
*
* Retrieves the scaling factor of @canvas, as set using
* clutter_canvas_set_scale_factor().
*
* Return value: the scaling factor, or -1 if the @canvas
* uses the default from #ClutterSettings
*
* Since: 1.18
*/
int
clutter_canvas_get_scale_factor (ClutterCanvas *canvas)
{
g_return_val_if_fail (CLUTTER_IS_CANVAS (canvas), -1);
if (!canvas->priv->scale_factor_set)
return -1;
return canvas->priv->scale_factor;
}

View File

@ -77,9 +77,7 @@ struct _ClutterSettings
guint password_hint_time;
gint window_scaling_factor;
gint unscaled_font_dpi;
guint fixed_scaling_factor : 1;
};
struct _ClutterSettingsClass
@ -112,7 +110,6 @@ enum
PROP_PASSWORD_HINT_TIME,
PROP_WINDOW_SCALING_FACTOR,
PROP_UNSCALED_FONT_DPI,
PROP_LAST
@ -355,14 +352,6 @@ clutter_settings_set_property (GObject *gobject,
self->password_hint_time = g_value_get_uint (value);
break;
case PROP_WINDOW_SCALING_FACTOR:
if (!self->fixed_scaling_factor)
{
self->window_scaling_factor = g_value_get_int (value);
self->fixed_scaling_factor = TRUE;
}
break;
case PROP_UNSCALED_FONT_DPI:
self->font_dpi = g_value_get_int (value);
settings_update_resolution (self);
@ -382,14 +371,7 @@ clutter_settings_set_property_internal (ClutterSettings *self,
property = g_intern_string (property);
if (property == I_("window-scaling-factor") &&
self->fixed_scaling_factor)
return;
g_object_set_property (G_OBJECT (self), property, value);
if (property == I_("window-scaling-factor"))
self->fixed_scaling_factor = FALSE;
}
static void
@ -446,10 +428,6 @@ clutter_settings_get_property (GObject *gobject,
g_value_set_uint (value, self->password_hint_time);
break;
case PROP_WINDOW_SCALING_FACTOR:
g_value_set_int (value, self->window_scaling_factor);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@ -677,14 +655,6 @@ clutter_settings_class_init (ClutterSettingsClass *klass)
500,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_WINDOW_SCALING_FACTOR] =
g_param_spec_int ("window-scaling-factor",
P_("Window Scaling Factor"),
P_("The scaling factor to be applied to windows"),
1, G_MAXINT,
1,
CLUTTER_PARAM_READWRITE);
obj_props[PROP_FONTCONFIG_TIMESTAMP] =
g_param_spec_uint ("fontconfig-timestamp",
P_("Fontconfig configuration timestamp"),
@ -722,8 +692,6 @@ clutter_settings_class_init (ClutterSettingsClass *klass)
static void
clutter_settings_init (ClutterSettings *self)
{
const char *scale_str;
self->resolution = -1.0;
self->font_dpi = -1;
@ -742,18 +710,6 @@ clutter_settings_init (ClutterSettings *self)
self->xft_rgba = NULL;
self->long_press_duration = 500;
/* if the scaling factor was set by the environment we ignore
* any explicit setting
*/
scale_str = g_getenv ("CLUTTER_SCALE");
if (scale_str != NULL)
{
self->window_scaling_factor = atol (scale_str);
self->fixed_scaling_factor = TRUE;
}
else
self->window_scaling_factor = 1;
}
/**

View File

@ -303,33 +303,6 @@ _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window)
return FALSE;
}
void
_clutter_stage_window_set_scale_factor (ClutterStageWindow *window,
int factor)
{
ClutterStageWindowIface *iface;
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->set_scale_factor != NULL)
iface->set_scale_factor (window, factor);
}
int
_clutter_stage_window_get_scale_factor (ClutterStageWindow *window)
{
ClutterStageWindowIface *iface;
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), 1);
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
if (iface->get_scale_factor != NULL)
return iface->get_scale_factor (window);
return 1;
}
GList *
_clutter_stage_window_get_views (ClutterStageWindow *window)
{

View File

@ -83,9 +83,6 @@ struct _ClutterStageWindowIface
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
void (* set_scale_factor) (ClutterStageWindow *stage_window,
int factor);
int (* get_scale_factor) (ClutterStageWindow *stage_window);
GList *(* get_views) (ClutterStageWindow *stage_window);
int64_t (* get_frame_counter) (ClutterStageWindow *stage_window);
void (* finish_frame) (ClutterStageWindow *stage_window);
@ -140,10 +137,6 @@ void _clutter_stage_window_get_dirty_pixel (ClutterStageWin
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
void _clutter_stage_window_set_scale_factor (ClutterStageWindow *window,
int factor);
int _clutter_stage_window_get_scale_factor (ClutterStageWindow *window);
GList * _clutter_stage_window_get_views (ClutterStageWindow *window);
void _clutter_stage_window_finish_frame (ClutterStageWindow *window);

View File

@ -364,7 +364,6 @@ clutter_stage_allocate (ClutterActor *self,
float new_width, new_height;
float width, height;
cairo_rectangle_int_t window_size;
int scale_factor;
if (priv->impl == NULL)
return;
@ -465,11 +464,6 @@ clutter_stage_allocate (ClutterActor *self,
*/
_clutter_stage_window_get_geometry (priv->impl, &window_size);
scale_factor = _clutter_stage_window_get_scale_factor (priv->impl);
window_size.width *= scale_factor;
window_size.height *= scale_factor;
cogl_onscreen_clutter_backend_set_size (window_size.width,
window_size.height);
@ -630,15 +624,13 @@ clutter_stage_do_paint_view (ClutterStage *stage,
float clip_poly[8];
float viewport[4];
cairo_rectangle_int_t geom;
int window_scale;
_clutter_stage_window_get_geometry (priv->impl, &geom);
window_scale = _clutter_stage_window_get_scale_factor (priv->impl);
viewport[0] = priv->viewport[0] * window_scale;
viewport[1] = priv->viewport[1] * window_scale;
viewport[2] = priv->viewport[2] * window_scale;
viewport[3] = priv->viewport[3] * window_scale;
viewport[0] = priv->viewport[0];
viewport[1] = priv->viewport[1];
viewport[2] = priv->viewport[2];
viewport[3] = priv->viewport[3];
if (!clip)
{
@ -646,16 +638,14 @@ clutter_stage_do_paint_view (ClutterStage *stage,
clip = &view_layout;
}
clip_poly[0] = MAX (clip->x * window_scale, 0);
clip_poly[1] = MAX (clip->y * window_scale, 0);
clip_poly[0] = MAX (clip->x, 0);
clip_poly[1] = MAX (clip->y, 0);
clip_poly[2] = MIN ((clip->x + clip->width) * window_scale,
geom.width * window_scale);
clip_poly[2] = MIN (clip->x + clip->width, geom.width);
clip_poly[3] = clip_poly[1];
clip_poly[4] = clip_poly[2];
clip_poly[5] = MIN ((clip->y + clip->height) * window_scale,
geom.height * window_scale);
clip_poly[5] = MIN (clip->y + clip->height, geom.height);
clip_poly[6] = clip_poly[0];
clip_poly[7] = clip_poly[5];
@ -1378,9 +1368,7 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
gint dirty_y;
gint read_x;
gint read_y;
int window_scale;
float fb_width, fb_height;
int view_scale;
int fb_scale;
int viewport_offset_x;
int viewport_offset_y;
@ -1388,13 +1376,11 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
priv = stage->priv;
context = _clutter_context_get_default ();
window_scale = _clutter_stage_window_get_scale_factor (priv->impl);
view_scale = clutter_stage_view_get_scale (view);
fb_scale = window_scale * view_scale;
fb_scale = clutter_stage_view_get_scale (view);
clutter_stage_view_get_layout (view, &view_layout);
fb_width = view_layout.width * view_scale;
fb_height = view_layout.height * view_scale;
fb_width = view_layout.width * fb_scale;
fb_height = view_layout.height * fb_scale;
cogl_push_framebuffer (fb);
/* needed for when a context switch happens */
@ -1404,8 +1390,8 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
* picking to not work at all, so setting it the whole framebuffer content
* for now. */
cogl_framebuffer_push_scissor_clip (fb, 0, 0,
view_layout.width * view_scale,
view_layout.height * view_scale);
view_layout.width * fb_scale,
view_layout.height * fb_scale);
_clutter_stage_window_get_dirty_pixel (priv->impl, view, &dirty_x, &dirty_y);
@ -1435,7 +1421,7 @@ _clutter_stage_do_pick_on_view (ClutterStage *stage,
CLUTTER_NOTE (PICK, "Performing pick at %i,%i on view %dx%d+%d+%d s: %d",
x, y,
view_layout.width, view_layout.height,
view_layout.x, view_layout.y, view_scale);
view_layout.x, view_layout.y, fb_scale);
cogl_color_init_from_4ub (&stage_pick_id, 255, 255, 255, 255);
cogl_clear (&stage_pick_id, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH);
@ -2214,7 +2200,6 @@ clutter_stage_init (ClutterStage *self)
ClutterStagePrivate *priv;
ClutterStageWindow *impl;
ClutterBackend *backend;
int window_scale = 1;
GError *error;
/* a stage is a top-level object */
@ -2232,7 +2217,6 @@ clutter_stage_init (ClutterStage *self)
{
_clutter_stage_set_window (self, impl);
_clutter_stage_window_get_geometry (priv->impl, &geom);
window_scale = _clutter_stage_window_get_scale_factor (priv->impl);
}
else
{
@ -2286,8 +2270,8 @@ clutter_stage_init (ClutterStage *self)
priv->perspective.aspect,
priv->perspective.z_near,
50, /* distance to 2d plane */
geom.width * window_scale,
geom.height * window_scale);
geom.width,
geom.height);
/* FIXME - remove for 2.0 */
@ -3416,16 +3400,6 @@ clutter_stage_ensure_viewport (ClutterStage *stage)
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}
static void
clutter_stage_apply_scale (ClutterStage *stage)
{
int factor;
factor = _clutter_stage_window_get_scale_factor (stage->priv->impl);
if (factor != 1)
cogl_matrix_scale (&stage->priv->view, factor, factor, 1.f);
}
# define _DEG_TO_RAD(d) ((d) * ((float) G_PI / 180.0f))
/* This calculates a distance into the view frustum to position the
@ -3572,7 +3546,6 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
{
cairo_rectangle_int_t view_layout;
ClutterPerspective perspective;
int window_scale;
int fb_scale;
int viewport_offset_x;
int viewport_offset_y;
@ -3583,8 +3556,7 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
priv->viewport[2],
priv->viewport[3]);
window_scale = _clutter_stage_window_get_scale_factor (priv->impl);
fb_scale = window_scale * clutter_stage_view_get_scale (view);
fb_scale = clutter_stage_view_get_scale (view);
clutter_stage_view_get_layout (view, &view_layout);
viewport_offset_x = view_layout.x * fb_scale;
@ -3623,10 +3595,8 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
perspective.aspect,
perspective.z_near,
z_2d,
priv->viewport[2] * window_scale,
priv->viewport[3] * window_scale);
clutter_stage_apply_scale (stage);
priv->viewport[2],
priv->viewport[3]);
clutter_stage_view_set_dirty_viewport (view, FALSE);
}
@ -4641,23 +4611,6 @@ clutter_stage_skip_sync_delay (ClutterStage *stage)
_clutter_stage_window_schedule_update (stage_window, -1);
}
void
_clutter_stage_set_scale_factor (ClutterStage *stage,
int factor)
{
ClutterStagePrivate *priv = stage->priv;
if (CLUTTER_ACTOR_IN_DESTRUCTION (stage))
return;
if (priv->impl == NULL)
return;
_clutter_stage_window_set_scale_factor (priv->impl, factor);
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
}
int64_t
clutter_stage_get_frame_counter (ClutterStage *stage)
{

View File

@ -503,7 +503,6 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
cairo_rectangle_int_t swap_region;
cairo_rectangle_int_t clip_region;
gboolean clip_region_empty;
int window_scale;
int fb_scale;
wrapper = CLUTTER_ACTOR (stage_cogl->wrapper);
@ -558,8 +557,7 @@ clutter_stage_cogl_redraw_view (ClutterStageWindow *stage_window,
clip_region_empty = may_use_clipped_redraw && clip_region.width == 0;
window_scale = _clutter_stage_window_get_scale_factor (stage_window);
fb_scale = window_scale * clutter_stage_view_get_scale (view);
fb_scale = clutter_stage_view_get_scale (view);
swap_with_damage = FALSE;
if (has_buffer_age)

View File

@ -136,7 +136,6 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
ClutterTranslateReturn res;
ClutterStage *stage;
XEvent *xevent;
int window_scale;
manager_x11 = CLUTTER_DEVICE_MANAGER_X11 (translator);
backend_x11 = CLUTTER_BACKEND_X11 (clutter_get_default_backend ());
@ -152,8 +151,6 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
stage_x11 = CLUTTER_STAGE_X11 (_clutter_stage_get_window (stage));
window_scale = stage_x11->scale_factor;
event->any.stage = stage;
res = CLUTTER_TRANSLATE_CONTINUE;
@ -226,8 +223,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->scroll.direction = CLUTTER_SCROLL_RIGHT;
event->scroll.time = xevent->xbutton.time;
event->scroll.x = xevent->xbutton.x / window_scale;
event->scroll.y = xevent->xbutton.y / window_scale;
event->scroll.x = xevent->xbutton.x;
event->scroll.y = xevent->xbutton.y;
event->scroll.modifier_state = xevent->xbutton.state;
event->scroll.axes = NULL;
break;
@ -235,8 +232,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
default:
event->button.type = event->type = CLUTTER_BUTTON_PRESS;
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x / window_scale;
event->button.y = xevent->xbutton.y / window_scale;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.modifier_state = xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->button.axes = NULL;
@ -269,8 +266,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->button.type = event->type = CLUTTER_BUTTON_RELEASE;
event->button.time = xevent->xbutton.time;
event->button.x = xevent->xbutton.x / window_scale;
event->button.y = xevent->xbutton.y / window_scale;
event->button.x = xevent->xbutton.x;
event->button.y = xevent->xbutton.y;
event->button.modifier_state = xevent->xbutton.state;
event->button.button = xevent->xbutton.button;
event->button.axes = NULL;
@ -287,8 +284,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->motion.type = event->type = CLUTTER_MOTION;
event->motion.time = xevent->xmotion.time;
event->motion.x = xevent->xmotion.x / window_scale;
event->motion.y = xevent->xmotion.y / window_scale;
event->motion.x = xevent->xmotion.x;
event->motion.y = xevent->xmotion.y;
event->motion.modifier_state = xevent->xmotion.state;
event->motion.axes = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);
@ -301,8 +298,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->crossing.type = CLUTTER_ENTER;
event->crossing.time = xevent->xcrossing.time;
event->crossing.x = xevent->xcrossing.x / window_scale;
event->crossing.y = xevent->xcrossing.y / window_scale;
event->crossing.x = xevent->xcrossing.x;
event->crossing.y = xevent->xcrossing.y;
event->crossing.source = CLUTTER_ACTOR (stage);
event->crossing.related = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);
@ -327,8 +324,8 @@ clutter_device_manager_x11_translate_event (ClutterEventTranslator *translator,
event->crossing.type = CLUTTER_LEAVE;
event->crossing.time = xevent->xcrossing.time;
event->crossing.x = xevent->xcrossing.x / window_scale;
event->crossing.y = xevent->xcrossing.y / window_scale;
event->crossing.x = xevent->xcrossing.x;
event->crossing.y = xevent->xcrossing.y;
event->crossing.source = CLUTTER_ACTOR (stage);
event->crossing.related = NULL;
clutter_event_set_device (event, manager_x11->core_pointer);

View File

@ -861,8 +861,8 @@ translate_coords (ClutterStageX11 *stage_x11,
clutter_actor_get_size (stage, &stage_width, &stage_height);
*x_out = CLAMP (event_x / stage_x11->scale_factor, 0, stage_width);
*y_out = CLAMP (event_y / stage_x11->scale_factor, 0, stage_height);
*x_out = CLAMP (event_x, 0, stage_width);
*y_out = CLAMP (event_y, 0, stage_height);
}
static gdouble

View File

@ -15,7 +15,6 @@ static const struct {
{ "Xft/HintStyle", "font-hint-style" },
{ "Xft/RGBA", "font-subpixel-order" },
{ "Fontconfig/Timestamp", "fontconfig-timestamp" },
{ "Gdk/WindowScalingFactor", "window-scaling-factor" },
{ "Gdk/UnscaledDPI", "unscaled-font-dpi" },
};

View File

@ -162,10 +162,10 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
&min_height);
if (new_width <= 0)
new_width = min_width * stage_x11->scale_factor;
new_width = min_width;
if (new_height <= 0)
new_height = min_height * stage_x11->scale_factor;
new_height = min_height;
size_hints->flags = 0;
@ -175,8 +175,8 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11,
{
if (resize)
{
size_hints->min_width = min_width * stage_x11->scale_factor;
size_hints->min_height = min_height * stage_x11->scale_factor;
size_hints->min_width = min_width;
size_hints->min_height = min_height;
size_hints->flags = PMinSize;
}
else
@ -236,8 +236,8 @@ clutter_stage_x11_get_geometry (ClutterStageWindow *stage_window,
return;
}
geometry->width = stage_x11->xwin_width / stage_x11->scale_factor;
geometry->height = stage_x11->xwin_height / stage_x11->scale_factor;
geometry->width = stage_x11->xwin_width;
geometry->height = stage_x11->xwin_height;
}
static void
@ -255,8 +255,8 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
* so we need to manually set the size and queue a relayout on the
* stage here (as is normally done in response to ConfigureNotify).
*/
stage_x11->xwin_width = width * stage_x11->scale_factor;
stage_x11->xwin_height = height * stage_x11->scale_factor;
stage_x11->xwin_width = width;
stage_x11->xwin_height = height;
clutter_actor_queue_relayout (CLUTTER_ACTOR (stage_cogl->wrapper));
return;
}
@ -277,9 +277,6 @@ clutter_stage_x11_resize (ClutterStageWindow *stage_window,
CLUTTER_NOTE (BACKEND, "New size received: (%d, %d)", width, height);
width *= stage_x11->scale_factor;
height *= stage_x11->scale_factor;
if (stage_x11->xwin != None)
{
clutter_stage_x11_fix_window_size (stage_x11, width, height);
@ -400,20 +397,6 @@ set_cursor_visible (ClutterStageX11 *stage_x11)
}
}
static void
on_window_scaling_factor_notify (GObject *settings,
GParamSpec *pspec,
ClutterStageX11 *stage_x11)
{
g_object_get (settings,
"window-scaling-factor", &stage_x11->scale_factor,
NULL);
clutter_stage_x11_resize (CLUTTER_STAGE_WINDOW (stage_x11),
stage_x11->xwin_width,
stage_x11->xwin_height);
}
static void
clutter_stage_x11_unrealize (ClutterStageWindow *stage_window)
{
@ -643,12 +626,8 @@ clutter_stage_x11_realize (ClutterStageWindow *stage_window)
CLUTTER_NOTE (BACKEND, "Wrapper size: %.2f x %.2f", width, height);
width = width * (float) stage_x11->scale_factor;
height = height * (float) stage_x11->scale_factor;
CLUTTER_NOTE (BACKEND, "Creating a new Cogl onscreen surface: %.2f x %.2f (factor: %d)",
width, height,
stage_x11->scale_factor);
CLUTTER_NOTE (BACKEND, "Creating a new Cogl onscreen surface: %.2f x %.2f",
width, height);
stage_x11->onscreen = cogl_onscreen_new (backend->cogl_context, width, height);
@ -909,28 +888,6 @@ clutter_stage_x11_can_clip_redraws (ClutterStageWindow *stage_window)
return stage_x11->clipped_redraws_cool_off == 0;
}
static void
clutter_stage_x11_set_scale_factor (ClutterStageWindow *stage_window,
int factor)
{
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
if (stage_x11->scale_factor == factor)
return;
stage_x11->scale_factor = factor;
clutter_stage_x11_resize (stage_window, stage_x11->xwin_width, stage_x11->xwin_height);
}
static int
clutter_stage_x11_get_scale_factor (ClutterStageWindow *stage_window)
{
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_window);
return stage_x11->scale_factor;
}
static void
ensure_legacy_view (ClutterStageWindow *stage_window)
{
@ -1002,8 +959,6 @@ clutter_stage_x11_class_init (ClutterStageX11Class *klass)
static void
clutter_stage_x11_init (ClutterStageX11 *stage)
{
ClutterSettings *settings;
stage->xwin = None;
stage->xwin_width = 640;
stage->xwin_height = 480;
@ -1016,12 +971,6 @@ clutter_stage_x11_init (ClutterStageX11 *stage)
stage->accept_focus = TRUE;
stage->title = NULL;
settings = clutter_settings_get_default ();
g_signal_connect (settings, "notify::window-scaling-factor",
G_CALLBACK (on_window_scaling_factor_notify),
stage);
on_window_scaling_factor_notify (G_OBJECT (settings), NULL, stage);
}
static void
@ -1041,8 +990,6 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
iface->realize = clutter_stage_x11_realize;
iface->unrealize = clutter_stage_x11_unrealize;
iface->can_clip_redraws = clutter_stage_x11_can_clip_redraws;
iface->set_scale_factor = clutter_stage_x11_set_scale_factor;
iface->get_scale_factor = clutter_stage_x11_get_scale_factor;
iface->get_views = clutter_stage_x11_get_views;
iface->get_frame_counter = clutter_stage_x11_get_frame_counter;
}
@ -1167,8 +1114,8 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
stage_x11->xwin_height = xevent->xconfigure.height;
}
stage_width = xevent->xconfigure.width / stage_x11->scale_factor;
stage_height = xevent->xconfigure.height / stage_x11->scale_factor;
stage_width = xevent->xconfigure.width;
stage_height = xevent->xconfigure.height;
clutter_actor_set_size (CLUTTER_ACTOR (stage), stage_width, stage_height);
if (size_changed)
@ -1335,10 +1282,10 @@ clutter_stage_x11_translate_event (ClutterEventTranslator *translator,
expose->width,
expose->height);
clip.x = expose->x / stage_x11->scale_factor;
clip.y = expose->y / stage_x11->scale_factor;
clip.width = expose->width / stage_x11->scale_factor;
clip.height = expose->height / stage_x11->scale_factor;
clip.x = expose->x;
clip.y = expose->y;
clip.width = expose->width;
clip.height = expose->height;
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &clip);
}
break;
@ -1504,8 +1451,8 @@ set_foreign_window_callback (ClutterActor *actor,
fwd->stage_x11->xwin = fwd->xwindow;
fwd->stage_x11->is_foreign_xwin = TRUE;
fwd->stage_x11->xwin_width = fwd->geom.width * fwd->stage_x11->scale_factor;
fwd->stage_x11->xwin_height = fwd->geom.height * fwd->stage_x11->scale_factor;
fwd->stage_x11->xwin_width = fwd->geom.width;
fwd->stage_x11->xwin_height = fwd->geom.height;
clutter_actor_set_size (actor, fwd->geom.width, fwd->geom.height);
@ -1599,8 +1546,8 @@ clutter_x11_set_stage_foreign (ClutterStage *stage,
fwd.geom.x = x;
fwd.geom.y = y;
fwd.geom.width = width / stage_x11->scale_factor;
fwd.geom.height = height / stage_x11->scale_factor;
fwd.geom.width = width;
fwd.geom.height = height;
actor = CLUTTER_ACTOR (stage);

View File

@ -69,8 +69,6 @@ struct _ClutterStageX11
ClutterStageX11State wm_state;
int scale_factor;
guint is_foreign_xwin : 1;
guint fullscreening : 1;
guint is_cursor_visible : 1;

View File

@ -948,7 +948,6 @@ meta_init_backend (GType backend_gtype)
void
meta_clutter_init (void)
{
ClutterSettings *clutter_settings;
GSource *source;
clutter_set_custom_backend_func (meta_get_clutter_backend);
@ -959,13 +958,6 @@ meta_clutter_init (void)
exit (1);
}
/*
* XXX: We cannot handle high dpi scaling yet, so fix the scale to 1
* for now.
*/
clutter_settings = clutter_settings_get_default ();
g_object_set (clutter_settings, "window-scaling-factor", 1, NULL);
source = g_source_new (&event_funcs, sizeof (GSource));
g_source_attach (source, NULL);
g_source_unref (source);