Drop GdkToplevel:sticky

This was only ever implemented on X11. If you
want to use it there, just use the X properties
yourself.
This commit is contained in:
Matthias Clasen 2020-03-14 01:39:35 -04:00
parent fb7ef8f62c
commit 60ea97187a
10 changed files with 2 additions and 169 deletions

View File

@ -681,7 +681,6 @@ gdk_toplevel_set_transient_for
gdk_toplevel_set_modal gdk_toplevel_set_modal
gdk_toplevel_set_icon_list gdk_toplevel_set_icon_list
gdk_toplevel_show_window_menu gdk_toplevel_show_window_menu
gdk_toplevel_set_sticky
gdk_toplevel_set_keep_above gdk_toplevel_set_keep_above
gdk_toplevel_set_keep_below gdk_toplevel_set_keep_below
gdk_toplevel_set_accept_focus gdk_toplevel_set_accept_focus

View File

@ -1494,9 +1494,6 @@ gdk_broadway_toplevel_set_property (GObject *object,
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST: case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
break; break;
case LAST_PROP + GDK_TOPLEVEL_PROP_STICKY:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE: case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE:
break; break;
@ -1551,9 +1548,6 @@ gdk_broadway_toplevel_get_property (GObject *object,
g_value_set_pointer (value, NULL); g_value_set_pointer (value, NULL);
break; break;
case LAST_PROP + GDK_TOPLEVEL_PROP_STICKY:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE: case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE:
break; break;

View File

@ -118,12 +118,6 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
"Icon List", "Icon List",
"The list of icon textures", "The list of icon textures",
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY)); G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface,
g_param_spec_boolean ("sticky",
"Sticky",
"Whether the surface is on all workspaces",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface, g_object_interface_install_property (iface,
g_param_spec_boolean ("keep-above", g_param_spec_boolean ("keep-above",
"Keep above", "Keep above",
@ -179,7 +173,6 @@ gdk_toplevel_install_properties (GObjectClass *object_class,
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_TRANSIENT_FOR, "transient-for"); g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_TRANSIENT_FOR, "transient-for");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_MODAL, "modal"); g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_MODAL, "modal");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_ICON_LIST, "icon-list"); g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_ICON_LIST, "icon-list");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_STICKY, "sticky");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_KEEP_ABOVE, "keep-above"); g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_KEEP_ABOVE, "keep-above");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_KEEP_BELOW, "keep-below"); g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_KEEP_BELOW, "keep-below");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS, "accept-focus"); g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS, "accept-focus");
@ -422,22 +415,6 @@ gdk_toplevel_show_window_menu (GdkToplevel *toplevel,
return GDK_TOPLEVEL_GET_IFACE (toplevel)->show_window_menu (toplevel, event); return GDK_TOPLEVEL_GET_IFACE (toplevel)->show_window_menu (toplevel, event);
} }
/**
* gdk_toplevel_set_sticky:
* @toplevel: a #GdkToplevel
* @sticky: whether to make @toplevel show on all workspaces
*
* Set if @surface is sticky.
**/
void
gdk_toplevel_set_sticky (GdkToplevel *toplevel,
gboolean sticky)
{
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
g_object_set (toplevel, "sticky", sticky, NULL);
}
/** /**
* gdk_toplevel_set_keep_above: * gdk_toplevel_set_keep_above:
* @toplevel: a #GdkToplevel * @toplevel: a #GdkToplevel

View File

@ -77,10 +77,6 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_toplevel_show_window_menu (GdkToplevel *toplevel, gboolean gdk_toplevel_show_window_menu (GdkToplevel *toplevel,
GdkEvent *event); GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_set_sticky (GdkToplevel *toplevel,
gboolean sticky);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gdk_toplevel_set_keep_above (GdkToplevel *toplevel, void gdk_toplevel_set_keep_above (GdkToplevel *toplevel,
gboolean above); gboolean above);

View File

@ -31,7 +31,6 @@ typedef enum
GDK_TOPLEVEL_PROP_TRANSIENT_FOR, GDK_TOPLEVEL_PROP_TRANSIENT_FOR,
GDK_TOPLEVEL_PROP_MODAL, GDK_TOPLEVEL_PROP_MODAL,
GDK_TOPLEVEL_PROP_ICON_LIST, GDK_TOPLEVEL_PROP_ICON_LIST,
GDK_TOPLEVEL_PROP_STICKY,
GDK_TOPLEVEL_PROP_KEEP_ABOVE, GDK_TOPLEVEL_PROP_KEEP_ABOVE,
GDK_TOPLEVEL_PROP_KEEP_BELOW, GDK_TOPLEVEL_PROP_KEEP_BELOW,
GDK_TOPLEVEL_PROP_ACCEPT_FOCUS, GDK_TOPLEVEL_PROP_ACCEPT_FOCUS,

View File

@ -4349,9 +4349,6 @@ gdk_wayland_toplevel_set_property (GObject *object,
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST: case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
break; break;
case LAST_PROP + GDK_TOPLEVEL_PROP_STICKY:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE: case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE:
break; break;
@ -4416,9 +4413,6 @@ gdk_wayland_toplevel_get_property (GObject *object,
g_value_set_pointer (value, NULL); g_value_set_pointer (value, NULL);
break; break;
case LAST_PROP + GDK_TOPLEVEL_PROP_STICKY:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE: case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE:
break; break;

View File

@ -4907,9 +4907,6 @@ gdk_win32_toplevel_set_property (GObject *object,
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST: case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
break; break;
case LAST_PROP + GDK_TOPLEVEL_PROP_STICKY:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE: case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE:
break; break;
@ -4969,9 +4966,6 @@ gdk_win32_toplevel_get_property (GObject *object,
g_value_set_pointer (value, NULL); g_value_set_pointer (value, NULL);
break; break;
case LAST_PROP + GDK_TOPLEVEL_PROP_STICKY:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE: case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE:
break; break;

View File

@ -382,20 +382,6 @@ do_net_wm_state_changes (GdkSurface *surface)
set = unset = 0; set = unset = 0;
/* For found_sticky to remain TRUE, we have to also be on desktop
* 0xFFFFFFFF
*/
if (old_state & GDK_SURFACE_STATE_STICKY)
{
if (!(toplevel->have_sticky && toplevel->on_all_desktops))
unset |= GDK_SURFACE_STATE_STICKY;
}
else
{
if (toplevel->have_sticky && toplevel->on_all_desktops)
set |= GDK_SURFACE_STATE_STICKY;
}
if (old_state & GDK_SURFACE_STATE_FULLSCREEN) if (old_state & GDK_SURFACE_STATE_FULLSCREEN)
{ {
if (!toplevel->have_fullscreen) if (!toplevel->have_fullscreen)
@ -499,9 +485,6 @@ gdk_check_wm_state_changed (GdkSurface *surface)
Atom *atoms = NULL; Atom *atoms = NULL;
gulong i; gulong i;
gboolean had_sticky = toplevel->have_sticky;
toplevel->have_sticky = FALSE;
toplevel->have_maxvert = FALSE; toplevel->have_maxvert = FALSE;
toplevel->have_maxhorz = FALSE; toplevel->have_maxhorz = FALSE;
toplevel->have_fullscreen = FALSE; toplevel->have_fullscreen = FALSE;
@ -518,7 +501,6 @@ gdk_check_wm_state_changed (GdkSurface *surface)
if (type != None) if (type != None)
{ {
Atom sticky_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_STICKY");
Atom maxvert_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT"); Atom maxvert_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT");
Atom maxhorz_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ"); Atom maxhorz_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ");
Atom fullscreen_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN"); Atom fullscreen_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN");
@ -530,9 +512,7 @@ gdk_check_wm_state_changed (GdkSurface *surface)
i = 0; i = 0;
while (i < nitems) while (i < nitems)
{ {
if (atoms[i] == sticky_atom) if (atoms[i] == maxvert_atom)
toplevel->have_sticky = TRUE;
else if (atoms[i] == maxvert_atom)
toplevel->have_maxvert = TRUE; toplevel->have_maxvert = TRUE;
else if (atoms[i] == maxhorz_atom) else if (atoms[i] == maxhorz_atom)
toplevel->have_maxhorz = TRUE; toplevel->have_maxhorz = TRUE;
@ -553,13 +533,7 @@ gdk_check_wm_state_changed (GdkSurface *surface)
g_intern_static_string ("_NET_WM_STATE_FOCUSED"))) g_intern_static_string ("_NET_WM_STATE_FOCUSED")))
toplevel->have_focused = TRUE; toplevel->have_focused = TRUE;
/* When have_sticky is turned on, we have to check the DESKTOP property do_net_wm_state_changes (surface);
* as well.
*/
if (toplevel->have_sticky && !had_sticky)
gdk_check_wm_desktop_changed (surface);
else
do_net_wm_state_changes (surface);
} }
static void static void

View File

@ -1158,14 +1158,6 @@ set_initial_hints (GdkSurface *surface)
++i; ++i;
} }
if (surface->state & GDK_SURFACE_STATE_STICKY)
{
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
"_NET_WM_STATE_STICKY");
++i;
toplevel->have_sticky = TRUE;
}
if (surface->state & GDK_SURFACE_STATE_FULLSCREEN) if (surface->state & GDK_SURFACE_STATE_FULLSCREEN)
{ {
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display, atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
@ -3057,78 +3049,6 @@ gdk_x11_surface_unminimize (GdkSurface *surface)
} }
} }
static void
gdk_x11_surface_stick (GdkSurface *surface)
{
if (GDK_SURFACE_DESTROYED (surface))
return;
if (GDK_SURFACE_IS_MAPPED (surface))
{
/* "stick" means stick to all desktops _and_ do not scroll with the
* viewport. i.e. glue to the monitor glass in all cases.
*/
XClientMessageEvent xclient;
/* Request stick during viewport scroll */
gdk_wmspec_change_state (TRUE, surface,
"_NET_WM_STATE_STICKY",
NULL);
/* Request desktop 0xFFFFFFFF */
memset (&xclient, 0, sizeof (xclient));
xclient.type = ClientMessage;
xclient.window = GDK_SURFACE_XID (surface);
xclient.display = GDK_SURFACE_XDISPLAY (surface);
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface),
"_NET_WM_DESKTOP");
xclient.format = 32;
xclient.data.l[0] = 0xFFFFFFFF;
xclient.data.l[1] = 0;
xclient.data.l[2] = 0;
xclient.data.l[3] = 0;
xclient.data.l[4] = 0;
XSendEvent (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XROOTWIN (surface), False,
SubstructureRedirectMask | SubstructureNotifyMask,
(XEvent *)&xclient);
}
else
{
/* Flip our client side flag, the real work happens on map. */
gdk_synthesize_surface_state (surface,
0,
GDK_SURFACE_STATE_STICKY);
}
}
static void
gdk_x11_surface_unstick (GdkSurface *surface)
{
if (GDK_SURFACE_DESTROYED (surface))
return;
if (GDK_SURFACE_IS_MAPPED (surface))
{
/* Request unstick from viewport */
gdk_wmspec_change_state (FALSE, surface,
"_NET_WM_STATE_STICKY",
NULL);
move_to_current_desktop (surface);
}
else
{
/* Flip our client side flag, the real work happens on map. */
gdk_synthesize_surface_state (surface,
GDK_SURFACE_STATE_STICKY,
0);
}
}
static void static void
gdk_x11_surface_maximize (GdkSurface *surface) gdk_x11_surface_maximize (GdkSurface *surface)
{ {
@ -4871,14 +4791,6 @@ gdk_wayland_toplevel_set_property (GObject *object,
g_object_notify_by_pspec (G_OBJECT (surface), pspec); g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break; break;
case LAST_PROP + GDK_TOPLEVEL_PROP_STICKY:
if (g_value_get_boolean (value))
gdk_x11_surface_stick (surface);
else
gdk_x11_surface_unstick (surface);
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE: case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE:
gdk_x11_surface_set_keep_above (surface, g_value_get_boolean (value)); gdk_x11_surface_set_keep_above (surface, g_value_get_boolean (value));
g_object_notify_by_pspec (G_OBJECT (surface), pspec); g_object_notify_by_pspec (G_OBJECT (surface), pspec);
@ -4928,7 +4840,6 @@ gdk_wayland_toplevel_get_property (GObject *object,
GParamSpec *pspec) GParamSpec *pspec)
{ {
GdkSurface *surface = GDK_SURFACE (object); GdkSurface *surface = GDK_SURFACE (object);
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
switch (prop_id) switch (prop_id)
{ {
@ -4956,10 +4867,6 @@ gdk_wayland_toplevel_get_property (GObject *object,
g_value_set_pointer (value, NULL); g_value_set_pointer (value, NULL);
break; break;
case LAST_PROP + GDK_TOPLEVEL_PROP_STICKY:
g_value_set_boolean (value, impl->toplevel->have_sticky);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE: case LAST_PROP + GDK_TOPLEVEL_PROP_KEEP_ABOVE:
g_value_set_boolean (value, (surface->state & GDK_SURFACE_STATE_ABOVE) != 0); g_value_set_boolean (value, (surface->state & GDK_SURFACE_STATE_ABOVE) != 0);
break; break;

View File

@ -116,7 +116,6 @@ struct _GdkToplevelX11
guint on_all_desktops : 1; /* _NET_WM_STICKY == 0xFFFFFFFF */ guint on_all_desktops : 1; /* _NET_WM_STICKY == 0xFFFFFFFF */
guint have_sticky : 1; /* _NET_WM_STATE_STICKY */
guint have_maxvert : 1; /* _NET_WM_STATE_MAXIMIZED_VERT */ guint have_maxvert : 1; /* _NET_WM_STATE_MAXIMIZED_VERT */
guint have_maxhorz : 1; /* _NET_WM_STATE_MAXIMIZED_HORZ */ guint have_maxhorz : 1; /* _NET_WM_STATE_MAXIMIZED_HORZ */
guint have_fullscreen : 1; /* _NET_WM_STATE_FULLSCREEN */ guint have_fullscreen : 1; /* _NET_WM_STATE_FULLSCREEN */