mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
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:
parent
adf7c0e730
commit
fffb863f37
@ -175,6 +175,23 @@ meta_surface_actor_wayland_sync_state (MetaSurfaceActorWayland *self)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_surface_actor_wayland_sync_state_recursive (MetaSurfaceActorWayland *self)
|
||||
{
|
||||
MetaWaylandSurface *surface = meta_surface_actor_wayland_get_surface (self);
|
||||
GList *iter;
|
||||
|
||||
meta_surface_actor_wayland_sync_state (self);
|
||||
|
||||
for (iter = surface->subsurfaces; iter != NULL; iter = iter->next)
|
||||
{
|
||||
MetaWaylandSurface *subsurf = iter->data;
|
||||
|
||||
meta_surface_actor_wayland_sync_state_recursive (
|
||||
META_SURFACE_ACTOR_WAYLAND (subsurf->surface_actor));
|
||||
}
|
||||
}
|
||||
|
||||
static MetaWindow *
|
||||
meta_surface_actor_wayland_get_window (MetaSurfaceActor *actor)
|
||||
{
|
||||
|
@ -65,6 +65,8 @@ double meta_surface_actor_wayland_get_scale (MetaSurfaceActorWayland *actor);
|
||||
|
||||
void meta_surface_actor_wayland_sync_state (MetaSurfaceActorWayland *self);
|
||||
|
||||
void meta_surface_actor_wayland_sync_state_recursive (MetaSurfaceActorWayland *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __META_SURFACE_ACTOR_WAYLAND_H__ */
|
||||
|
@ -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
|
||||
|
@ -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. */
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "boxes-private.h"
|
||||
#include "stack-tracker.h"
|
||||
#include "meta-wayland-surface.h"
|
||||
#include "compositor/meta-surface-actor-wayland.h"
|
||||
|
||||
struct _MetaWindowWayland
|
||||
{
|
||||
@ -270,6 +271,21 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_wayland_main_monitor_changed (MetaWindow *window,
|
||||
const MetaMonitorInfo *old)
|
||||
{
|
||||
MetaWaylandSurface *surface = window->surface;
|
||||
|
||||
if (surface)
|
||||
{
|
||||
MetaSurfaceActorWayland *actor =
|
||||
META_SURFACE_ACTOR_WAYLAND (surface->surface_actor);
|
||||
|
||||
meta_surface_actor_wayland_sync_state_recursive (actor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
appears_focused_changed (GObject *object,
|
||||
GParamSpec *pspec,
|
||||
@ -308,6 +324,7 @@ meta_window_wayland_class_init (MetaWindowWaylandClass *klass)
|
||||
window_class->grab_op_began = meta_window_wayland_grab_op_began;
|
||||
window_class->grab_op_ended = meta_window_wayland_grab_op_ended;
|
||||
window_class->move_resize_internal = meta_window_wayland_move_resize_internal;
|
||||
window_class->main_monitor_changed = meta_window_wayland_main_monitor_changed;
|
||||
}
|
||||
|
||||
MetaWindow *
|
||||
|
@ -1470,6 +1470,12 @@ meta_window_x11_update_icon (MetaWindow *window,
|
||||
META_MINI_ICON_WIDTH, META_MINI_ICON_HEIGHT);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_x11_main_monitor_changed (MetaWindow *window,
|
||||
const MetaMonitorInfo *old)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_x11_class_init (MetaWindowX11Class *klass)
|
||||
{
|
||||
@ -1488,6 +1494,7 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
|
||||
window_class->update_struts = meta_window_x11_update_struts;
|
||||
window_class->get_default_skip_hints = meta_window_x11_get_default_skip_hints;
|
||||
window_class->update_icon = meta_window_x11_update_icon;
|
||||
window_class->main_monitor_changed = meta_window_x11_main_monitor_changed;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user