[gtk/wip/matthiasc/popup4: 87/115] gdk: Drop input-only surfaces



commit 267843d66ed11b7551b7f0d5c441193ce0c1d31d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 21 12:06:11 2019 -0400

    gdk: Drop input-only surfaces
    
    We are not creating such surfaces anymore, and
    they were only ever meaningfully implemented
    on X11. Drop the concept, and the api for determining
    if a surface is input-only.

 docs/reference/gdk/gdk4-sections.txt |  1 -
 gdk/gdkinternals.h                   |  1 -
 gdk/gdksurface.c                     | 45 ++++-----------------
 gdk/gdksurface.h                     |  2 -
 gdk/quartz/gdksurface-quartz.c       | 77 +++++++++++++++++-------------------
 gdk/win32/gdkgeometry-win32.c        |  4 +-
 gdk/win32/gdksurface-win32.c         | 14 +------
 gdk/x11/gdksurface-x11.c             | 68 +++++++++++--------------------
 8 files changed, 72 insertions(+), 140 deletions(-)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index ab700bedf7..58581769dc 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -190,7 +190,6 @@ gdk_surface_hide
 gdk_surface_is_destroyed
 gdk_surface_is_visible
 gdk_surface_is_viewable
-gdk_surface_is_input_only
 gdk_surface_get_state
 gdk_surface_iconify
 gdk_surface_deiconify
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index d9de40a202..540fcc738c 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -159,7 +159,6 @@ struct _GdkSurface
   guint8 alpha;
   guint8 fullscreen_mode;
 
-  guint input_only : 1;
   guint pass_through : 1;
   guint modal_hint : 1;
 
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 7937cdd639..98bc6ab3a6 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -453,7 +453,6 @@ _gdk_surface_update_size (GdkSurface *surface)
 
 static GdkSurface *
 gdk_surface_new (GdkDisplay     *display,
-                 gboolean        input_only,
                  GdkSurfaceType  surface_type,
                  int             x,
                  int             y,
@@ -474,11 +473,8 @@ gdk_surface_new (GdkDisplay     *display,
   surface->y = y;
   surface->width = width;
   surface->height = height;
-  surface->input_only = input_only;
   surface->surface_type = surface_type;
 
-  g_warn_if_fail (!surface->input_only || surface->surface_type == GDK_SURFACE_TEMP);
-
   frame_clock = g_object_new (GDK_TYPE_FRAME_CLOCK_IDLE, NULL);
   gdk_surface_set_frame_clock (surface, frame_clock);
   g_object_unref (frame_clock);
@@ -514,7 +510,7 @@ gdk_surface_new_toplevel (GdkDisplay *display,
 {
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
 
-  return gdk_surface_new (display, FALSE, GDK_SURFACE_TOPLEVEL, 0, 0, width, height);
+  return gdk_surface_new (display, GDK_SURFACE_TOPLEVEL, 0, 0, width, height);
 }
 
 /**
@@ -534,7 +530,7 @@ gdk_surface_new_popup (GdkDisplay         *display,
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
   g_return_val_if_fail (position != NULL, NULL);
 
-  return gdk_surface_new (display, FALSE, GDK_SURFACE_TEMP,
+  return gdk_surface_new (display, GDK_SURFACE_TEMP,
                           position->x, position->y,
                           position->width, position->height);
 }
@@ -548,7 +544,7 @@ gdk_surface_new_popup_full (GdkDisplay *display,
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
   g_return_val_if_fail (GDK_IS_SURFACE (parent), NULL);
 
-  surface = gdk_surface_new (display, FALSE, GDK_SURFACE_TEMP, 0, 0, 100, 100);
+  surface = gdk_surface_new (display, GDK_SURFACE_TEMP, 0, 0, 100, 100);
   gdk_surface_set_transient_for (surface, parent);
   gdk_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_MENU);
 
@@ -1120,7 +1116,7 @@ gdk_surface_invalidate_rect (GdkSurface        *surface,
   if (GDK_SURFACE_DESTROYED (surface))
     return;
 
-  if (surface->input_only || !surface->viewable)
+  if (!surface->viewable)
     return;
 
   if (!rect)
@@ -1204,9 +1200,7 @@ gdk_surface_invalidate_region (GdkSurface          *surface,
   if (GDK_SURFACE_DESTROYED (surface))
     return;
 
-  if (surface->input_only ||
-      !surface->viewable ||
-      cairo_region_is_empty (region))
+  if (!surface->viewable || cairo_region_is_empty (region))
     return;
 
   r.x = 0;
@@ -2423,22 +2417,6 @@ gdk_surface_get_focus_on_map (GdkSurface *surface)
   return surface->focus_on_map;
 }
 
-/**
- * gdk_surface_is_input_only:
- * @surface: a toplevel #GdkSurface
- *
- * Determines whether or not the surface is an input only surface.
- *
- * Returns: %TRUE if @surface is input only
- */
-gboolean
-gdk_surface_is_input_only (GdkSurface *surface)
-{
-  g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
-
-  return surface->input_only;
-}
-
 static void
 update_cursor (GdkDisplay *display,
                GdkDevice  *device)
@@ -2709,9 +2687,6 @@ gdk_surface_print (GdkSurface *surface,
 
   g_print (" %s", surface_types[surface->surface_type]);
 
-  if (surface->input_only)
-    g_print (" input-only");
-
   if (!gdk_surface_is_visible ((GdkSurface *)surface))
     g_print (" hidden");
 
@@ -2728,18 +2703,14 @@ gdk_surface_print (GdkSurface *surface,
 
 static void
 gdk_surface_print_tree (GdkSurface *surface,
-                        int indent,
-                        gboolean include_input_only)
+                        int         indent)
 {
   GList *l;
 
-  if (surface->input_only && !include_input_only)
-    return;
-
   gdk_surface_print (surface, indent);
 
   for (l = surface->children; l != NULL; l = l->next)
-    gdk_surface_print_tree (l->data, indent + 4, include_input_only);
+    gdk_surface_print_tree (l->data, indent + 4);
 }
 
 #endif /* DEBUG_SURFACE_PRINTING */
@@ -2797,7 +2768,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
       (event->key.keyval == 0xa7 ||
        event->key.keyval == 0xbd))
     {
-      gdk_surface_print_tree (event_surface, 0, event->key.keyval == 0xbd);
+      gdk_surface_print_tree (event_surface, 0);
     }
 #endif
 
diff --git a/gdk/gdksurface.h b/gdk/gdksurface.h
index 039c3b152d..155418f4ff 100644
--- a/gdk/gdksurface.h
+++ b/gdk/gdksurface.h
@@ -528,8 +528,6 @@ GDK_AVAILABLE_IN_ALL
 gboolean gdk_surface_is_visible     (GdkSurface *surface);
 GDK_AVAILABLE_IN_ALL
 gboolean gdk_surface_is_viewable    (GdkSurface *surface);
-GDK_AVAILABLE_IN_ALL
-gboolean gdk_surface_is_input_only  (GdkSurface *surface);
 
 GDK_AVAILABLE_IN_ALL
 GdkSurfaceState gdk_surface_get_state (GdkSurface *surface);
diff --git a/gdk/quartz/gdksurface-quartz.c b/gdk/quartz/gdksurface-quartz.c
index b955e8c021..78b8d0cf5b 100644
--- a/gdk/quartz/gdksurface-quartz.c
+++ b/gdk/quartz/gdksurface-quartz.c
@@ -1139,56 +1139,53 @@ move_resize_window_internal (GdkSurface *window,
     }
   else 
     {
-      if (!window->input_only)
-        {
-          NSRect nsrect;
+      NSRect nsrect;
 
-          nsrect = NSMakeRect (window->x, window->y, window->width, window->height);
+      nsrect = NSMakeRect (window->x, window->y, window->width, window->height);
 
-          /* The newly visible area of this window in a coordinate
-           * system rooted at the origin of this window.
-           */
-          new_visible.x = -window->x;
-          new_visible.y = -window->y;
-          new_visible.width = old_visible.width;   /* parent has not changed size */
-          new_visible.height = old_visible.height; /* parent has not changed size */
+      /* The newly visible area of this window in a coordinate
+       * system rooted at the origin of this window.
+       */
+      new_visible.x = -window->x;
+      new_visible.y = -window->y;
+      new_visible.width = old_visible.width;   /* parent has not changed size */
+      new_visible.height = old_visible.height; /* parent has not changed size */
 
-          expose_region = cairo_region_create_rectangle (&new_visible);
-          old_region = cairo_region_create_rectangle (&old_visible);
-          cairo_region_subtract (expose_region, old_region);
+      expose_region = cairo_region_create_rectangle (&new_visible);
+      old_region = cairo_region_create_rectangle (&old_visible);
+      cairo_region_subtract (expose_region, old_region);
 
-          /* Determine what (if any) part of the previously visible
-           * part of the window can be copied without a redraw
-           */
-          scroll_rect = old_visible;
-          scroll_rect.x -= delta.width;
-          scroll_rect.y -= delta.height;
-          gdk_rectangle_intersect (&scroll_rect, &old_visible, &scroll_rect);
+      /* Determine what (if any) part of the previously visible
+       * part of the window can be copied without a redraw
+       */
+      scroll_rect = old_visible;
+      scroll_rect.x -= delta.width;
+      scroll_rect.y -= delta.height;
+      gdk_rectangle_intersect (&scroll_rect, &old_visible, &scroll_rect);
 
-          if (!cairo_region_is_empty (expose_region))
+      if (!cairo_region_is_empty (expose_region))
+        {
+          if (scroll_rect.width != 0 && scroll_rect.height != 0)
             {
-              if (scroll_rect.width != 0 && scroll_rect.height != 0)
-                {
-                  [impl->view scrollRect:NSMakeRect (scroll_rect.x,
-                                                     scroll_rect.y,
-                                                     scroll_rect.width,
-                                                     scroll_rect.height)
+              [impl->view scrollRect:NSMakeRect (scroll_rect.x,
+                                                 scroll_rect.y,
+                                                 scroll_rect.width,
+                                                 scroll_rect.height)
                                      by:delta];
-                }
-
-              [impl->view setFrame:nsrect];
-
-              gdk_quartz_surface_set_needs_display_in_region (window, expose_region);
-            }
-          else
-            {
-              [impl->view setFrame:nsrect];
-              [impl->view setNeedsDisplay:YES];
             }
 
-          cairo_region_destroy (expose_region);
-          cairo_region_destroy (old_region);
+          [impl->view setFrame:nsrect];
+
+          gdk_quartz_surface_set_needs_display_in_region (window, expose_region);
         }
+      else
+        {
+          [impl->view setFrame:nsrect];
+          [impl->view setNeedsDisplay:YES];
+        }
+
+      cairo_region_destroy (expose_region);
+      cairo_region_destroy (old_region);
     }
 
   GDK_QUARTZ_RELEASE_POOL;
diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c
index ad17a4a852..7b386e66c3 100644
--- a/gdk/win32/gdkgeometry-win32.c
+++ b/gdk/win32/gdkgeometry-win32.c
@@ -127,7 +127,7 @@ _gdk_win32_surface_tmp_unset_bg (GdkSurface *window,
 {
   g_return_if_fail (GDK_IS_SURFACE (window));
 
-  if (window->input_only || window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
+  if (window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
     return;
 
   tmp_unset_bg (window);
@@ -157,7 +157,7 @@ _gdk_win32_surface_tmp_reset_bg (GdkSurface *window,
 {
   g_return_if_fail (GDK_IS_SURFACE (window));
 
-  if (window->input_only || window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
+  if (window->destroyed || !GDK_SURFACE_IS_MAPPED (window))
     return;
 
   tmp_reset_bg (window);
diff --git a/gdk/win32/gdksurface-win32.c b/gdk/win32/gdksurface-win32.c
index 123c4e0828..690088a06a 100644
--- a/gdk/win32/gdksurface-win32.c
+++ b/gdk/win32/gdksurface-win32.c
@@ -569,19 +569,7 @@ _gdk_win32_display_create_surface_impl (GdkDisplay    *display,
   impl->unscaled_width = window->width * impl->surface_scale;
   impl->unscaled_height = window->height * impl->surface_scale;
 
-  if (!window->input_only)
-    {
-      dwExStyle = 0;
-    }
-  else
-    {
-      /* I very much doubt using WS_EX_TRANSPARENT actually
-       * corresponds to how X11 InputOnly windows work, but it appears
-       * to work well enough for the actual use cases in gtk.
-       */
-      dwExStyle = WS_EX_TRANSPARENT;
-      GDK_NOTE (MISC, g_print ("... GDK_INPUT_ONLY\n"));
-    }
+  dwExStyle = 0;
 
   switch (window->surface_type)
     {
diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
index 7b7a7ff427..f9892b9957 100644
--- a/gdk/x11/gdksurface-x11.c
+++ b/gdk/x11/gdksurface-x11.c
@@ -717,16 +717,13 @@ setup_toplevel_window (GdkSurface    *surface,
 
   set_wm_protocols (surface);
 
-  if (!surface->input_only)
-    {
-      /* The focus surface is off the visible area, and serves to receive key
-       * press events so they don't get sent to child surfaces.
-       */
-      toplevel->focus_window = create_focus_window (display, xid);
-      _gdk_x11_display_add_window (x11_screen->display,
-                                   &toplevel->focus_window,
-                                   surface);
-    }
+  /* The focus surface is off the visible area, and serves to receive key
+   * press events so they don't get sent to child surfaces.
+   */
+  toplevel->focus_window = create_focus_window (display, xid);
+  _gdk_x11_display_add_window (x11_screen->display,
+                               &toplevel->focus_window,
+                               surface);
 
   check_leader_window_title (x11_screen->display);
 
@@ -858,49 +855,32 @@ _gdk_x11_display_create_surface_impl (GdkDisplay    *display,
 
   impl->override_redirect = FALSE;
 
-  if (!surface->input_only)
-    {
-      class = InputOutput;
-
-      xattributes.background_pixmap = None;
-      xattributes_mask |= CWBackPixmap;
+  class = InputOutput;
 
-      xattributes.border_pixel = BlackPixel (xdisplay, x11_screen->screen_num);
-      xattributes_mask |= CWBorderPixel;
+  xattributes.background_pixmap = None;
+  xattributes_mask |= CWBackPixmap;
 
-      xattributes.bit_gravity = NorthWestGravity;
-      xattributes_mask |= CWBitGravity;
+  xattributes.border_pixel = BlackPixel (xdisplay, x11_screen->screen_num);
+  xattributes_mask |= CWBorderPixel;
 
-      xattributes.colormap = gdk_x11_display_get_window_colormap (display_x11);
-      xattributes_mask |= CWColormap;
+  xattributes.bit_gravity = NorthWestGravity;
+  xattributes_mask |= CWBitGravity;
 
-      if (surface->surface_type == GDK_SURFACE_TEMP)
-        {
-          xattributes.save_under = True;
-          xattributes.override_redirect = True;
-          xattributes.cursor = None;
-          xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
+  xattributes.colormap = gdk_x11_display_get_window_colormap (display_x11);
+  xattributes_mask |= CWColormap;
 
-          impl->override_redirect = TRUE;
-        }
-
-      depth = gdk_x11_display_get_window_depth (display_x11);
-    }
-  else
+  if (surface->surface_type == GDK_SURFACE_TEMP)
     {
-      class = InputOnly;
-
-      if (surface->surface_type == GDK_SURFACE_TEMP)
-        {
-          xattributes.override_redirect = True;
-          xattributes_mask |= CWOverrideRedirect;
-
-          impl->override_redirect = TRUE;
-        }
+      xattributes.save_under = True;
+      xattributes.override_redirect = True;
+      xattributes.cursor = None;
+      xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
 
-      depth = 0;
+      impl->override_redirect = TRUE;
     }
 
+  depth = gdk_x11_display_get_window_depth (display_x11);
+
   if (surface->width * impl->surface_scale > 32767 ||
       surface->height * impl->surface_scale > 32767)
     {


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