[gtk/readonly-events-1: 5/35] Stop using g_object_ref/unref on events



commit 4d2525e510307f7bd0941cf9460a318e0af7ef4b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Feb 15 15:07:24 2020 -0500

    Stop using g_object_ref/unref on events
    
    Use gdk_event_ref/unref instead of g_object_ref/unref.
    Events will stop being object soon.

 demos/gtk-demo/popover.c        | 2 +-
 gdk/broadway/gdkeventsource.c   | 2 +-
 gdk/gdkdisplay.c                | 4 ++--
 gdk/gdkdrop.c                   | 2 +-
 gdk/gdkevents.c                 | 2 +-
 gdk/gdksurface.c                | 2 +-
 gdk/wayland/gdkdevice-wayland.c | 4 ++--
 gdk/wayland/gdkeventsource.c    | 2 +-
 gdk/win32/gdkevents-win32.c     | 4 ++--
 gdk/x11/gdkdevicemanager-xi2.c  | 2 +-
 gdk/x11/gdkeventsource.c        | 2 +-
 gtk/gtkbutton.c                 | 4 ++--
 gtk/gtkcombobox.c               | 2 +-
 gtk/gtkgesture.c                | 6 +++---
 gtk/gtkmain.c                   | 6 +++---
 gtk/gtkscrolledwindow.c         | 2 +-
 gtk/gtktreeview.c               | 6 +++---
 gtk/gtkwidget.c                 | 2 +-
 gtk/gtkwindow.c                 | 2 +-
 19 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/demos/gtk-demo/popover.c b/demos/gtk-demo/popover.c
index a1726f8aab..03652f6d39 100644
--- a/demos/gtk-demo/popover.c
+++ b/demos/gtk-demo/popover.c
@@ -119,7 +119,7 @@ day_selected_cb (GtkCalendar *calendar,
 
   gtk_widget_show (popover);
 
-  g_object_unref (event);
+  gdk_event_unref (event);
 }
 
 GtkWidget *
diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c
index bd3a64bf93..9e8f56296c 100644
--- a/gdk/broadway/gdkeventsource.c
+++ b/gdk/broadway/gdkeventsource.c
@@ -376,7 +376,7 @@ gdk_event_source_dispatch (GSource     *source,
     {
       _gdk_event_emit (event);
 
-      g_object_unref (event);
+      gdk_event_unref (event);
     }
 
   return TRUE;
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index 5835b6c35a..8f9c176f7a 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -469,7 +469,7 @@ gdk_display_peek_event (GdkDisplay *display)
   tmp_list = _gdk_event_queue_find_first (display);
   
   if (tmp_list != NULL)
-    return g_object_ref (tmp_list->data);
+    return gdk_event_ref (tmp_list->data);
 
   return NULL;
 }
@@ -489,7 +489,7 @@ gdk_display_put_event (GdkDisplay     *display,
   g_return_if_fail (GDK_IS_DISPLAY (display));
   g_return_if_fail (event != NULL);
 
-  _gdk_event_queue_append (display, g_object_ref ((GdkEvent *)event));
+  _gdk_event_queue_append (display, gdk_event_ref ((GdkEvent *)event));
 }
 
 static void
diff --git a/gdk/gdkdrop.c b/gdk/gdkdrop.c
index 24a6b6a863..0602d957bf 100644
--- a/gdk/gdkdrop.c
+++ b/gdk/gdkdrop.c
@@ -926,7 +926,7 @@ gdk_drop_do_emit_event (GdkEvent *event,
   if (dont_queue)
     {
       _gdk_event_emit (event);
-      g_object_unref (event);
+      gdk_event_unref (event);
     }
   else
     {
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 2b39a10e3e..80c8b45469 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -420,7 +420,7 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
             GDK_BUTTON4_MASK | GDK_BUTTON5_MASK)))
         gdk_event_push_history (last_motion, pending_motions->data);
 
-      g_object_unref (pending_motions->data);
+      gdk_event_unref (pending_motions->data);
       g_queue_delete_link (&display->queued_events, pending_motions);
       pending_motions = next;
     }
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index 18ba550c7a..01b2bd8fed 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -2758,7 +2758,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
     {
       _gdk_event_queue_remove_link (display, event_link);
       g_list_free_1 (event_link);
-      g_object_unref (event);
+      gdk_event_unref (event);
     }
 
   /* This does two things - first it sees if there are motions at the
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 7892a39e23..e1f69aa15a 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -3224,7 +3224,7 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet,
   if (!event)
     return;
 
-  g_object_ref (event);
+  gdk_event_ref (event);
 
   if (event->any.type == GDK_PROXIMITY_OUT)
     emulate_crossing (event->any.surface, NULL,
@@ -3239,7 +3239,7 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet,
                       tablet->master, GDK_ENTER_NOTIFY,
                       GDK_CROSSING_NORMAL, time);
 
-  g_object_unref (event);
+  gdk_event_unref (event);
 }
 
 static void
diff --git a/gdk/wayland/gdkeventsource.c b/gdk/wayland/gdkeventsource.c
index 86c3f86484..04ca9cbe61 100644
--- a/gdk/wayland/gdkeventsource.c
+++ b/gdk/wayland/gdkeventsource.c
@@ -121,7 +121,7 @@ gdk_event_source_dispatch (GSource     *base,
     {
       _gdk_event_emit (event);
 
-      g_object_unref (event);
+      gdk_event_unref (event);
     }
 
   return TRUE;
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index d997ec55fb..af8755be71 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -3588,7 +3588,7 @@ gdk_event_translate (MSG  *msg,
       if (event)
         {
           _gdk_win32_append_event (event);
-         g_object_unref (event);
+         gdk_event_unref (event);
         }
 
       break;
@@ -3670,7 +3670,7 @@ gdk_event_dispatch (GSource     *source,
     {
       _gdk_event_emit (event);
 
-      g_object_unref (event);
+      gdk_event_unref (event);
     }
 
   return TRUE;
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 9e763094ff..ae3714c10a 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1458,7 +1458,7 @@ _gdk_device_manager_xi2_handle_focus (GdkSurface *surface,
 
       event = gdk_event_focus_new (surface, device, source_device, focus_in);
       gdk_display_put_event (gdk_surface_get_display (surface), event);
-      g_object_unref (event);
+      gdk_event_unref (event);
     }
 }
 
diff --git a/gdk/x11/gdkeventsource.c b/gdk/x11/gdkeventsource.c
index 90bf2c326b..b72474b2d5 100644
--- a/gdk/x11/gdkeventsource.c
+++ b/gdk/x11/gdkeventsource.c
@@ -425,7 +425,7 @@ gdk_event_source_dispatch (GSource     *source,
     {
       _gdk_event_emit (event);
 
-      g_object_unref (event);
+      gdk_event_unref (event);
     }
 
   return TRUE;
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index c69024e84c..b8ee4dd2f6 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -318,13 +318,13 @@ touch_release_in_button (GtkButton *button)
 
   if (gdk_event_get_event_type (event) != GDK_TOUCH_END)
     {
-      g_object_unref (event);
+      gdk_event_unref (event);
       return FALSE;
     }
 
   gdk_event_get_coords (event, &x, &y);
 
-  g_object_unref (event);
+  gdk_event_unref (event);
 
   if (gtk_widget_contains (GTK_WIDGET (button), x, y))
     return TRUE;
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index e500a765f6..ac529c718e 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1800,7 +1800,7 @@ gtk_combo_box_menu_key (GtkEventControllerKey *key,
       gtk_event_controller_key_forward (key, GTK_WIDGET (combo_box));
     }
 
-  g_object_unref (event);
+  gdk_event_unref (event);
 
   return TRUE;
 }
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index 5e95de0cf9..398ab6020a 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -530,9 +530,9 @@ _gtk_gesture_update_point (GtkGesture     *gesture,
     }
 
   if (data->event)
-    g_object_unref (data->event);
+    gdk_event_unref (data->event);
 
-  data->event = g_object_ref ((gpointer) event);
+  data->event = gdk_event_ref ((GdkEvent *)event);
   _update_touchpad_deltas (data);
   _update_widget_coordinates (gesture, data);
 
@@ -896,7 +896,7 @@ free_point_data (gpointer data)
   PointData *point = data;
 
   if (point->event)
-    g_object_unref (point->event);
+    gdk_event_unref (point->event);
 
   g_free (point);
 }
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 08e4d9c14d..0068782ee2 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -1392,7 +1392,7 @@ synth_crossing (GtkWidget       *widget,
     }
     
   gtk_widget_event (widget, event);
-  g_object_unref (event);
+  gdk_event_unref (event);
 }
 
 void
@@ -1907,7 +1907,7 @@ gtk_main_do_event (GdkEvent *event)
   g_list_free_1 (tmp_list);
 
   if (rewritten_event)
-    g_object_unref (rewritten_event);
+    gdk_event_unref (rewritten_event);
 }
 
 static GtkWindowGroup *
@@ -2262,7 +2262,7 @@ GdkEvent*
 gtk_get_current_event (void)
 {
   if (current_events)
-    return g_object_ref (current_events->data);
+    return gdk_event_ref (current_events->data);
   else
     return NULL;
 }
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 2a9aef9700..d26d84b7b4 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1223,7 +1223,7 @@ captured_motion (GtkScrolledWindow *sw,
         indicator_set_over (&priv->hindicator, FALSE);
     }
 
-  g_object_unref (event);
+  gdk_event_unref (event);
 }
 
 static gboolean
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 27b0576477..1018fa87e4 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -5438,11 +5438,11 @@ gtk_tree_view_key_controller_key_pressed (GtkEventControllerKey *key,
   event = gtk_get_current_event ();
   if (gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *)event))
     {
-      g_object_unref (event);
+      gdk_event_unref (event);
       return TRUE;
     }
 
-  g_object_unref (event);
+  gdk_event_unref (event);
 
   if (tree_view->search_entry_avoid_unhandled_binding)
     {
@@ -5497,7 +5497,7 @@ gtk_tree_view_key_controller_key_released (GtkEventControllerKey *key,
   /* Handle the keybindings. */
   event = gtk_get_current_event ();
   gtk_bindings_activate_event (G_OBJECT (tree_view), (GdkEventKey *)event);
-  g_object_unref (event);
+  gdk_event_unref (event);
 }
 
 static void
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 576fa68af5..7014c705f6 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7981,7 +7981,7 @@ synth_crossing (GtkWidget       *widget,
   if (widget)
     gtk_widget_event_internal (widget, event);
 
-  g_object_unref (event);
+  gdk_event_unref (event);
 }
 
 /*
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 1f228bae32..e14b07980d 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6391,7 +6391,7 @@ gtk_window_set_focus (GtkWindow *window,
 
   gtk_synthesize_crossing_events (GTK_ROOT (window), old_focus, focus, event, GDK_CROSSING_NORMAL);
 
-  g_object_unref (event);
+  gdk_event_unref (event);
 
   g_set_object (&priv->focus_widget, focus);
 


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