[gtk/x11-props: 2/2] Drop GdkToplevel:accept-focus/:focus-on-map



commit 1576cced0fe34bccc8c08be7d0c35a62807007a0
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 14 10:06:57 2020 -0400

    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.

 gdk/broadway/gdksurface-broadway.c | 15 +-----------
 gdk/gdksurface.c                   |  2 --
 gdk/gdksurfaceprivate.h            |  2 --
 gdk/gdktoplevel.c                  | 50 --------------------------------------
 gdk/gdktoplevel.h                  |  8 ------
 gdk/gdktoplevelprivate.h           |  2 --
 gdk/wayland/gdksurface-wayland.c   | 12 ---------
 gdk/win32/gdkevents-win32.c        |  3 +--
 gdk/win32/gdksurface-win32.c       | 31 +++--------------------
 gdk/x11/gdkdisplay-x11.c           |  2 +-
 gdk/x11/gdksurface-x11.c           | 50 ++------------------------------------
 11 files changed, 9 insertions(+), 168 deletions(-)
---
diff --git a/gdk/broadway/gdksurface-broadway.c b/gdk/broadway/gdksurface-broadway.c
index 4cf1a111b55..a66d575b04b 100644
--- a/gdk/broadway/gdksurface-broadway.c
+++ b/gdk/broadway/gdksurface-broadway.c
@@ -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;
 
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index a8621716f24..25d6efc7a86 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -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,
diff --git a/gdk/gdksurfaceprivate.h b/gdk/gdksurfaceprivate.h
index 20877742c90..0c94b5a80f0 100644
--- a/gdk/gdksurfaceprivate.h
+++ b/gdk/gdksurfaceprivate.h
@@ -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;
diff --git a/gdk/gdktoplevel.c b/gdk/gdktoplevel.c
index 4f4f1dace8e..35ea7f52f61 100644
--- a/gdk/gdktoplevel.c
+++ b/gdk/gdktoplevel.c
@@ -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 doesn’t 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 doesn’t want to receive input focus when it is mapped.
- * focus_on_map should be turned off for surfaces that aren’t 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
diff --git a/gdk/gdktoplevel.h b/gdk/gdktoplevel.h
index e1ad1f228e1..720d0dea724 100644
--- a/gdk/gdktoplevel.h
+++ b/gdk/gdktoplevel.h
@@ -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);
diff --git a/gdk/gdktoplevelprivate.h b/gdk/gdktoplevelprivate.h
index 92e37b18cda..ac3c5a4ab32 100644
--- a/gdk/gdktoplevelprivate.h
+++ b/gdk/gdktoplevelprivate.h
@@ -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,
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index a4a421bb90a..12f88990c88 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -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;
 
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 2c481de93ea..b163667a772 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -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;
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 778c7c75c60..db704c0a20c 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -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;
 
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 5108a06e1d4..2d34eb314a9 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -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),
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 10544a2351f..8ae534492c6 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]