mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 06:21:14 +00:00
Remove GtkWindow::role
...and the setter/getter for it. This is a very old X session management thing, and you will be hard-pressed to find a session manager that can make use of it, and even harder-pressed to find apps using it to their advantage.
This commit is contained in:
parent
be944e0a31
commit
2f358469af
@ -4735,7 +4735,6 @@ gtk_window_set_urgency_hint
|
||||
gtk_window_set_accept_focus
|
||||
gtk_window_set_focus_on_map
|
||||
gtk_window_set_startup_id
|
||||
gtk_window_set_role
|
||||
gtk_window_get_decorated
|
||||
gtk_window_get_deletable
|
||||
gtk_window_get_default_icon_name
|
||||
@ -4744,7 +4743,6 @@ gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_icon_name
|
||||
gtk_window_get_mnemonic_modifier
|
||||
gtk_window_get_modal
|
||||
gtk_window_get_role
|
||||
gtk_window_get_size
|
||||
gtk_window_get_title
|
||||
gtk_window_get_transient_for
|
||||
|
@ -204,7 +204,6 @@ typedef struct
|
||||
|
||||
gchar *startup_id;
|
||||
gchar *title;
|
||||
gchar *wm_role;
|
||||
|
||||
guint keys_changed_handler;
|
||||
|
||||
@ -312,7 +311,6 @@ enum {
|
||||
|
||||
/* Normal Props */
|
||||
PROP_TITLE,
|
||||
PROP_ROLE,
|
||||
PROP_RESIZABLE,
|
||||
PROP_MODAL,
|
||||
PROP_WIN_POS,
|
||||
@ -830,13 +828,6 @@ gtk_window_class_init (GtkWindowClass *klass)
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE);
|
||||
|
||||
window_props[PROP_ROLE] =
|
||||
g_param_spec_string ("role",
|
||||
P_("Window Role"),
|
||||
P_("Unique identifier for the window to be used when restoring a session"),
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE);
|
||||
|
||||
/**
|
||||
* GtkWindow:startup-id:
|
||||
*
|
||||
@ -1824,7 +1815,6 @@ gtk_window_init (GtkWindow *window)
|
||||
gtk_widget_set_has_surface (widget, TRUE);
|
||||
|
||||
priv->title = NULL;
|
||||
priv->wm_role = NULL;
|
||||
priv->geometry_info = NULL;
|
||||
priv->type = GTK_WINDOW_TOPLEVEL;
|
||||
priv->focus_widget = NULL;
|
||||
@ -1966,9 +1956,6 @@ gtk_window_set_property (GObject *object,
|
||||
case PROP_TITLE:
|
||||
gtk_window_set_title (window, g_value_get_string (value));
|
||||
break;
|
||||
case PROP_ROLE:
|
||||
gtk_window_set_role (window, g_value_get_string (value));
|
||||
break;
|
||||
case PROP_STARTUP_ID:
|
||||
gtk_window_set_startup_id (window, g_value_get_string (value));
|
||||
break;
|
||||
@ -2072,9 +2059,6 @@ gtk_window_get_property (GObject *object,
|
||||
case PROP_TYPE:
|
||||
g_value_set_enum (value, priv->type);
|
||||
break;
|
||||
case PROP_ROLE:
|
||||
g_value_set_string (value, priv->wm_role);
|
||||
break;
|
||||
case PROP_TITLE:
|
||||
g_value_set_string (value, priv->title);
|
||||
break;
|
||||
@ -2525,47 +2509,6 @@ gtk_window_get_title (GtkWindow *window)
|
||||
return priv->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_window_set_role:
|
||||
* @window: a #GtkWindow
|
||||
* @role: unique identifier for the window to be used when restoring a session
|
||||
*
|
||||
* This function is only useful on X11, not with other GTK+ targets.
|
||||
*
|
||||
* In combination with the window title, the window role allows a
|
||||
* [window manager][gtk-X11-arch] to identify "the
|
||||
* same" window when an application is restarted. So for example you
|
||||
* might set the “toolbox” role on your app’s toolbox window, so that
|
||||
* when the user restarts their session, the window manager can put
|
||||
* the toolbox back in the same place.
|
||||
*
|
||||
* If a window already has a unique title, you don’t need to set the
|
||||
* role, since the WM can use the title to identify the window when
|
||||
* restoring the session.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gtk_window_set_role (GtkWindow *window,
|
||||
const gchar *role)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
GtkWidget *widget;
|
||||
char *new_role;
|
||||
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
|
||||
widget = GTK_WIDGET (window);
|
||||
|
||||
new_role = g_strdup (role);
|
||||
g_free (priv->wm_role);
|
||||
priv->wm_role = new_role;
|
||||
|
||||
if (_gtk_widget_get_realized (widget))
|
||||
gdk_surface_set_role (_gtk_widget_get_surface (widget), priv->wm_role);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_ROLE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_window_set_startup_id:
|
||||
* @window: a #GtkWindow
|
||||
@ -2626,26 +2569,6 @@ gtk_window_set_startup_id (GtkWindow *window,
|
||||
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_STARTUP_ID]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_window_get_role:
|
||||
* @window: a #GtkWindow
|
||||
*
|
||||
* Returns the role of the window. See gtk_window_set_role() for
|
||||
* further explanation.
|
||||
*
|
||||
* Returns: (nullable): the role of the window if set, or %NULL. The
|
||||
* returned is owned by the widget and must not be modified or freed.
|
||||
**/
|
||||
const gchar *
|
||||
gtk_window_get_role (GtkWindow *window)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
|
||||
|
||||
return priv->wm_role;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_window_set_default:
|
||||
* @window: a #GtkWindow
|
||||
@ -5020,7 +4943,6 @@ gtk_window_finalize (GObject *object)
|
||||
GtkMnemonicHash *mnemonic_hash;
|
||||
|
||||
g_free (priv->title);
|
||||
g_free (priv->wm_role);
|
||||
gtk_window_release_application (window);
|
||||
|
||||
mnemonic_hash = gtk_window_get_mnemonic_hash (window, FALSE);
|
||||
@ -5950,9 +5872,6 @@ gtk_window_realize (GtkWidget *widget)
|
||||
if (priv->title)
|
||||
gdk_surface_set_title (surface, priv->title);
|
||||
|
||||
if (priv->wm_role)
|
||||
gdk_surface_set_role (surface, priv->wm_role);
|
||||
|
||||
if (!priv->decorated || priv->client_decorated)
|
||||
gdk_surface_set_decorations (surface, 0);
|
||||
|
||||
|
@ -146,14 +146,9 @@ void gtk_window_set_title (GtkWindow *window,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const gchar * gtk_window_get_title (GtkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_window_set_role (GtkWindow *window,
|
||||
const gchar *role);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_window_set_startup_id (GtkWindow *window,
|
||||
const gchar *startup_id);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const gchar * gtk_window_get_role (GtkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_window_add_accel_group (GtkWindow *window,
|
||||
GtkAccelGroup *accel_group);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
Loading…
Reference in New Issue
Block a user