[gtk/readonly-events-1: 121/149] events: Drop all setters



commit 1026bfb1ac6cfb5b47012b0a7f43ab85dabfbd91
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Feb 16 02:53:44 2020 -0500

    events: Drop all setters
    
    GdkEvent is now truly readonly.

 gdk/gdkevents.c    | 156 -----------------------------------------------------
 gdk/gdkevents.h    |  22 --------
 gdk/gdkinternals.h |   6 ---
 3 files changed, 184 deletions(-)
---
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 9b867d00dc..4a06ce4c11 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -380,16 +380,6 @@ gdk_event_unref (GdkEvent *event)
     gdk_event_free (event);
 }
 
-void
-gdk_event_set_pointer_emulated (GdkEvent *event,
-                                gboolean  emulated)
-{
-  if (emulated)
-    event->any.flags |= GDK_EVENT_POINTER_EMULATED;
-  else
-    event->any.flags &= ~(GDK_EVENT_POINTER_EMULATED);
-}
-
 /**
  * gdk_event_get_pointer_emulated:
  * @event: a #GdkEvent
@@ -707,64 +697,6 @@ gdk_event_get_coords (const GdkEvent *event,
   return fetched;
 }
 
-void
-gdk_event_set_coords (GdkEvent *event,
-                      gdouble   x,
-                      gdouble   y)
-{
-  g_return_if_fail (event != NULL);
-
-  switch ((guint) event->any.type)
-    {
-    case GDK_CONFIGURE:
-      event->configure.x = x;
-      event->configure.y = y;
-      break;
-    case GDK_ENTER_NOTIFY:
-    case GDK_LEAVE_NOTIFY:
-      event->crossing.x = x;
-      event->crossing.y = y;
-      break;
-    case GDK_SCROLL:
-      event->scroll.x = x;
-      event->scroll.y = y;
-      break;
-    case GDK_BUTTON_PRESS:
-    case GDK_BUTTON_RELEASE:
-      event->button.x = x;
-      event->button.y = y;
-      break;
-    case GDK_TOUCH_BEGIN:
-    case GDK_TOUCH_UPDATE:
-    case GDK_TOUCH_END:
-    case GDK_TOUCH_CANCEL:
-      event->touch.x = x;
-      event->touch.y = y;
-      break;
-    case GDK_MOTION_NOTIFY:
-      event->motion.x = x;
-      event->motion.y = y;
-      break;
-    case GDK_TOUCHPAD_SWIPE:
-      event->touchpad_swipe.x = x;
-      event->touchpad_swipe.y = y;
-      break;
-    case GDK_TOUCHPAD_PINCH:
-      event->touchpad_pinch.x = x;
-      event->touchpad_pinch.y = y;
-      break;
-    case GDK_DRAG_ENTER:
-    case GDK_DRAG_LEAVE:
-    case GDK_DRAG_MOTION:
-    case GDK_DROP_START:
-      event->dnd.x = x;
-      event->dnd.y = y;
-      break;
-    default:
-      break;
-    }
-}
-
 /**
  * gdk_event_get_button:
  * @event: a #GdkEvent
@@ -872,15 +804,6 @@ gdk_event_get_keyval (const GdkEvent *event,
   return fetched;
 }
 
-void
-gdk_event_set_keyval (GdkEvent *event,
-                      guint     keyval)
-{
-  if (event->any.type == GDK_KEY_PRESS ||
-      event->any.type == GDK_KEY_RELEASE)
-    event->key.keyval = keyval;
-}
-
 /**
  * gdk_event_get_keycode:
  * @event: a #GdkEvent
@@ -1160,22 +1083,6 @@ gdk_event_get_axis (const GdkEvent *event,
   return gdk_device_get_axis (event->any.device, axes, axis_use, value);
 }
 
-/**
- * gdk_event_set_device:
- * @event: a #GdkEvent
- * @device: a #GdkDevice
- *
- * Sets the device for @event to @device. The event must
- * have been allocated by GTK+, for instance, by
- * gdk_event_copy().
- **/
-void
-gdk_event_set_device (GdkEvent  *event,
-                      GdkDevice *device)
-{
-  g_set_object (&event->any.device, device);
-}
-
 /**
  * gdk_event_get_device:
  * @event: a #GdkEvent.
@@ -1193,23 +1100,6 @@ gdk_event_get_device (const GdkEvent *event)
   return event->any.device;
 }
 
-/**
- * gdk_event_set_source_device:
- * @event: a #GdkEvent
- * @device: a #GdkDevice
- *
- * Sets the slave device for @event to @device.
- *
- * The event must have been allocated by GTK+,
- * for instance by gdk_event_copy().
- **/
-void
-gdk_event_set_source_device (GdkEvent  *event,
-                             GdkDevice *device)
-{
-  g_set_object (&event->any.source_device, device);
-}
-
 /**
  * gdk_event_get_source_device:
  * @event: a #GdkEvent
@@ -1411,20 +1301,6 @@ gdk_events_get_center (GdkEvent *event1,
   return TRUE;
 }
 
-/**
- * gdk_event_set_display:
- * @event: a #GdkEvent
- * @display: a #GdkDisplay
- *
- * Sets the display that an event is associated with.
- */
-void
-gdk_event_set_display (GdkEvent   *event,
-                       GdkDisplay *display)
-{
-  event->any.display = display;
-}
-
 /**
  * gdk_event_get_display:
  * @event: a #GdkEvent
@@ -1583,38 +1459,6 @@ gdk_event_get_device_tool (const GdkEvent *event)
   return NULL;
 }
 
-/**
- * gdk_event_set_device_tool:
- * @event: a #GdkEvent
- * @tool: (nullable): tool to set on the event, or %NULL
- *
- * Sets the device tool for this event, should be rarely used.
- **/
-void
-gdk_event_set_device_tool (GdkEvent      *event,
-                           GdkDeviceTool *tool)
-{
-  if (event->any.type == GDK_BUTTON_PRESS ||
-      event->any.type == GDK_BUTTON_RELEASE)
-    g_set_object (&event->button.tool, tool);
-  else if (event->any.type == GDK_MOTION_NOTIFY)
-    g_set_object (&event->motion.tool, tool);
-  else if (event->any.type == GDK_PROXIMITY_IN ||
-           event->any.type == GDK_PROXIMITY_OUT)
-    g_set_object (&event->proximity.tool, tool);
-  else if (event->any.type == GDK_SCROLL)
-    g_set_object (&event->scroll.tool, tool);
-}
-
-void
-gdk_event_set_scancode (GdkEvent *event,
-                        guint16 scancode)
-{
-  if (event->any.type == GDK_KEY_PRESS ||
-      event->any.type == GDK_KEY_RELEASE)
-    event->key.key_scancode = scancode;
-}
-
 /**
  * gdk_event_get_scancode:
  * @event: a #GdkEvent
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index 03d7aa28b9..66afe79796 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -353,10 +353,6 @@ gboolean  gdk_event_get_coords             (const GdkEvent  *event,
                                         gdouble         *x_win,
                                         gdouble         *y_win);
 GDK_AVAILABLE_IN_ALL
-void      gdk_event_set_coords          (GdkEvent *event,
-                                         gdouble   x,
-                                         gdouble   y);
-GDK_AVAILABLE_IN_ALL
 gboolean  gdk_event_get_button          (const GdkEvent *event,
                                          guint          *button);
 GDK_AVAILABLE_IN_ALL
@@ -366,10 +362,6 @@ GDK_AVAILABLE_IN_ALL
 gboolean  gdk_event_get_keyval          (const GdkEvent *event,
                                          guint          *keyval);
 
-GDK_AVAILABLE_IN_ALL
-void      gdk_event_set_keyval          (GdkEvent *event,
-                                         guint     keyval);
-
 GDK_AVAILABLE_IN_ALL
 gboolean  gdk_event_get_keycode         (const GdkEvent *event,
                                          guint16        *keycode);
@@ -396,14 +388,8 @@ gboolean  gdk_event_get_axis            (const GdkEvent  *event,
                                          GdkAxisUse       axis_use,
                                          gdouble         *value);
 GDK_AVAILABLE_IN_ALL
-void       gdk_event_set_device         (GdkEvent        *event,
-                                         GdkDevice       *device);
-GDK_AVAILABLE_IN_ALL
 GdkDevice* gdk_event_get_device         (const GdkEvent  *event);
 GDK_AVAILABLE_IN_ALL
-void       gdk_event_set_source_device  (GdkEvent        *event,
-                                         GdkDevice       *device);
-GDK_AVAILABLE_IN_ALL
 GdkDevice* gdk_event_get_source_device  (const GdkEvent  *event);
 GDK_AVAILABLE_IN_ALL
 gboolean   gdk_event_triggers_context_menu (const GdkEvent *event);
@@ -421,10 +407,6 @@ gboolean  gdk_events_get_center         (GdkEvent        *event1,
                                          GdkEvent        *event2,
                                          gdouble         *x,
                                          gdouble         *y);
-
-GDK_AVAILABLE_IN_ALL
-void       gdk_event_set_display        (GdkEvent        *event,
-                                         GdkDisplay      *display);
 GDK_AVAILABLE_IN_ALL
 GdkDisplay *gdk_event_get_display       (const GdkEvent  *event);
 
@@ -445,10 +427,6 @@ gboolean  gdk_get_show_events              (void);
 GDK_AVAILABLE_IN_ALL
 GdkDeviceTool *gdk_event_get_device_tool (const GdkEvent *event);
 
-GDK_AVAILABLE_IN_ALL
-void           gdk_event_set_device_tool (GdkEvent       *event,
-                                          GdkDeviceTool  *tool);
-
 GDK_AVAILABLE_IN_ALL
 int            gdk_event_get_scancode    (GdkEvent *event);
 
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 81a5dc8437..25b2d8d5ae 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -124,12 +124,6 @@ extern gint       _gdk_screen_number;
 
 GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
 
-void     gdk_event_set_pointer_emulated (GdkEvent *event,
-                                         gboolean  emulated);
-
-void     gdk_event_set_scancode        (GdkEvent *event,
-                                        guint16 scancode);
-
 void   _gdk_event_emit               (GdkEvent   *event);
 GList* _gdk_event_queue_find_first   (GdkDisplay *display);
 void   _gdk_event_queue_remove_link  (GdkDisplay *display,


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