window: Unmanage rule placed window if ending up outside of parent

If a client maps a persistent popup with a placement rule, then resizes
the parent window so that the popup ends up outside of the parent,
unmanage the popup and log a warning about the client being buggy.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/496
This commit is contained in:
Jonas Ådahl
2018-10-18 16:24:18 +02:00
committed by Florian Müllner
parent f2d7165a52
commit b4f1569640
3 changed files with 62 additions and 0 deletions

View File

@@ -1424,6 +1424,9 @@ meta_window_unmanage (MetaWindow *window,
meta_verbose ("Unmanaging %s\n", window->desc);
window->unmanaging = TRUE;
if (window->unmanage_idle_id)
g_source_remove (window->unmanage_idle_id);
#ifdef HAVE_WAYLAND
/* This needs to happen for both Wayland and XWayland clients,
* so it can't be in MetaWindowWayland. */
@@ -1595,6 +1598,32 @@ meta_window_unmanage (MetaWindow *window,
g_object_unref (window);
}
static gboolean
unmanage_window_idle_callback (gpointer user_data)
{
MetaWindow *window = META_WINDOW (user_data);
uint32_t timestamp;
window->unmanage_idle_id = 0;
timestamp = meta_display_get_current_time_roundtrip (window->display);
meta_window_unmanage (window, timestamp);
return G_SOURCE_REMOVE;
}
void
meta_window_unmanage_on_idle (MetaWindow *window)
{
if (window->unmanage_idle_id)
return;
window->unmanage_idle_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE,
unmanage_window_idle_callback,
window,
NULL);
}
static void
set_wm_state (MetaWindow *window)
{