[gtk+] gdk: Get rid of owner change events



commit 437d70f56919916e884a81d3bff0170322ab2906
Author: Benjamin Otte <otte redhat com>
Date:   Sat Dec 2 16:05:53 2017 +0100

    gdk: Get rid of owner change events
    
    They're unused now.

 gdk/gdkevents.c                 |   28 +---------------------------
 gdk/gdkevents.h                 |   21 ---------------------
 gdk/gdkeventsprivate.h          |   30 ------------------------------
 gdk/wayland/gdkdevice-wayland.c |   25 ++++++-------------------
 gdk/x11/gdkdisplay-x11.c        |   25 -------------------------
 gtk/gtkmain.c                   |    4 ----
 gtk/gtkwidget.c                 |    1 -
 7 files changed, 7 insertions(+), 127 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 6bfd25a..0cafdb2 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -916,7 +916,6 @@ gdk_event_get_time (const GdkEvent *event)
       case GDK_MAP:
       case GDK_UNMAP:
       case GDK_WINDOW_STATE:
-      case GDK_OWNER_CHANGE:
       case GDK_GRAB_BROKEN:
       case GDK_EVENT_LAST:
       default:
@@ -1001,7 +1000,6 @@ gdk_event_get_state (const GdkEvent        *event,
       case GDK_MAP:
       case GDK_UNMAP:
       case GDK_WINDOW_STATE:
-      case GDK_OWNER_CHANGE:
       case GDK_GRAB_BROKEN:
       case GDK_PAD_BUTTON_PRESS:
       case GDK_PAD_BUTTON_RELEASE:
@@ -2853,8 +2851,7 @@ gdk_event_get_selection (const GdkEvent   *event,
 
   if (event->type == GDK_SELECTION_CLEAR ||
       event->type == GDK_SELECTION_NOTIFY ||
-      event->type == GDK_SELECTION_REQUEST ||
-      event->type == GDK_OWNER_CHANGE)
+      event->type == GDK_SELECTION_REQUEST)
     {
       *selection = event->selection.selection;
       return TRUE;
@@ -2864,29 +2861,6 @@ gdk_event_get_selection (const GdkEvent   *event,
 }
 
 /**
- * gdk_event_get_owner_change_reason:
- * @event: a #GdkEvent
- * @reason: (out):
- *
- * Returns: %TRUE on success, otherwise %FALSE
- **/
-gboolean
-gdk_event_get_owner_change_reason (const GdkEvent *event,
-                                   GdkOwnerChange *reason)
-{
-  if (!event)
-    return FALSE;
-
-  if (event->type == GDK_OWNER_CHANGE)
-    {
-      *reason = event->owner_change.reason;
-      return TRUE;
-    }
-
-  return FALSE;
-}
-
-/**
  * gdk_event_get_selection_property:
  * @event: a #GdkEvent
  * @property: (out) (optional):
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index 0f16035..9318e88 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -252,8 +252,6 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
  * @GDK_SCROLL: the scroll wheel was turned
  * @GDK_WINDOW_STATE: the state of a window has changed. See #GdkWindowState
  *   for the possible window states
- * @GDK_OWNER_CHANGE: the owner of a selection has changed. This event type
- *   was added in 2.6
  * @GDK_GRAB_BROKEN: a pointer or keyboard grab was broken. This event type
  *   was added in 2.8.
  * @GDK_DAMAGE: the content of the window has been changed. This event type
@@ -320,7 +318,6 @@ typedef enum
   GDK_CLIENT_EVENT     = 28,
   GDK_SCROLL            = 31,
   GDK_WINDOW_STATE      = 32,
-  GDK_OWNER_CHANGE      = 34,
   GDK_GRAB_BROKEN       = 35,
   GDK_DAMAGE            = 36,
   GDK_TOUCH_BEGIN       = 37,
@@ -515,21 +512,6 @@ typedef enum
   GDK_WINDOW_STATE_LEFT_RESIZABLE   = 1 << 16
 } GdkWindowState;
 
-/**
- * GdkOwnerChange:
- * @GDK_OWNER_CHANGE_NEW_OWNER: some other app claimed the ownership
- * @GDK_OWNER_CHANGE_DESTROY: the window was destroyed
- * @GDK_OWNER_CHANGE_CLOSE: the client was closed
- *
- * Specifies why a selection ownership was changed.
- */
-typedef enum
-{
-  GDK_OWNER_CHANGE_NEW_OWNER,
-  GDK_OWNER_CHANGE_DESTROY,
-  GDK_OWNER_CHANGE_CLOSE
-} GdkOwnerChange;
-
 GDK_AVAILABLE_IN_ALL
 GType     gdk_event_get_type            (void) G_GNUC_CONST;
 
@@ -747,9 +729,6 @@ gboolean       gdk_event_get_property (const GdkEvent   *event,
 GDK_AVAILABLE_IN_3_92
 gboolean       gdk_event_get_selection (const GdkEvent   *event,
                                         GdkAtom          *selection);
-GDK_AVAILABLE_IN_3_94
-gboolean       gdk_event_get_owner_change_reason (const GdkEvent *event,
-                                                  GdkOwnerChange *reason);
 GDK_AVAILABLE_IN_3_92
 gboolean       gdk_event_get_selection_property (const GdkEvent  *event,
                                                  GdkAtom         *property,
diff --git a/gdk/gdkeventsprivate.h b/gdk/gdkeventsprivate.h
index 669a747..7f2e7ca 100644
--- a/gdk/gdkeventsprivate.h
+++ b/gdk/gdkeventsprivate.h
@@ -432,34 +432,6 @@ struct _GdkEventSelection
 };
 
 /**
- * GdkEventOwnerChange:
- * @type: the type of the event (%GDK_OWNER_CHANGE).
- * @window: the window which received the event
- * @send_event: %TRUE if the event was sent explicitly.
- * @reason: the reason for the ownership change as a #GdkOwnerChange value
- * @selection: the atom identifying the selection
- * @time: the timestamp of the event
- * @selection_time: the time at which the selection ownership was taken
- *   over
- *
- * Generated when the owner of a selection changes. On X11, this
- * information is only available if the X server supports the XFIXES
- * extension.
- *
- * Since: 2.6
- */
-struct _GdkEventOwnerChange
-{
-  GdkEventType type;
-  GdkWindow *window;
-  gint8 send_event;
-  GdkOwnerChange reason;
-  GdkAtom selection;
-  guint32 time;
-  guint32 selection_time;
-};
-
-/**
  * GdkEventProximity:
  * @type: the type of the event (%GDK_PROXIMITY_IN or %GDK_PROXIMITY_OUT).
  * @window: the window which received the event.
@@ -738,7 +710,6 @@ struct _GdkEventPadGroupMode {
  * @configure: a #GdkEventConfigure
  * @property: a #GdkEventProperty
  * @selection: a #GdkEventSelection
- * @owner_change: a #GdkEventOwnerChange
  * @proximity: a #GdkEventProximity
  * @dnd: a #GdkEventDND
  * @window_state: a #GdkEventWindowState
@@ -795,7 +766,6 @@ union _GdkEvent
   GdkEventConfigure        configure;
   GdkEventProperty         property;
   GdkEventSelection        selection;
-  GdkEventOwnerChange              owner_change;
   GdkEventProximity        proximity;
   GdkEventDND               dnd;
   GdkEventWindowState       window_state;
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 367cedc..1fc93ed 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1056,23 +1056,6 @@ _gdk_wayland_device_get_keymap (GdkDevice *device)
 }
 
 static void
-emit_selection_owner_change (GdkWindow *window,
-                             GdkAtom    atom)
-{
-  GdkEvent *event;
-
-  event = gdk_event_new (GDK_OWNER_CHANGE);
-  event->owner_change.window = g_object_ref (window);
-  event->owner_change.reason = GDK_OWNER_CHANGE_NEW_OWNER;
-  event->owner_change.selection = atom;
-  event->owner_change.time = GDK_CURRENT_TIME;
-  event->owner_change.selection_time = GDK_CURRENT_TIME;
-
-  gdk_event_put (event);
-  gdk_event_free (event);
-}
-
-static void
 data_device_data_offer (void                  *data,
                         struct wl_data_device *data_device,
                         struct wl_data_offer  *offer)
@@ -1133,7 +1116,7 @@ data_device_enter (void                  *data,
 
   gdk_wayland_selection_set_offer (seat->display, selection, offer);
 
-  emit_selection_owner_change (dest_window, selection);
+  /* emit_selection_owner_change (dest_window, selection); */
 }
 
 static void
@@ -1213,6 +1196,7 @@ data_device_selection (void                  *data,
   selection = gdk_atom_intern_static_string ("CLIPBOARD");
   gdk_wayland_selection_set_offer (seat->display, selection, offer);
 
+#if 0
   /* If we already have keyboard focus, the selection was targeted at the
    * focused surface. If we don't we will receive keyboard focus directly after
    * this, so lets wait and find out what window will get the focus before
@@ -1222,6 +1206,7 @@ data_device_selection (void                  *data,
     emit_selection_owner_change (seat->keyboard_focus, selection);
   else
     seat->pending_selection = selection;
+#endif
 }
 
 static const struct wl_data_device_listener data_device_listener = {
@@ -1264,7 +1249,7 @@ primary_selection_selection (void                                *data,
 
   selection = gdk_atom_intern_static_string ("PRIMARY");
   gdk_wayland_selection_set_offer (seat->display, selection, gtk_primary_offer);
-  emit_selection_owner_change (seat->keyboard_focus, selection);
+  /* emit_selection_owner_change (seat->keyboard_focus, selection); */
 }
 
 static const struct gtk_primary_selection_device_listener primary_selection_device_listener = {
@@ -1872,12 +1857,14 @@ keyboard_handle_enter (void               *data,
 
   _gdk_wayland_display_deliver_event (seat->display, event);
 
+  /*
   if (seat->pending_selection != NULL)
     {
       emit_selection_owner_change (seat->keyboard_focus,
                                    seat->pending_selection);
       seat->pending_selection = NULL;
     }
+  */
 }
 
 static void stop_key_repeat (GdkWaylandSeat *seat);
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index bc63583..579510a 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -1130,31 +1130,6 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
       break;
 
     default:
-#ifdef HAVE_XFIXES
-      if (xevent->type - display_x11->xfixes_event_base == XFixesSelectionNotify)
-       {
-         XFixesSelectionNotifyEvent *selection_notify = (XFixesSelectionNotifyEvent *)xevent;
-
-          if (selection_notify->selection == get_cm_atom (display))
-            {
-              gboolean composited = selection_notify->owner != None;
-
-              gdk_display_set_composited (display, composited);
-            }
-
-          event->owner_change.type = GDK_OWNER_CHANGE;
-          event->owner_change.window = window;
-          event->owner_change.reason = selection_notify->subtype;
-          event->owner_change.selection =
-            gdk_x11_xatom_to_atom_for_display (display,
-                                               selection_notify->selection);
-          event->owner_change.time = selection_notify->timestamp;
-          event->owner_change.selection_time = selection_notify->selection_timestamp;
-
-          return_val = TRUE;
-       }
-      else
-#endif
 #ifdef HAVE_RANDR
       if (xevent->type - display_x11->xrandr_event_base == RRScreenChangeNotify ||
           xevent->type - display_x11->xrandr_event_base == RRNotify)
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 5cff51e..5c01ec4 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1684,9 +1684,6 @@ gtk_main_do_event (GdkEvent *event)
   GdkDevice *device;
   GList *tmp_list;
 
-  if (event->type == GDK_OWNER_CHANGE)
-    return;
-
   /* Find the widget which got the event. We store the widget
    * in the user_data field of GdkWindow's. Ignore the event
    * if we don't have a widget for it, except for GDK_PROPERTY_NOTIFY
@@ -1906,7 +1903,6 @@ gtk_main_do_event (GdkEvent *event)
     case GDK_DROP_START:
       _gtk_drag_dest_handle_event (event_widget, event);
       break;
-    case GDK_OWNER_CHANGE:
     case GDK_EVENT_LAST:
     default:
       g_assert_not_reached ();
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 9997d51..769227e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6732,7 +6732,6 @@ gtk_widget_emit_event_signals (GtkWidget      *widget,
         case GDK_DROP_START:
         case GDK_DROP_FINISHED:
         case GDK_CLIENT_EVENT:
-        case GDK_OWNER_CHANGE:
         case GDK_DAMAGE:
         case GDK_EVENT_LAST:
         case GDK_TOUCHPAD_SWIPE:


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