[gtk+] gdk: Remove VisibilityNotify events



commit bd6b6ed93c075c2055dff5cdff6f85a886bc6571
Author: Benjamin Otte <otte redhat com>
Date:   Wed Nov 1 21:59:45 2017 +0100

    gdk: Remove VisibilityNotify events

 demos/gtk-demo/main.c                |    1 -
 docs/reference/gdk/gdk4-sections.txt |    2 -
 gdk/gdkevents.c                      |    2 -
 gdk/gdkevents.h                      |   18 -----
 gdk/gdkeventsprivate.h               |   25 --------
 gdk/gdktypes.h                       |    2 -
 gdk/gdkwindow.c                      |  114 ----------------------------------
 gdk/x11/gdkdisplay-x11.c             |   28 +--------
 gtk/gtklayout.c                      |    4 -
 gtk/gtkmain.c                        |    1 -
 gtk/gtktextview.c                    |    2 +-
 gtk/gtktreeview.c                    |    8 +-
 gtk/gtkwidget.c                      |    2 -
 13 files changed, 7 insertions(+), 202 deletions(-)
---
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index d7b29e1..f13d9d1 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -300,7 +300,6 @@ static gchar *types[] =
   "GdkEvent ",
   "GdkEventKey ",
   "GtkTextView ",
-  "GdkEventVisibility ",
   "GdkBitmap ",
   "GtkTextChildAnchor ",
   "GArray ",
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 81b37bd..c0adfe2 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -788,7 +788,6 @@ GdkEventTouch
 GdkEventScroll
 GdkEventMotion
 GdkEventExpose
-GdkEventVisibility
 GdkEventCrossing
 GdkEventFocus
 GdkEventConfigure
@@ -807,7 +806,6 @@ GdkEventPadGroupMode
 
 <SUBSECTION>
 GdkScrollDirection
-GdkVisibilityState
 GdkCrossingMode
 GdkNotifyType
 GdkPropertyState
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index e306184..f768003 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -917,7 +917,6 @@ gdk_event_get_time (const GdkEvent *event)
       case GDK_PAD_GROUP_MODE:
         return event->pad_group_mode.time;
       case GDK_CLIENT_EVENT:
-      case GDK_VISIBILITY_NOTIFY:
       case GDK_CONFIGURE:
       case GDK_FOCUS_CHANGE:
       case GDK_NOTHING:
@@ -991,7 +990,6 @@ gdk_event_get_state (const GdkEvent        *event,
        *state =  event->crossing.state;
         return TRUE;
       case GDK_PROPERTY_NOTIFY:
-      case GDK_VISIBILITY_NOTIFY:
       case GDK_CLIENT_EVENT:
       case GDK_CONFIGURE:
       case GDK_FOCUS_CHANGE:
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index ea81c58..0f16035 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -123,7 +123,6 @@ G_BEGIN_DECLS
 
 typedef struct _GdkEventAny        GdkEventAny;
 typedef struct _GdkEventExpose     GdkEventExpose;
-typedef struct _GdkEventVisibility  GdkEventVisibility;
 typedef struct _GdkEventMotion     GdkEventMotion;
 typedef struct _GdkEventButton     GdkEventButton;
 typedef struct _GdkEventTouch       GdkEventTouch;
@@ -250,7 +249,6 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
  * @GDK_DROP_START: a drop operation onto the window has started.
  * @GDK_DROP_FINISHED: the drop operation initiated by the window has completed.
  * @GDK_CLIENT_EVENT: a message has been received from another application.
- * @GDK_VISIBILITY_NOTIFY: the window visibility status has changed.
  * @GDK_SCROLL: the scroll wheel was turned
  * @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
  *   for the possible window states
@@ -320,7 +318,6 @@ typedef enum
   GDK_DROP_START        = 26,
   GDK_DROP_FINISHED     = 27,
   GDK_CLIENT_EVENT     = 28,
-  GDK_VISIBILITY_NOTIFY = 29,
   GDK_SCROLL            = 31,
   GDK_WINDOW_STATE      = 32,
   GDK_OWNER_CHANGE      = 34,
@@ -341,21 +338,6 @@ typedef enum
 } GdkEventType;
 
 /**
- * GdkVisibilityState:
- * @GDK_VISIBILITY_UNOBSCURED: the window is completely visible.
- * @GDK_VISIBILITY_PARTIAL: the window is partially visible.
- * @GDK_VISIBILITY_FULLY_OBSCURED: the window is not visible at all.
- *
- * Specifies the visiblity status of a window for a #GdkEventVisibility.
- */
-typedef enum
-{
-  GDK_VISIBILITY_UNOBSCURED,
-  GDK_VISIBILITY_PARTIAL,
-  GDK_VISIBILITY_FULLY_OBSCURED
-} GdkVisibilityState;
-
-/**
  * GdkTouchpadGesturePhase:
  * @GDK_TOUCHPAD_GESTURE_PHASE_BEGIN: The gesture has begun.
  * @GDK_TOUCHPAD_GESTURE_PHASE_UPDATE: The gesture has been updated.
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index fb2c62a..3f19fcb 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -73,29 +73,6 @@ struct _GdkEventExpose
 };
 
 /**
- * GdkEventVisibility:
- * @type: the type of the event (%GDK_VISIBILITY_NOTIFY).
- * @window: the window which received the event.
- * @send_event: %TRUE if the event was sent explicitly.
- * @state: the new visibility state (%GDK_VISIBILITY_FULLY_OBSCURED,
- *   %GDK_VISIBILITY_PARTIAL or %GDK_VISIBILITY_UNOBSCURED).
- *
- * Generated when the window visibility status has changed.
- *
- * Deprecated: 3.12: Modern composited windowing systems with pervasive
- *     transparency make it impossible to track the visibility of a window
- *     reliably, so this event can not be guaranteed to provide useful
- *     information.
- */
-struct _GdkEventVisibility
-{
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
-  GdkVisibilityState state;
-};
-
-/**
  * GdkEventMotion:
  * @type: the type of the event.
  * @window: the window which received the event.
@@ -753,7 +730,6 @@ struct _GdkEventPadGroupMode {
  * @type: the #GdkEventType
  * @any: a #GdkEventAny
  * @expose: a #GdkEventExpose
- * @visibility: a #GdkEventVisibility
  * @motion: a #GdkEventMotion
  * @button: a #GdkEventButton
  * @touch: a #GdkEventTouch
@@ -811,7 +787,6 @@ union _GdkEvent
   GdkEventType             type;
   GdkEventAny              any;
   GdkEventExpose           expose;
-  GdkEventVisibility       visibility;
   GdkEventMotion           motion;
   GdkEventButton           button;
   GdkEventTouch             touch;
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 20f759f..34e3a70 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -386,7 +386,6 @@ typedef enum
  * @GDK_FOCUS_CHANGE_MASK: receive focus change events
  * @GDK_STRUCTURE_MASK: receive events about window configuration change
  * @GDK_PROPERTY_CHANGE_MASK: receive property change events
- * @GDK_VISIBILITY_NOTIFY_MASK: receive visibility change events
  * @GDK_PROXIMITY_IN_MASK: receive proximity in events
  * @GDK_PROXIMITY_OUT_MASK: receive proximity out events
  * @GDK_SUBSTRUCTURE_MASK: receive events about window configuration changes of
@@ -434,7 +433,6 @@ typedef enum
   GDK_FOCUS_CHANGE_MASK         = 1 << 14,
   GDK_STRUCTURE_MASK            = 1 << 15,
   GDK_PROPERTY_CHANGE_MASK      = 1 << 16,
-  GDK_VISIBILITY_NOTIFY_MASK    = 1 << 17,
   GDK_PROXIMITY_IN_MASK         = 1 << 18,
   GDK_PROXIMITY_OUT_MASK        = 1 << 19,
   GDK_SUBSTRUCTURE_MASK         = 1 << 20,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index e21ef3e..a33efaa 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -232,11 +232,6 @@ gdk_window_init (GdkWindow *window)
   window->width = 1;
   window->height = 1;
   window->toplevel_window_type = -1;
-  /* starts hidden */
-  window->effective_visibility = GDK_VISIBILITY_NOT_VIEWABLE;
-  window->visibility = GDK_VISIBILITY_FULLY_OBSCURED;
-  /* Default to unobscured since some backends don't send visibility events */
-  window->native_visibility = GDK_VISIBILITY_UNOBSCURED;
   window->children_list_node.data = window;
 
   window->device_cursor = g_hash_table_new_full (NULL, NULL,
@@ -607,64 +602,6 @@ remove_child_area (GdkWindow *window,
     }
 }
 
-static GdkVisibilityState
-effective_visibility (GdkWindow *window)
-{
-  GdkVisibilityState native;
-
-  if (!gdk_window_is_viewable (window))
-    return GDK_VISIBILITY_NOT_VIEWABLE;
-
-  native = window->impl_window->native_visibility;
-
-  if (native == GDK_VISIBILITY_FULLY_OBSCURED ||
-      window->visibility == GDK_VISIBILITY_FULLY_OBSCURED)
-    return GDK_VISIBILITY_FULLY_OBSCURED;
-  else if (native == GDK_VISIBILITY_UNOBSCURED)
-    return window->visibility;
-  else /* native PARTIAL, private partial or unobscured  */
-    return GDK_VISIBILITY_PARTIAL;
-}
-
-static void
-gdk_window_update_visibility (GdkWindow *window)
-{
-  GdkVisibilityState new_visibility;
-  GdkEvent *event;
-
-  new_visibility = effective_visibility (window);
-
-  if (new_visibility != window->effective_visibility)
-    {
-      window->effective_visibility = new_visibility;
-
-      if (new_visibility != GDK_VISIBILITY_NOT_VIEWABLE &&
-         window->event_mask & GDK_VISIBILITY_NOTIFY_MASK)
-       {
-         event = _gdk_make_event (window, GDK_VISIBILITY_NOTIFY,
-                                  NULL, FALSE);
-         event->visibility.state = new_visibility;
-       }
-    }
-}
-
-static void
-gdk_window_update_visibility_recursively (GdkWindow *window,
-                                         GdkWindow *only_for_impl)
-{
-  GdkWindow *child;
-  GList *l;
-
-  gdk_window_update_visibility (window);
-  for (l = window->children; l != NULL; l = l->next)
-    {
-      child = l->data;
-      if ((only_for_impl == NULL) ||
-         (only_for_impl == child->impl_window))
-       gdk_window_update_visibility_recursively (child, only_for_impl);
-    }
-}
-
 static gboolean
 should_apply_clip_as_shape (GdkWindow *window)
 {
@@ -814,42 +751,6 @@ recompute_visible_regions_internal (GdkWindow *private,
       private->clip_region = new_clip;
     }
 
-  if (clip_region_changed)
-    {
-      GdkVisibilityState visibility;
-      gboolean fully_visible;
-
-      if (cairo_region_is_empty (private->clip_region))
-       visibility = GDK_VISIBILITY_FULLY_OBSCURED;
-      else
-        {
-          if (private->shape)
-            {
-             fully_visible = cairo_region_equal (private->clip_region,
-                                               private->shape);
-            }
-          else
-            {
-             r.x = 0;
-             r.y = 0;
-             r.width = private->width;
-             r.height = private->height;
-             fully_visible = region_rect_equal (private->clip_region, &r);
-           }
-
-         if (fully_visible)
-           visibility = GDK_VISIBILITY_UNOBSCURED;
-         else
-           visibility = GDK_VISIBILITY_PARTIAL;
-       }
-
-      if (private->visibility != visibility)
-       {
-         private->visibility = visibility;
-         gdk_window_update_visibility (private);
-       }
-    }
-
   /* Update all children, recursively (except for root, where children are not exact). */
   if ((abs_pos_changed || clip_region_changed || recalculate_children) &&
       private->window_type != GDK_WINDOW_ROOT)
@@ -953,7 +854,6 @@ get_native_device_event_mask (GdkWindow *private,
         emulate events on children: */
       mask |=
        GDK_EXPOSURE_MASK |
-       GDK_VISIBILITY_NOTIFY_MASK |
        GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
         GDK_TOUCH_MASK |
         GDK_POINTER_MOTION_MASK |
@@ -3501,9 +3401,6 @@ gdk_window_show_internal (GdkWindow *window, gboolean raise)
     {
       recompute_visible_regions (window, FALSE);
 
-      /* If any decendants became visible we need to send visibility notify */
-      gdk_window_update_visibility_recursively (window, NULL);
-
       if (gdk_window_is_viewable (window))
         gdk_window_invalidate_rect_full (window, NULL, TRUE);
     }
@@ -3802,9 +3699,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS
   gdk_window_clear_old_updated_area (window);
   recompute_visible_regions (window, FALSE);
 
-  /* all decendants became non-visible, we need to send visibility notify */
-  gdk_window_update_visibility_recursively (window, NULL);
-
   if (was_mapped && !gdk_window_has_impl (window))
     {
       if (window->event_mask & GDK_STRUCTURE_MASK)
@@ -5645,7 +5539,6 @@ _gdk_make_event (GdkWindow    *window,
     case GDK_MAP:
     case GDK_UNMAP:
     case GDK_CLIENT_EVENT:
-    case GDK_VISIBILITY_NOTIFY:
     case GDK_DELETE:
     case GDK_DESTROY:
     case GDK_EXPOSE:
@@ -5968,13 +5861,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
     }
 #endif
 
-  if (event->type == GDK_VISIBILITY_NOTIFY)
-    {
-      event_window->native_visibility = event->visibility.state;
-      gdk_window_update_visibility_recursively (event_window, event_window);
-      goto out;
-    }
-
   if (event_window->window_type == GDK_WINDOW_ROOT)
     goto out;
 
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 432ac34..369f38f 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -789,32 +789,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
             break;
          }
 #endif /* G_ENABLE_DEBUG */
-
-      if (window == NULL)
-        {
-          return_val = FALSE;
-          break;
-        }
-
-      event->visibility.type = GDK_VISIBILITY_NOTIFY;
-      event->visibility.window = window;
-
-      switch (xevent->xvisibility.state)
-       {
-       case VisibilityFullyObscured:
-         event->visibility.state = GDK_VISIBILITY_FULLY_OBSCURED;
-         break;
-
-       case VisibilityPartiallyObscured:
-         event->visibility.state = GDK_VISIBILITY_PARTIAL;
-         break;
-
-        default:
-       case VisibilityUnobscured:
-         event->visibility.state = GDK_VISIBILITY_UNOBSCURED;
-         break;
-       }
-
+      /* not handled */
+      return_val = FALSE;
       break;
 
     case CreateNotify:
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index d89cc9f..52639cc 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -74,9 +74,6 @@ struct _GtkLayoutPrivate
   guint vscroll_policy : 1;
 
   /* Properties */
-
-  GdkVisibilityState visibility;
-
   GList *children;
 
   gint scroll_x;
@@ -719,7 +716,6 @@ gtk_layout_init (GtkLayout *layout)
 
   priv->scroll_x = 0;
   priv->scroll_y = 0;
-  priv->visibility = GDK_VISIBILITY_PARTIAL;
 
   priv->freeze_count = 0;
 }
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index a626438..198bd91 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1762,7 +1762,6 @@ gtk_main_do_event (GdkEvent *event)
     case GDK_SELECTION_REQUEST:
     case GDK_SELECTION_NOTIFY:
     case GDK_CLIENT_EVENT:
-    case GDK_VISIBILITY_NOTIFY:
     case GDK_WINDOW_STATE:
     case GDK_GRAB_BROKEN:
     case GDK_DAMAGE:
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 3942d79..e2a9b7d 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -9745,7 +9745,7 @@ text_window_realize (GtkTextWindow *win,
   window = gtk_widget_get_window (widget);
 
   win->window = gdk_window_new_child (window,
-                                      GDK_VISIBILITY_NOTIFY_MASK,
+                                      0,
                                       &win->allocation);
 
   gtk_widget_register_window (win->widget, win->window);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 7d7051a..ef2bbee 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -3701,7 +3701,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
          width = drag_allocation.width;
          height = drag_allocation.height;
          tree_view->priv->drag_highlight_window = gdk_window_new_child (gtk_widget_get_window (widget),
-                                                                         GDK_VISIBILITY_NOTIFY_MASK | 
GDK_POINTER_MOTION_MASK,
+                                                                         GDK_POINTER_MOTION_MASK,
                                                                          &(GdkRectangle){
                                                                            tree_view->priv->drag_column_x,
                                                                            0,
@@ -3751,7 +3751,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
            }
 
          tree_view->priv->drag_highlight_window = gdk_window_new_popup (gtk_widget_get_display (widget),
-                                                                         GDK_VISIBILITY_NOTIFY_MASK | 
GDK_POINTER_MOTION_MASK,
+                                                                         GDK_POINTER_MOTION_MASK,
                                                                          &(GdkRectangle) { x, y, width, 
height });
          gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_highlight_window);
 
@@ -3822,7 +3822,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
            }
 
          tree_view->priv->drag_highlight_window = gdk_window_new_popup (gtk_widget_get_display (widget),
-                                                                         GDK_VISIBILITY_NOTIFY_MASK | 
GDK_POINTER_MOTION_MASK,
+                                                                         GDK_POINTER_MOTION_MASK,
                                                                          &(GdkRectangle) { x, y, width, 
height });
          gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_highlight_window);
 
@@ -9680,7 +9680,7 @@ _gtk_tree_view_column_start_drag (GtkTreeView       *tree_view,
   button_allocation.y = 0;
 
   tree_view->priv->drag_window = gdk_window_new_child (gtk_widget_get_window (GTK_WIDGET (tree_view)),
-                                                       GDK_VISIBILITY_NOTIFY_MASK | GDK_POINTER_MOTION_MASK,
+                                                       GDK_POINTER_MOTION_MASK,
                                                        &button_allocation);
   gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_window);
 
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 1a154de..fda90dc 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6749,7 +6749,6 @@ gtk_widget_event_internal (GtkWidget      *widget,
   /* Non input events get handled right away */
   switch ((guint) event->type)
     {
-    case GDK_VISIBILITY_NOTIFY:
     case GDK_EXPOSE:
     case GDK_NOTHING:
     case GDK_DELETE:
@@ -6823,7 +6822,6 @@ gtk_widget_emit_event_signals (GtkWidget      *widget,
         case GDK_PAD_RING:
         case GDK_PAD_STRIP:
         case GDK_PAD_GROUP_MODE:
-        case GDK_VISIBILITY_NOTIFY:
        case GDK_EXPOSE:
        case GDK_NOTHING:
          signal_num = -1;


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