window: Move sm_client_id to WindowX11
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
This commit is contained in:
parent
72326d8ca5
commit
692414c078
@ -189,7 +189,6 @@ struct _MetaWindow
|
||||
char *res_class;
|
||||
char *res_name;
|
||||
char *role;
|
||||
char *sm_client_id;
|
||||
char *wm_client_machine;
|
||||
|
||||
char *startup_id;
|
||||
|
@ -324,7 +324,6 @@ meta_window_finalize (GObject *object)
|
||||
if (window->cgroup_path)
|
||||
g_object_unref (window->cgroup_path);
|
||||
|
||||
g_free (window->sm_client_id);
|
||||
g_free (window->wm_client_machine);
|
||||
g_free (window->startup_id);
|
||||
g_free (window->role);
|
||||
@ -1098,7 +1097,6 @@ meta_window_constructed (GObject *object)
|
||||
window->res_class = NULL;
|
||||
window->res_name = NULL;
|
||||
window->role = NULL;
|
||||
window->sm_client_id = NULL;
|
||||
window->wm_client_machine = NULL;
|
||||
window->is_remote = FALSE;
|
||||
window->startup_id = NULL;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "core/util-private.h"
|
||||
#include "meta/meta-context.h"
|
||||
#include "x11/meta-x11-display-private.h"
|
||||
#include "x11/window-x11-private.h"
|
||||
|
||||
#ifndef HAVE_SM
|
||||
void
|
||||
@ -959,10 +960,12 @@ save_state (MetaContext *context)
|
||||
while (tmp != NULL)
|
||||
{
|
||||
MetaWindow *window;
|
||||
MetaWindowX11Private *priv;
|
||||
|
||||
window = tmp->data;
|
||||
priv = meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
|
||||
if (window->sm_client_id)
|
||||
if (priv->sm_client_id)
|
||||
{
|
||||
char *sm_client_id;
|
||||
char *res_class;
|
||||
@ -975,7 +978,7 @@ save_state (MetaContext *context)
|
||||
* in practice they are always ascii though.)
|
||||
*/
|
||||
|
||||
sm_client_id = encode_text_as_utf8_markup (window->sm_client_id);
|
||||
sm_client_id = encode_text_as_utf8_markup (priv->sm_client_id);
|
||||
res_class = window->res_class ?
|
||||
encode_text_as_utf8_markup (window->res_class) : NULL;
|
||||
res_name = window->res_name ?
|
||||
@ -988,7 +991,7 @@ save_state (MetaContext *context)
|
||||
title = NULL;
|
||||
|
||||
meta_topic (META_DEBUG_SM, "Saving session managed window %s, client ID '%s'",
|
||||
window->desc, window->sm_client_id);
|
||||
window->desc, priv->sm_client_id);
|
||||
|
||||
fprintf (outfile,
|
||||
" <window id=\"%s\" class=\"%s\" name=\"%s\" title=\"%s\" role=\"%s\" type=\"%s\" stacking=\"%d\">\n",
|
||||
@ -1566,10 +1569,12 @@ get_possible_matches (MetaWindow *window)
|
||||
GSList *retval;
|
||||
GSList *tmp;
|
||||
gboolean ignore_client_id;
|
||||
MetaWindowX11Private *priv;
|
||||
|
||||
retval = NULL;
|
||||
|
||||
ignore_client_id = g_getenv ("MUTTER_DEBUG_SM") != NULL;
|
||||
priv = meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
|
||||
tmp = window_info_list;
|
||||
while (tmp != NULL)
|
||||
@ -1579,7 +1584,7 @@ get_possible_matches (MetaWindow *window)
|
||||
info = tmp->data;
|
||||
|
||||
if ((ignore_client_id ||
|
||||
both_null_or_matching (info->id, window->sm_client_id)) &&
|
||||
both_null_or_matching (info->id, priv->sm_client_id)) &&
|
||||
both_null_or_matching (info->res_class, window->res_class) &&
|
||||
both_null_or_matching (info->res_name, window->res_name) &&
|
||||
both_null_or_matching (info->role, window->role))
|
||||
@ -1596,10 +1601,10 @@ get_possible_matches (MetaWindow *window)
|
||||
{
|
||||
if (meta_is_verbose ())
|
||||
{
|
||||
if (!both_null_or_matching (info->id, window->sm_client_id))
|
||||
if (!both_null_or_matching (info->id, priv->sm_client_id))
|
||||
meta_topic (META_DEBUG_SM, "Window %s has SM client ID %s, saved state has %s, no match",
|
||||
window->desc,
|
||||
window->sm_client_id ? window->sm_client_id : "(none)",
|
||||
priv->sm_client_id ? priv->sm_client_id : "(none)",
|
||||
info->id ? info->id : "(none)");
|
||||
else if (!both_null_or_matching (info->res_class, window->res_class))
|
||||
meta_topic (META_DEBUG_SM, "Window %s has class %s doesn't match saved class %s, no match",
|
||||
@ -1677,13 +1682,15 @@ meta_window_lookup_saved_state (MetaWindow *window)
|
||||
{
|
||||
GSList *possibles;
|
||||
const MetaWindowSessionInfo *info;
|
||||
MetaWindowX11Private *priv =
|
||||
meta_window_x11_get_private (META_WINDOW_X11 (window));
|
||||
|
||||
/* Window is not session managed.
|
||||
* I haven't yet figured out how to deal with these
|
||||
* in a way that doesn't cause broken side effects in
|
||||
* situations other than on session restore.
|
||||
*/
|
||||
if (window->sm_client_id == NULL)
|
||||
if (priv->sm_client_id == NULL)
|
||||
{
|
||||
meta_topic (META_DEBUG_SM,
|
||||
"Window %s is not session managed, not checking for saved state",
|
||||
|
@ -95,6 +95,8 @@ struct _MetaWindowX11Private
|
||||
/* Used by keybindings.c */
|
||||
gboolean keys_grabbed; /* normal keybindings grabbed */
|
||||
gboolean grab_on_frame; /* grabs are on the frame */
|
||||
|
||||
char *sm_client_id;
|
||||
};
|
||||
|
||||
MetaWindowX11Private * meta_window_x11_get_private (MetaWindowX11 *window_x11);
|
||||
|
@ -188,7 +188,7 @@ update_sm_hints (MetaWindow *window)
|
||||
Window leader;
|
||||
|
||||
priv->xclient_leader = None;
|
||||
window->sm_client_id = NULL;
|
||||
priv->sm_client_id = NULL;
|
||||
|
||||
/* If not on the current window, we can get the client
|
||||
* leader from transient parents. If we find a client
|
||||
@ -211,7 +211,7 @@ update_sm_hints (MetaWindow *window)
|
||||
|
||||
meta_prop_get_latin1_string (window->display->x11_display, leader,
|
||||
window->display->x11_display->atom_SM_CLIENT_ID,
|
||||
&window->sm_client_id);
|
||||
&priv->sm_client_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -225,9 +225,9 @@ update_sm_hints (MetaWindow *window)
|
||||
meta_prop_get_latin1_string (window->display->x11_display,
|
||||
priv->xwindow,
|
||||
window->display->x11_display->atom_SM_CLIENT_ID,
|
||||
&window->sm_client_id);
|
||||
&priv->sm_client_id);
|
||||
|
||||
if (window->sm_client_id)
|
||||
if (priv->sm_client_id)
|
||||
meta_warning ("Window %s sets SM_CLIENT_ID on itself, instead of on the WM_CLIENT_LEADER window as specified in the ICCCM.",
|
||||
window->desc);
|
||||
}
|
||||
@ -235,7 +235,7 @@ update_sm_hints (MetaWindow *window)
|
||||
|
||||
meta_verbose ("Window %s client leader: 0x%lx SM_CLIENT_ID: '%s'",
|
||||
window->desc, priv->xclient_leader,
|
||||
window->sm_client_id ? window->sm_client_id : "none");
|
||||
priv->sm_client_id ? priv->sm_client_id : "none");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2143,6 +2143,17 @@ meta_window_x11_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_x11_finalize (GObject *object)
|
||||
{
|
||||
MetaWindowX11 *win = META_WINDOW_X11 (object);
|
||||
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (win);
|
||||
|
||||
g_clear_pointer (&priv->sm_client_id, g_free);
|
||||
|
||||
G_OBJECT_CLASS (meta_window_x11_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_x11_class_init (MetaWindowX11Class *klass)
|
||||
{
|
||||
@ -2152,6 +2163,7 @@ meta_window_x11_class_init (MetaWindowX11Class *klass)
|
||||
object_class->get_property = meta_window_x11_get_property;
|
||||
object_class->set_property = meta_window_x11_set_property;
|
||||
object_class->constructed = meta_window_x11_constructed;
|
||||
object_class->finalize = meta_window_x11_finalize;
|
||||
|
||||
window_class->manage = meta_window_x11_manage;
|
||||
window_class->unmanage = meta_window_x11_unmanage;
|
||||
|
Loading…
Reference in New Issue
Block a user