wayland: Let MetaWaylandXdgPopup dismiss incorrectly placed popups

It's a xdg_popup detail, and not until the actual position is finalized
is the actual correctness known.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/907
This commit is contained in:
Jonas Ådahl
2019-07-26 15:03:36 +02:00
parent d02c124e1d
commit 132fbf49d7
3 changed files with 28 additions and 73 deletions

View File

@ -145,8 +145,6 @@ typedef struct
*/
GList *usable_screen_region;
GList *usable_monitor_region;
gboolean should_unmanage;
} ConstraintInfo;
static gboolean do_screen_and_monitor_relative_constraints (MetaWindow *window,
@ -255,14 +253,6 @@ do_all_constraints (MetaWindow *window,
satisfied = satisfied &&
(*constraint->func) (window, info, priority, check_only);
if (info->should_unmanage)
{
meta_topic (META_DEBUG_GEOMETRY,
"constraint %s wants to unmanage window.\n",
constraint->name);
return TRUE;
}
if (!check_only)
{
/* Log how the constraint modified the position */
@ -322,12 +312,6 @@ meta_window_constrain (MetaWindow *window,
*/
satisfied = do_all_constraints (window, &info, priority, check_only);
if (info.should_unmanage)
{
meta_window_unmanage_on_idle (window);
return;
}
/* Drop the least important constraints if we can't satisfy them all */
priority++;
}
@ -439,8 +423,6 @@ setup_constraint_info (ConstraintInfo *info,
info->usable_monitor_region =
meta_workspace_get_onmonitor_region (cur_workspace, logical_monitor);
info->should_unmanage = FALSE;
/* Log all this information for debugging */
meta_topic (META_DEBUG_GEOMETRY,
"Setting up constraint info:\n"
@ -855,27 +837,8 @@ constrain_custom_rule (MetaWindow *window,
switch (window->placement_state)
{
case META_PLACEMENT_STATE_CONSTRAINED:
{
MetaRectangle parent_buffer_rect;
meta_window_get_buffer_rect (parent, &parent_buffer_rect);
if (!meta_rectangle_overlap (&adjusted_unconstrained,
&parent_buffer_rect) &&
!meta_rectangle_is_adjacent_to (&adjusted_unconstrained,
&parent_buffer_rect))
{
g_warning ("Buggy client caused popup to be placed outside of "
"parent window");
info->should_unmanage = TRUE;
return TRUE;
}
else
{
info->current = adjusted_unconstrained;
goto done;
}
break;
}
info->current = adjusted_unconstrained;
goto done;
case META_PLACEMENT_STATE_UNCONSTRAINED:
break;
}