window: Handle being headless better
This avoids updating state (such as position, size etc) when going headless. Eventually, when non-headless, things will be updated again, and not until then will we be able to update to a valid state. https://bugzilla.gnome.org/show_bug.cgi?id=730551
This commit is contained in:
parent
dcd15e6145
commit
2df4ccd1cd
@ -3584,6 +3584,8 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
|||||||
if (!new)
|
if (!new)
|
||||||
new = meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
|
new = meta_monitor_manager_get_primary_logical_monitor (monitor_manager);
|
||||||
|
|
||||||
|
if (new && old)
|
||||||
|
{
|
||||||
if (window->tile_mode != META_TILE_NONE)
|
if (window->tile_mode != META_TILE_NONE)
|
||||||
window->tile_monitor_number = new->number;
|
window->tile_monitor_number = new->number;
|
||||||
|
|
||||||
@ -3597,6 +3599,11 @@ meta_window_update_for_monitors_changed (MetaWindow *window)
|
|||||||
meta_window_move_between_rects (window,
|
meta_window_move_between_rects (window,
|
||||||
&old->rect,
|
&old->rect,
|
||||||
&new->rect);
|
&new->rect);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
meta_window_update_monitor (window, FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -3659,7 +3666,6 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
gboolean did_placement;
|
gboolean did_placement;
|
||||||
guint old_output_winsys_id;
|
|
||||||
MetaRectangle unconstrained_rect;
|
MetaRectangle unconstrained_rect;
|
||||||
MetaRectangle constrained_rect;
|
MetaRectangle constrained_rect;
|
||||||
MetaMoveResizeResultFlags result = 0;
|
MetaMoveResizeResultFlags result = 0;
|
||||||
@ -3713,7 +3719,8 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
||||||
constrained_rect = unconstrained_rect;
|
constrained_rect = unconstrained_rect;
|
||||||
if (flags & (META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION))
|
if (flags & (META_MOVE_RESIZE_MOVE_ACTION | META_MOVE_RESIZE_RESIZE_ACTION) &&
|
||||||
|
window->monitor)
|
||||||
{
|
{
|
||||||
MetaRectangle old_rect;
|
MetaRectangle old_rect;
|
||||||
meta_window_get_frame_rect (window, &old_rect);
|
meta_window_get_frame_rect (window, &old_rect);
|
||||||
@ -3763,6 +3770,10 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
did_placement);
|
did_placement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (window->monitor)
|
||||||
|
{
|
||||||
|
guint old_output_winsys_id;
|
||||||
|
|
||||||
old_output_winsys_id = window->monitor->winsys_id;
|
old_output_winsys_id = window->monitor->winsys_id;
|
||||||
|
|
||||||
meta_window_update_monitor (window, flags & META_MOVE_RESIZE_USER_ACTION);
|
meta_window_update_monitor (window, flags & META_MOVE_RESIZE_USER_ACTION);
|
||||||
@ -3770,6 +3781,11 @@ meta_window_move_resize_internal (MetaWindow *window,
|
|||||||
if (old_output_winsys_id != window->monitor->winsys_id &&
|
if (old_output_winsys_id != window->monitor->winsys_id &&
|
||||||
flags & META_MOVE_RESIZE_MOVE_ACTION && flags & META_MOVE_RESIZE_USER_ACTION)
|
flags & META_MOVE_RESIZE_MOVE_ACTION && flags & META_MOVE_RESIZE_USER_ACTION)
|
||||||
window->preferred_output_winsys_id = window->monitor->winsys_id;
|
window->preferred_output_winsys_id = window->monitor->winsys_id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
meta_window_update_monitor (window, flags & META_MOVE_RESIZE_USER_ACTION);
|
||||||
|
}
|
||||||
|
|
||||||
if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds)
|
if ((result & META_MOVE_RESIZE_RESULT_FRAME_SHAPE_CHANGED) && window->frame_bounds)
|
||||||
{
|
{
|
||||||
@ -5352,7 +5368,7 @@ meta_window_recalc_features (MetaWindow *window)
|
|||||||
window->has_maximize_func = FALSE;
|
window->has_maximize_func = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window->has_maximize_func)
|
if (window->has_maximize_func && window->monitor)
|
||||||
{
|
{
|
||||||
MetaRectangle work_area, client_rect;
|
MetaRectangle work_area, client_rect;
|
||||||
|
|
||||||
|
@ -386,12 +386,16 @@ meta_window_wayland_update_main_monitor (MetaWindow *window,
|
|||||||
if (from == to)
|
if (from == to)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (from == NULL || to == NULL)
|
||||||
|
{
|
||||||
|
window->monitor = to;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
from_scale = meta_logical_monitor_get_scale (from);
|
from_scale = meta_logical_monitor_get_scale (from);
|
||||||
to_scale = meta_logical_monitor_get_scale (to);
|
to_scale = meta_logical_monitor_get_scale (to);
|
||||||
|
|
||||||
/* If we are setting the first output, unsetting the output, or the new has
|
if (from_scale == to_scale)
|
||||||
* the same scale as the old no need to do any further checking. */
|
|
||||||
if (from == NULL || to == NULL || from_scale == to_scale)
|
|
||||||
{
|
{
|
||||||
window->monitor = to;
|
window->monitor = to;
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user