Drop GdkToplevel:accept-focus/:focus-on-map

These properties were only ever implemented in the
X11 backend. If you want to use them, just use the
X properties directly.
This commit is contained in:
Matthias Clasen 2020-03-14 10:06:57 -04:00
parent c9ec1c6af1
commit 1576cced0f
11 changed files with 9 additions and 168 deletions

View File

@ -635,8 +635,7 @@ gdk_broadway_surface_focus (GdkSurface *surface,
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface) ||
!surface->accept_focus)
if (GDK_SURFACE_DESTROYED (surface))
return;
impl = GDK_BROADWAY_SURFACE (surface);
@ -1494,12 +1493,6 @@ gdk_broadway_toplevel_set_property (GObject *object,
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;
@ -1542,12 +1535,6 @@ gdk_broadway_toplevel_get_property (GObject *object,
g_value_set_pointer (value, NULL);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;

View File

@ -385,8 +385,6 @@ gdk_surface_init (GdkSurface *surface)
surface->width = 1;
surface->height = 1;
surface->accept_focus = TRUE;
surface->focus_on_map = TRUE;
surface->alpha = 255;
surface->device_cursor = g_hash_table_new_full (NULL, NULL,

View File

@ -70,8 +70,6 @@ struct _GdkSurface
guint destroyed : 2;
guint accept_focus : 1;
guint focus_on_map : 1;
guint support_multidevice : 1;
guint viewable : 1; /* mapped and all parents mapped */
guint in_update : 1;

View File

@ -118,18 +118,6 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
"Icon List",
"The list of icon textures",
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface,
g_param_spec_boolean ("accept-focus",
"Accept focus",
"Whether the surface should accept keyboard focus",
TRUE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface,
g_param_spec_boolean ("focus-on-map",
"Focus on map",
"Whether the surface should receive keyboard focus on map",
TRUE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface,
g_param_spec_boolean ("decorated",
"Decorated",
@ -161,8 +149,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_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_ACCEPT_FOCUS, "accept-focus");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP, "focus-on-map");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_DECORATED, "decorated");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_DELETABLE, "deletable");
g_object_class_override_property (object_class, first_prop + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE, "fullscreen-mode");
@ -401,42 +387,6 @@ gdk_toplevel_show_window_menu (GdkToplevel *toplevel,
return GDK_TOPLEVEL_GET_IFACE (toplevel)->show_window_menu (toplevel, event);
}
/**
* gdk_toplevel_set_accept_focus:
* @toplevel: a #GdkToplevel
* @accept_focus: whether @toplevel should accept keyboard focus
*
* Setting @accept_focus to %FALSE hints the desktop environment
* that the surface doesnt want to receive input focus.
*/
void
gdk_toplevel_set_accept_focus (GdkToplevel *toplevel,
gboolean accept_focus)
{
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
g_object_set (toplevel, "accept-focus", accept_focus, NULL);
}
/**
* gdk_toplevel_set_focus_on_map:
* @toplevel: a #GdkToplevel
* @focus_on_map: whether @toplevel should receive input focus when mapped
*
* Setting @focus_on_map to %FALSE hints the desktop environment that the
* surface doesnt want to receive input focus when it is mapped.
* focus_on_map should be turned off for surfaces that arent triggered
* interactively (such as popups from network activity).
*/
void
gdk_toplevel_set_focus_on_map (GdkToplevel *toplevel,
gboolean focus_on_map)
{
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
g_object_set (toplevel, "focus-on-map", focus_on_map, NULL);
}
/**
* gdk_toplevel_set_decorated:
* @toplevel: a #GdkToplevel

View File

@ -77,14 +77,6 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_toplevel_show_window_menu (GdkToplevel *toplevel,
GdkEvent *event);
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_set_accept_focus (GdkToplevel *toplevel,
gboolean accept_focus);
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_set_focus_on_map (GdkToplevel *toplevel,
gboolean focus_on_map);
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_set_decorated (GdkToplevel *toplevel,
gboolean decorated);

View File

@ -31,8 +31,6 @@ typedef enum
GDK_TOPLEVEL_PROP_TRANSIENT_FOR,
GDK_TOPLEVEL_PROP_MODAL,
GDK_TOPLEVEL_PROP_ICON_LIST,
GDK_TOPLEVEL_PROP_ACCEPT_FOCUS,
GDK_TOPLEVEL_PROP_FOCUS_ON_MAP,
GDK_TOPLEVEL_PROP_DECORATED,
GDK_TOPLEVEL_PROP_DELETABLE,
GDK_TOPLEVEL_PROP_FULLSCREEN_MODE,

View File

@ -4349,12 +4349,6 @@ gdk_wayland_toplevel_set_property (GObject *object,
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;
@ -4407,12 +4401,6 @@ gdk_wayland_toplevel_get_property (GObject *object,
g_value_set_pointer (value, NULL);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;

View File

@ -2837,8 +2837,7 @@ gdk_event_translate (MSG *msg,
case WM_MOUSEACTIVATE:
{
if (GDK_IS_DRAG_SURFACE (window)
|| !window->accept_focus)
if (GDK_IS_DRAG_SURFACE (window))
{
*ret_valp = MA_NOACTIVATE;
return_val = TRUE;

View File

@ -842,7 +842,6 @@ show_window_internal (GdkSurface *window,
gboolean unminimize)
{
GdkWin32Surface *surface;
gboolean focus_on_map = FALSE;
DWORD exstyle;
if (window->destroyed)
@ -883,9 +882,6 @@ show_window_internal (GdkSurface *window,
/* Other cases */
if (!already_mapped)
focus_on_map = window->focus_on_map;
exstyle = GetWindowLong (GDK_SURFACE_HWND (window), GWL_EXSTYLE);
/* Use SetWindowPos to show transparent windows so automatic redraws
@ -895,7 +891,7 @@ show_window_internal (GdkSurface *window,
{
UINT flags = SWP_SHOWWINDOW | SWP_NOREDRAW | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER;
if (GDK_IS_DRAG_SURFACE (window) || !focus_on_map)
if (GDK_IS_DRAG_SURFACE (window))
flags |= SWP_NOACTIVATE;
SetWindowPos (GDK_SURFACE_HWND (window),
@ -1035,12 +1031,9 @@ show_window_internal (GdkSurface *window,
}
else if (window->state & GDK_SURFACE_STATE_MINIMIZED)
{
if (focus_on_map)
GtkShowWindow (window, SW_RESTORE);
else
GtkShowWindow (window, SW_SHOWNOACTIVATE);
GtkShowWindow (window, SW_RESTORE);
}
else if (GDK_IS_DRAG_SURFACE (window) || !focus_on_map)
else if (GDK_IS_DRAG_SURFACE (window))
{
if (!IsWindowVisible (GDK_SURFACE_HWND (window)))
GtkShowWindow (window, SW_SHOWNOACTIVATE);
@ -1387,16 +1380,12 @@ gdk_win32_surface_raise (GdkSurface *window)
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), HWND_TOPMOST,
0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
else if (window->accept_focus)
else
/* Do not wrap this in an API_CALL macro as SetForegroundWindow might
* fail when for example dragging a window belonging to a different
* application at the time of a gtk_window_present() call due to focus
* stealing prevention. */
SetForegroundWindow (GDK_SURFACE_HWND (window));
else
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), HWND_TOP,
0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER));
}
}
@ -4907,12 +4896,6 @@ gdk_win32_toplevel_set_property (GObject *object,
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;
@ -4960,12 +4943,6 @@ gdk_win32_toplevel_get_property (GObject *object,
g_value_set_pointer (value, NULL);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
break;

View File

@ -1273,7 +1273,7 @@ _gdk_wm_protocols_filter (const XEvent *xevent,
/* There is no way of knowing reliably whether we are viewable;
* so trap errors asynchronously around the XSetInputFocus call
*/
if (toplevel && win->accept_focus)
if (toplevel)
{
gdk_x11_display_error_trap_push (display);
XSetInputFocus (GDK_DISPLAY_XDISPLAY (display),

View File

@ -733,9 +733,7 @@ setup_toplevel_window (GdkSurface *surface,
XA_WINDOW, 32, PropModeReplace,
(guchar *) &toplevel->focus_window, 1);
if (!surface->focus_on_map)
gdk_x11_surface_set_user_time (surface, 0);
else if (GDK_X11_DISPLAY (x11_screen->display)->user_time != 0)
if (GDK_X11_DISPLAY (x11_screen->display)->user_time != 0)
gdk_x11_surface_set_user_time (surface, GDK_X11_DISPLAY (x11_screen->display)->user_time);
ensure_sync_counter (surface);
@ -1071,7 +1069,7 @@ update_wm_hints (GdkSurface *surface,
return;
wm_hints.flags = StateHint | InputHint;
wm_hints.input = surface->accept_focus ? True : False;
wm_hints.input = True;
wm_hints.initial_state = NormalState;
if (surface->state & GDK_SURFACE_STATE_MINIMIZED)
@ -2631,37 +2629,6 @@ gdk_x11_surface_set_input_region (GdkSurface *surface,
#endif
}
static void
gdk_x11_surface_set_accept_focus (GdkSurface *surface,
gboolean accept_focus)
{
accept_focus = accept_focus != FALSE;
if (surface->accept_focus != accept_focus)
{
surface->accept_focus = accept_focus;
if (!GDK_SURFACE_DESTROYED (surface))
update_wm_hints (surface, FALSE);
}
}
static void
gdk_x11_surface_set_focus_on_map (GdkSurface *surface,
gboolean focus_on_map)
{
focus_on_map = focus_on_map != FALSE;
if (surface->focus_on_map != focus_on_map)
{
surface->focus_on_map = focus_on_map;
if (!GDK_SURFACE_DESTROYED (surface) &&
!surface->focus_on_map)
gdk_x11_surface_set_user_time (surface, 0);
}
}
/**
* gdk_x11_surface_set_user_time:
* @surface: (type GdkX11Surface): A toplevel #GdkSurface
@ -4742,16 +4709,6 @@ gdk_wayland_toplevel_set_property (GObject *object,
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_ACCEPT_FOCUS:
gdk_x11_surface_set_accept_focus (surface, g_value_get_boolean (value));
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
gdk_x11_surface_set_focus_on_map (surface, g_value_get_boolean (value));
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
gdk_x11_surface_set_decorations (surface, g_value_get_boolean (value) ? GDK_DECOR_ALL : 0);
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
@ -4808,9 +4765,6 @@ gdk_wayland_toplevel_get_property (GObject *object,
g_value_set_pointer (value, NULL);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_FOCUS_ON_MAP:
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
{
GdkWMDecoration decorations = GDK_DECOR_ALL;