1
0
Fork 0

x11/stage: Resize on window-scaling-factor changes

If we get a change in the window scaling factor we want to resize the
backing store of each stage, so we use the notification on the
ClutterSettings:window-scaling-factor property to do so.

https://bugzilla.gnome.org/show_bug.cgi?id=705915
This commit is contained in:
Emmanuele Bassi 2014-01-16 12:20:36 +00:00
parent 2c8a19b8c1
commit c1c59bd898

View file

@ -381,6 +381,20 @@ 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)
{
@ -822,7 +836,12 @@ clutter_stage_x11_set_scale_factor (ClutterStageWindow *stage_window,
{
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
@ -866,6 +885,8 @@ 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;
@ -879,11 +900,11 @@ clutter_stage_x11_init (ClutterStageX11 *stage)
stage->title = NULL;
g_object_get (clutter_settings_get_default (),
"window-scaling-factor", &stage->scale_factor,
NULL);
stage->xwin_width *= stage->scale_factor;
stage->xwin_height *= stage->scale_factor;
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