Commit 59b80634 authored by Marco Trevisan's avatar Marco Trevisan 🎺

compositor: Disable scaling on the unredirected window monitor

If xrandr scaling is enabled in the monitor where a fullscreen window is going
go be unredirected, we need to temporary disable the scaling on the monitor or
the window won't be presented properly and the performances will be decreased
for no reason, since in this case the control has to belong completely to the
client.

Also monitor for monitor changes to update the scaling disabling in case it
would be needed.
parent f417daff
......@@ -634,16 +634,54 @@ meta_shape_cow_for_window (MetaCompositor *compositor,
}
}
static void
on_redirected_monitor_changed (MetaWindow *window,
int old_monitor,
MetaCompositor *compositor)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
if (old_monitor >= 0 && window->monitor &&
window->monitor->number != old_monitor)
{
g_signal_handlers_block_by_func (window,
on_redirected_monitor_changed,
compositor);
meta_monitor_manager_disable_scale_for_monitor (monitor_manager,
window->monitor);
g_signal_handlers_unblock_by_func (window,
on_redirected_monitor_changed,
compositor);
}
else
meta_shape_cow_for_window (compositor, window);
}
static void
set_unredirected_window (MetaCompositor *compositor,
MetaWindow *window)
{
MetaBackend *backend;
MetaMonitorManager *monitor_manager;
if (compositor->unredirected_window == window)
return;
backend = meta_get_backend ();
monitor_manager = meta_backend_get_monitor_manager (backend);
if (compositor->unredirected_window != NULL)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
g_signal_handlers_disconnect_by_func (compositor->unredirected_window,
on_redirected_monitor_changed,
compositor);
meta_monitor_manager_disable_scale_for_monitor (monitor_manager, NULL);
meta_window_actor_set_unredirected (window_actor, FALSE);
}
......@@ -653,6 +691,13 @@ set_unredirected_window (MetaCompositor *compositor,
if (compositor->unredirected_window != NULL)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
meta_monitor_manager_disable_scale_for_monitor (monitor_manager,
window->monitor);
g_signal_connect_object (window, "monitor-changed",
G_CALLBACK (on_redirected_monitor_changed),
compositor, 0);
meta_window_actor_set_unredirected (window_actor, TRUE);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment