window: Move wm_client_machine to WindowX11

Also removes the public getter as nothing uses it and it no longer
make sense to expose X11-ism as API

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3584>
This commit is contained in:
Bilal Elmoussaoui 2024-02-14 14:45:01 +01:00 committed by Marge Bot
parent 692414c078
commit 09fc3e966a
6 changed files with 13 additions and 32 deletions

View File

@ -189,7 +189,6 @@ struct _MetaWindow
char *res_class; char *res_class;
char *res_name; char *res_name;
char *role; char *role;
char *wm_client_machine;
char *startup_id; char *startup_id;
char *mutter_hints; char *mutter_hints;

View File

@ -324,7 +324,6 @@ meta_window_finalize (GObject *object)
if (window->cgroup_path) if (window->cgroup_path)
g_object_unref (window->cgroup_path); g_object_unref (window->cgroup_path);
g_free (window->wm_client_machine);
g_free (window->startup_id); g_free (window->startup_id);
g_free (window->role); g_free (window->role);
g_free (window->res_class); g_free (window->res_class);
@ -1097,7 +1096,6 @@ meta_window_constructed (GObject *object)
window->res_class = NULL; window->res_class = NULL;
window->res_name = NULL; window->res_name = NULL;
window->role = NULL; window->role = NULL;
window->wm_client_machine = NULL;
window->is_remote = FALSE; window->is_remote = FALSE;
window->startup_id = NULL; window->startup_id = NULL;
@ -6815,25 +6813,6 @@ meta_window_unit_cgroup_equal (MetaWindow *window1,
return g_file_equal (window1_file, window2_file); return g_file_equal (window1_file, window2_file);
} }
/**
* meta_window_get_client_machine:
* @window: a #MetaWindow
*
* Returns name of the client machine from which this windows was created,
* if known (obtained from the WM_CLIENT_MACHINE property).
*
* Returns: (transfer none) (nullable): the machine name, or %NULL; the string
* is owned by the window manager and should not be freed or modified by the
* caller.
*/
const char *
meta_window_get_client_machine (MetaWindow *window)
{
g_return_val_if_fail (META_IS_WINDOW (window), NULL);
return window->wm_client_machine;
}
/** /**
* meta_window_is_remote: * meta_window_is_remote:
* @window: a #MetaWindow * @window: a #MetaWindow

View File

@ -332,9 +332,6 @@ guint32 meta_window_get_user_time (MetaWindow *window);
META_EXPORT META_EXPORT
pid_t meta_window_get_pid (MetaWindow *window); pid_t meta_window_get_pid (MetaWindow *window);
META_EXPORT
const char *meta_window_get_client_machine (MetaWindow *window);
META_EXPORT META_EXPORT
gboolean meta_window_is_remote (MetaWindow *window); gboolean meta_window_is_remote (MetaWindow *window);

View File

@ -211,16 +211,18 @@ reload_wm_client_machine (MetaWindow *window,
MetaPropValue *value, MetaPropValue *value,
gboolean initial) gboolean initial)
{ {
g_free (window->wm_client_machine); MetaWindowX11Private *priv =
window->wm_client_machine = NULL; meta_window_x11_get_private (META_WINDOW_X11 (window));
g_clear_pointer (&priv->wm_client_machine, g_free);
if (value->type != META_PROP_VALUE_INVALID) if (value->type != META_PROP_VALUE_INVALID)
window->wm_client_machine = g_strdup (value->v.str); priv->wm_client_machine = g_strdup (value->v.str);
meta_verbose ("Window has client machine \"%s\"", meta_verbose ("Window has client machine \"%s\"",
window->wm_client_machine ? window->wm_client_machine : "unset"); priv->wm_client_machine ? priv->wm_client_machine : "unset");
if (window->wm_client_machine == NULL) if (priv->wm_client_machine == NULL)
{ {
window->is_remote = FALSE; window->is_remote = FALSE;
} }
@ -230,7 +232,7 @@ reload_wm_client_machine (MetaWindow *window,
gethostname (hostname, HOST_NAME_MAX + 1); gethostname (hostname, HOST_NAME_MAX + 1);
window->is_remote = g_strcmp0 (window->wm_client_machine, hostname) != 0; window->is_remote = g_strcmp0 (priv->wm_client_machine, hostname) != 0;
} }
} }
@ -503,6 +505,8 @@ set_title_text (MetaWindow *window,
Atom atom, Atom atom,
char **target) char **target)
{ {
MetaWindowX11Private *priv =
meta_window_x11_get_private (META_WINDOW_X11 (window));
gboolean modified = FALSE; gboolean modified = FALSE;
if (!target) if (!target)
@ -522,7 +526,7 @@ set_title_text (MetaWindow *window,
else if (meta_window_is_remote (window)) else if (meta_window_is_remote (window))
{ {
*target = g_strdup_printf (_("%s (on %s)"), *target = g_strdup_printf (_("%s (on %s)"),
title, window->wm_client_machine); title, priv->wm_client_machine);
modified = TRUE; modified = TRUE;
} }
else else

View File

@ -96,6 +96,7 @@ struct _MetaWindowX11Private
gboolean keys_grabbed; /* normal keybindings grabbed */ gboolean keys_grabbed; /* normal keybindings grabbed */
gboolean grab_on_frame; /* grabs are on the frame */ gboolean grab_on_frame; /* grabs are on the frame */
char *wm_client_machine;
char *sm_client_id; char *sm_client_id;
}; };

View File

@ -2149,6 +2149,7 @@ meta_window_x11_finalize (GObject *object)
MetaWindowX11 *win = META_WINDOW_X11 (object); MetaWindowX11 *win = META_WINDOW_X11 (object);
MetaWindowX11Private *priv = meta_window_x11_get_instance_private (win); MetaWindowX11Private *priv = meta_window_x11_get_instance_private (win);
g_clear_pointer (&priv->wm_client_machine, g_free);
g_clear_pointer (&priv->sm_client_id, g_free); g_clear_pointer (&priv->sm_client_id, g_free);
G_OBJECT_CLASS (meta_window_x11_parent_class)->finalize (object); G_OBJECT_CLASS (meta_window_x11_parent_class)->finalize (object);