mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
Merge branch 'window-api-cleanup' into 'master'
GtkWindow api cleanup See merge request GNOME/gtk!674
This commit is contained in:
commit
f89c93ea8e
@ -279,7 +279,6 @@ gdk_surface_get_children
|
||||
gdk_surface_peek_children
|
||||
gdk_surface_set_icon_name
|
||||
gdk_surface_set_transient_for
|
||||
gdk_surface_set_role
|
||||
gdk_surface_set_startup_id
|
||||
gdk_surface_set_group
|
||||
gdk_surface_get_group
|
||||
|
@ -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
|
||||
|
@ -501,12 +501,6 @@ gdk_broadway_surface_set_title (GdkSurface *surface,
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_set_role (GdkSurface *surface,
|
||||
const gchar *role)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_set_startup_id (GdkSurface *surface,
|
||||
const gchar *startup_id)
|
||||
@ -1358,7 +1352,6 @@ gdk_surface_impl_broadway_class_init (GdkSurfaceImplBroadwayClass *klass)
|
||||
impl_class->set_urgency_hint = gdk_broadway_surface_set_urgency_hint;
|
||||
impl_class->set_geometry_hints = gdk_broadway_surface_set_geometry_hints;
|
||||
impl_class->set_title = gdk_broadway_surface_set_title;
|
||||
impl_class->set_role = gdk_broadway_surface_set_role;
|
||||
impl_class->set_startup_id = gdk_broadway_surface_set_startup_id;
|
||||
impl_class->set_transient_for = gdk_broadway_surface_set_transient_for;
|
||||
impl_class->get_frame_extents = gdk_broadway_surface_get_frame_extents;
|
||||
|
@ -4230,32 +4230,6 @@ gdk_surface_set_title (GdkSurface *surface,
|
||||
GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->set_title (surface, title);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_set_role:
|
||||
* @surface: a toplevel #GdkSurface
|
||||
* @role: a string indicating its role
|
||||
*
|
||||
* When using GTK, typically you should use gtk_window_set_role() instead
|
||||
* of this low-level function.
|
||||
*
|
||||
* The window manager and session manager use a surface’s role to
|
||||
* distinguish it from other kinds of surface in the same application.
|
||||
* When an application is restarted after being saved in a previous
|
||||
* session, all surfaces with the same title and role are treated as
|
||||
* interchangeable. So if you have two surfaces with the same title
|
||||
* that should be distinguished for session management purposes, you
|
||||
* should set the role on those surfaces. It doesn’t matter what string
|
||||
* you use for the role, as long as you have a different role for each
|
||||
* non-interchangeable kind of surface.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gdk_surface_set_role (GdkSurface *surface,
|
||||
const gchar *role)
|
||||
{
|
||||
GDK_SURFACE_IMPL_GET_CLASS (surface->impl)->set_role (surface, role);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_set_startup_id:
|
||||
* @surface: a toplevel #GdkSurface
|
||||
|
@ -570,9 +570,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_title (GdkSurface *surface,
|
||||
const gchar *title);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_role (GdkSurface *surface,
|
||||
const gchar *role);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_startup_id (GdkSurface *surface,
|
||||
const gchar *startup_id);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -136,8 +136,6 @@ struct _GdkSurfaceImplClass
|
||||
GdkSurfaceHints geom_mask);
|
||||
void (* set_title) (GdkSurface *surface,
|
||||
const gchar *title);
|
||||
void (* set_role) (GdkSurface *surface,
|
||||
const gchar *role);
|
||||
void (* set_startup_id) (GdkSurface *surface,
|
||||
const gchar *startup_id);
|
||||
void (* set_transient_for) (GdkSurface *surface,
|
||||
|
@ -1739,17 +1739,6 @@ gdk_quartz_surface_set_title (GdkSurface *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_surface_set_role (GdkSurface *window,
|
||||
const gchar *role)
|
||||
{
|
||||
if (GDK_SURFACE_DESTROYED (window) ||
|
||||
SURFACE_IS_TOPLEVEL (window))
|
||||
return;
|
||||
|
||||
/* FIXME: Implement */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_surface_set_startup_id (GdkSurface *window,
|
||||
const gchar *startup_id)
|
||||
@ -2754,7 +2743,6 @@ gdk_surface_impl_quartz_class_init (GdkSurfaceImplQuartzClass *klass)
|
||||
impl_class->set_urgency_hint = gdk_quartz_surface_set_urgency_hint;
|
||||
impl_class->set_geometry_hints = gdk_quartz_surface_set_geometry_hints;
|
||||
impl_class->set_title = gdk_quartz_surface_set_title;
|
||||
impl_class->set_role = gdk_quartz_surface_set_role;
|
||||
impl_class->set_startup_id = gdk_quartz_surface_set_startup_id;
|
||||
impl_class->set_transient_for = gdk_quartz_surface_set_transient_for;
|
||||
impl_class->get_frame_extents = gdk_quartz_surface_get_frame_extents;
|
||||
|
@ -3186,12 +3186,6 @@ gdk_wayland_surface_set_title (GdkSurface *surface,
|
||||
gdk_wayland_surface_sync_title (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_set_role (GdkSurface *surface,
|
||||
const gchar *role)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_set_startup_id (GdkSurface *surface,
|
||||
const gchar *startup_id)
|
||||
@ -3858,7 +3852,6 @@ _gdk_surface_impl_wayland_class_init (GdkSurfaceImplWaylandClass *klass)
|
||||
impl_class->set_urgency_hint = gdk_wayland_surface_set_urgency_hint;
|
||||
impl_class->set_geometry_hints = gdk_wayland_surface_set_geometry_hints;
|
||||
impl_class->set_title = gdk_wayland_surface_set_title;
|
||||
impl_class->set_role = gdk_wayland_surface_set_role;
|
||||
impl_class->set_startup_id = gdk_wayland_surface_set_startup_id;
|
||||
impl_class->set_transient_for = gdk_wayland_surface_set_transient_for;
|
||||
impl_class->get_frame_extents = gdk_wayland_surface_get_frame_extents;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <windowsx.h>
|
||||
#include <objbase.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "gdkdevice-win32.h"
|
||||
#include "gdkwin32.h"
|
||||
|
@ -1626,18 +1626,6 @@ gdk_win32_surface_set_title (GdkSurface *window,
|
||||
GDK_NOTE (MISC_OR_EVENTS, g_free ((char *) title));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_set_role (GdkSurface *window,
|
||||
const gchar *role)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_surface_set_role: %p: %s\n",
|
||||
GDK_SURFACE_HWND (window),
|
||||
(role ? role : "NULL")));
|
||||
/* XXX */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_set_transient_for (GdkSurface *window,
|
||||
GdkSurface *parent)
|
||||
@ -5328,7 +5316,6 @@ gdk_surface_impl_win32_class_init (GdkSurfaceImplWin32Class *klass)
|
||||
impl_class->set_urgency_hint = gdk_win32_surface_set_urgency_hint;
|
||||
impl_class->set_geometry_hints = gdk_win32_surface_set_geometry_hints;
|
||||
impl_class->set_title = gdk_win32_surface_set_title;
|
||||
impl_class->set_role = gdk_win32_surface_set_role;
|
||||
//impl_class->set_startup_id = gdk_x11_surface_set_startup_id;
|
||||
impl_class->set_transient_for = gdk_win32_surface_set_transient_for;
|
||||
impl_class->get_frame_extents = gdk_win32_surface_get_frame_extents;
|
||||
|
@ -2231,27 +2231,6 @@ gdk_x11_surface_set_title (GdkSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_set_role (GdkSurface *surface,
|
||||
const gchar *role)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface) ||
|
||||
!SURFACE_IS_TOPLEVEL (surface))
|
||||
return;
|
||||
|
||||
if (role)
|
||||
XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface),
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "WM_WINDOW_ROLE"),
|
||||
XA_STRING, 8, PropModeReplace, (guchar *)role, strlen (role));
|
||||
else
|
||||
XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface),
|
||||
gdk_x11_get_xatom_by_name_for_display (display, "WM_WINDOW_ROLE"));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_set_startup_id (GdkSurface *surface,
|
||||
const gchar *startup_id)
|
||||
@ -4684,7 +4663,6 @@ gdk_surface_impl_x11_class_init (GdkSurfaceImplX11Class *klass)
|
||||
impl_class->set_urgency_hint = gdk_x11_surface_set_urgency_hint;
|
||||
impl_class->set_geometry_hints = gdk_x11_surface_set_geometry_hints;
|
||||
impl_class->set_title = gdk_x11_surface_set_title;
|
||||
impl_class->set_role = gdk_x11_surface_set_role;
|
||||
impl_class->set_startup_id = gdk_x11_surface_set_startup_id;
|
||||
impl_class->set_transient_for = gdk_x11_surface_set_transient_for;
|
||||
impl_class->get_frame_extents = gdk_x11_surface_get_frame_extents;
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,5 @@
|
||||
<interface domain="gtk40">
|
||||
<template class="GtkFileChooserDialog" parent="GtkDialog">
|
||||
<property name="role">GtkFileChooserDialog</property>
|
||||
<property name="type-hint">dialog</property>
|
||||
<property name="default-width">600</property>
|
||||
<signal name="response" handler="response_cb" swapped="no"/>
|
||||
|
Loading…
Reference in New Issue
Block a user