wayland: Sync surface actor state when changing main monitor

In order to switch to the correct surface actor scale given the monitor
the surface is on, without relying on the client committing a new state
given some other side effect, sync the surface actor state when the main
monitor associated with the corresponding window changed.

https://bugzilla.gnome.org/show_bug.cgi?id=744933
This commit is contained in:
Jonas Ådahl
2015-03-03 11:13:05 +08:00
committed by Ray Strode
parent adf7c0e730
commit fffb863f37
6 changed files with 64 additions and 6 deletions

View File

@ -482,6 +482,8 @@ struct _MetaWindowClass
gboolean (*update_icon) (MetaWindow *window,
cairo_surface_t **icon,
cairo_surface_t **mini_icon);
void (*main_monitor_changed) (MetaWindow *window,
const MetaMonitorInfo *old);
};
/* These differ from window->has_foo_func in that they consider

View File

@ -761,6 +761,20 @@ meta_window_update_desc (MetaWindow *window)
window->desc = g_strdup_printf ("0x%lx", window->xwindow);
}
static void
meta_window_main_monitor_changed (MetaWindow *window,
const MetaMonitorInfo *old)
{
META_WINDOW_GET_CLASS (window)->main_monitor_changed (window, old);
if (old)
g_signal_emit_by_name (window->screen, "window-left-monitor",
old->number, window);
if (window->monitor)
g_signal_emit_by_name (window->screen, "window-entered-monitor",
window->monitor->number, window);
}
MetaWindow *
_meta_window_shared_new (MetaDisplay *display,
MetaScreen *screen,
@ -1128,7 +1142,7 @@ _meta_window_shared_new (MetaDisplay *display,
meta_window_update_struts (window);
}
g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
meta_window_main_monitor_changed (window, NULL);
/* Must add window to stack before doing move/resize, since the
* window might have fullscreen size (i.e. should have been
@ -1369,9 +1383,10 @@ meta_window_unmanage (MetaWindow *window,
if (window->monitor)
{
g_signal_emit_by_name (window->screen, "window-left-monitor",
window->monitor->number, window);
const MetaMonitorInfo *old = window->monitor;
window->monitor = NULL;
meta_window_main_monitor_changed (window, old);
}
if (!window->override_redirect)
@ -3568,9 +3583,7 @@ meta_window_update_monitor (MetaWindow *window,
window->screen->active_workspace != window->workspace)
meta_window_change_workspace (window, window->screen->active_workspace);
if (old)
g_signal_emit_by_name (window->screen, "window-left-monitor", old->number, window);
g_signal_emit_by_name (window->screen, "window-entered-monitor", window->monitor->number, window);
meta_window_main_monitor_changed (window, old);
/* If we're changing monitors, we need to update the has_maximize_func flag,
* as the working area has changed. */