core/window: Implement GInitable
Currently, we will notify the display about a new window being created during the constructed phase of the GObject. During this time, property-change notifications are frozen by GObject, so we'll emit a few ::notify signals only after the window-created signal, although the actual property change happened before that. This caused confusion in gnome-shell code where a notify::skip-taskbar = true emission was seen when the property already was true inside a window-created handler before. In order to fix that that, we notify the window creation post-construction of the GObject on GInitable.init vfunc Details https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6119#note_1598983 Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6119 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2703>
This commit is contained in:
parent
5aa104c48d
commit
7bf07d2980
@ -158,12 +158,17 @@ static MetaWindow * meta_window_find_tile_match (MetaWindow *window,
|
||||
MetaTileMode mode);
|
||||
static void update_edge_constraints (MetaWindow *window);
|
||||
|
||||
static void initable_iface_init (GInitableIface *initable_iface);
|
||||
|
||||
typedef struct _MetaWindowPrivate
|
||||
{
|
||||
MetaQueueType queued_types;
|
||||
} MetaWindowPrivate;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaWindow, meta_window, G_TYPE_OBJECT)
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaWindow, meta_window, G_TYPE_OBJECT,
|
||||
G_ADD_PRIVATE (MetaWindow)
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
|
||||
initable_iface_init))
|
||||
|
||||
enum
|
||||
{
|
||||
@ -1366,11 +1371,28 @@ meta_window_constructed (GObject *object)
|
||||
unminimize_window_and_all_transient_parents (window);
|
||||
|
||||
window->constructing = FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_window_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
MetaWindow *window = META_WINDOW (initable);
|
||||
MetaDisplay *display = window->display;
|
||||
|
||||
meta_display_notify_window_created (display, window);
|
||||
|
||||
if (window->wm_state_demands_attention)
|
||||
g_signal_emit_by_name (display, "window-demands-attention", window);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
initable_iface_init (GInitableIface *initable_iface)
|
||||
{
|
||||
initable_iface->init = meta_window_initable_init;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -908,11 +908,12 @@ meta_window_wayland_new (MetaDisplay *display,
|
||||
MetaWindowWayland *wl_window;
|
||||
MetaWindow *window;
|
||||
|
||||
window = g_object_new (META_TYPE_WINDOW_WAYLAND,
|
||||
"display", display,
|
||||
"effect", META_COMP_EFFECT_CREATE,
|
||||
"surface", surface,
|
||||
NULL);
|
||||
window = g_initable_new (META_TYPE_WINDOW_WAYLAND,
|
||||
NULL, NULL,
|
||||
"display", display,
|
||||
"effect", META_COMP_EFFECT_CREATE,
|
||||
"surface", surface,
|
||||
NULL);
|
||||
wl_window = META_WINDOW_WAYLAND (window);
|
||||
set_geometry_scale_for_window (wl_window, wl_window->geometry_scale);
|
||||
|
||||
|
@ -3890,22 +3890,24 @@ meta_window_x11_new (MetaDisplay *display,
|
||||
#ifdef HAVE_XWAYLAND
|
||||
if (meta_is_wayland_compositor ())
|
||||
{
|
||||
window = g_object_new (META_TYPE_WINDOW_XWAYLAND,
|
||||
"display", display,
|
||||
"effect", effect,
|
||||
"attributes", &attrs,
|
||||
"xwindow", xwindow,
|
||||
NULL);
|
||||
window = g_initable_new (META_TYPE_WINDOW_XWAYLAND,
|
||||
NULL, NULL,
|
||||
"display", display,
|
||||
"effect", effect,
|
||||
"attributes", &attrs,
|
||||
"xwindow", xwindow,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
window = g_object_new (META_TYPE_WINDOW_X11,
|
||||
"display", display,
|
||||
"effect", effect,
|
||||
"attributes", &attrs,
|
||||
"xwindow", xwindow,
|
||||
NULL);
|
||||
window = g_initable_new (META_TYPE_WINDOW_X11,
|
||||
NULL, NULL,
|
||||
"display", display,
|
||||
"effect", effect,
|
||||
"attributes", &attrs,
|
||||
"xwindow", xwindow,
|
||||
NULL);
|
||||
}
|
||||
if (existing_wm_state == IconicState)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user