[gtk+] Make gdk_event_get_pointer_emulated public



commit 0f476590fbf7bbf10968909676c5f45a592435f7
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue May 10 15:16:45 2016 -0400

    Make gdk_event_get_pointer_emulated public
    
    There is not strong reason to keep the getter private.
    At the same time, strip _-prefixes from a few other GdkEvent
    APIs. Update all callers.

 gdk/broadway/gdkeventsource.c       |    4 ++--
 gdk/gdkevents.c                     |    6 +++---
 gdk/gdkevents.h                     |    3 +++
 gdk/gdkinternals.h                  |    8 ++++----
 gdk/gdkprivate.h                    |    2 --
 gdk/gdkwindow.c                     |   30 +++++++++++++++---------------
 gdk/mir/gdkmireventsource.c         |    4 ++--
 gdk/quartz/gdkevents-quartz.c       |    4 ++--
 gdk/wayland/gdkdevice-wayland.c     |    6 +++---
 gdk/win32/gdkevents-win32.c         |    2 +-
 gdk/x11/gdkdevicemanager-core-x11.c |    2 +-
 gdk/x11/gdkdevicemanager-xi2.c      |   12 ++++++------
 gtk/gtkmenu.c                       |    4 +---
 13 files changed, 43 insertions(+), 44 deletions(-)
---
diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c
index 9d795c4..0c4612a 100644
--- a/gdk/broadway/gdkeventsource.c
+++ b/gdk/broadway/gdkeventsource.c
@@ -273,7 +273,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
        gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_pointer));
 
         if (message->touch.is_emulated)
-          _gdk_event_set_pointer_emulated (event, TRUE);
+          gdk_event_set_pointer_emulated (event, TRUE);
 
         if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE)
           event->touch.state |= GDK_BUTTON1_MASK;
@@ -295,7 +295,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
        event->key.keyval = message->key.key;
        event->key.state = message->key.state;
        event->key.hardware_keycode = message->key.key;
-        _gdk_event_set_scancode (event, message->key.key);
+        gdk_event_set_scancode (event, message->key.key);
        event->key.length = 0;
        gdk_event_set_device (event, device_manager->core_keyboard);
        gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_keyboard));
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 9f31e27..94c1842 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -595,8 +595,8 @@ gdk_event_is_allocated (const GdkEvent *event)
 }
 
 void
-_gdk_event_set_pointer_emulated (GdkEvent *event,
-                                 gboolean  emulated)
+gdk_event_set_pointer_emulated (GdkEvent *event,
+                                gboolean  emulated)
 {
   if (gdk_event_is_allocated (event))
     {
@@ -610,7 +610,7 @@ _gdk_event_set_pointer_emulated (GdkEvent *event,
 }
 
 gboolean
-_gdk_event_get_pointer_emulated (GdkEvent *event)
+gdk_event_get_pointer_emulated (GdkEvent *event)
 {
   if (gdk_event_is_allocated (event))
     return (((GdkEventPrivate *) event)->flags & GDK_EVENT_POINTER_EMULATED) != 0;
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index 0fea302..dec5c1b 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -1454,6 +1454,9 @@ void           gdk_event_set_device_tool (GdkEvent       *event,
 GDK_AVAILABLE_IN_3_22
 int            gdk_event_get_scancode    (GdkEvent *event);
 
+GDK_AVAILABLE_IN_3_22
+gboolean       gdk_event_get_pointer_emulated (GdkEvent *event);
+
 G_END_DECLS
 
 #endif /* __GDK_EVENTS_H__ */
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 2a003e0..03555d1 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -394,11 +394,11 @@ GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
 void _gdk_event_filter_unref        (GdkWindow      *window,
                                     GdkEventFilter *filter);
 
-void     _gdk_event_set_pointer_emulated (GdkEvent *event,
-                                          gboolean  emulated);
+void     gdk_event_set_pointer_emulated (GdkEvent *event,
+                                         gboolean  emulated);
 
-void     _gdk_event_set_scancode         (GdkEvent *event,
-                                          guint16 scancode);
+void     gdk_event_set_scancode        (GdkEvent *event,
+                                        guint16 scancode);
 
 void     gdk_event_set_seat              (GdkEvent *event,
                                           GdkSeat  *seat);
diff --git a/gdk/gdkprivate.h b/gdk/gdkprivate.h
index 8c0b425..b0121d2 100644
--- a/gdk/gdkprivate.h
+++ b/gdk/gdkprivate.h
@@ -38,8 +38,6 @@ GDK_AVAILABLE_IN_ALL
 void gdk_synthesize_window_state (GdkWindow     *window,
                                   GdkWindowState unset_flags,
                                   GdkWindowState set_flags);
-GDK_AVAILABLE_IN_3_22
-gboolean _gdk_event_get_pointer_emulated (GdkEvent *event);
 
 G_END_DECLS
 
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 210cca3..c273ce0 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -8836,7 +8836,7 @@ proxy_pointer_event (GdkDisplay                 *display,
   if (pointer_info->need_touch_press_enter &&
       gdk_device_get_source (pointer_info->last_slave) != GDK_SOURCE_TOUCHSCREEN &&
       (source_event->type != GDK_TOUCH_UPDATE ||
-       _gdk_event_get_pointer_emulated (source_event)))
+       gdk_event_get_pointer_emulated (source_event)))
     {
       pointer_info->need_touch_press_enter = FALSE;
       need_synthetic_enter = TRUE;
@@ -8930,7 +8930,7 @@ proxy_pointer_event (GdkDisplay                 *display,
     }
 
   if ((source_event->type != GDK_TOUCH_UPDATE ||
-       _gdk_event_get_pointer_emulated (source_event)) &&
+       gdk_event_get_pointer_emulated (source_event)) &&
       pointer_info->window_under_pointer != pointer_window)
     {
       /* Either a toplevel crossing notify that ended up inside a child window,
@@ -8965,12 +8965,12 @@ proxy_pointer_event (GdkDisplay                 *display,
                                     source_event->type,
                                     state,
                                     &evmask,
-                                    _gdk_event_get_pointer_emulated (source_event),
+                                    gdk_event_get_pointer_emulated (source_event),
                                     serial);
 
       if (event_type == GDK_TOUCH_UPDATE)
         {
-          if (_gdk_event_get_pointer_emulated (source_event))
+          if (gdk_event_get_pointer_emulated (source_event))
             {
               /* Touch events emulating pointer events are transformed back
                * to pointer events if:
@@ -9138,7 +9138,7 @@ proxy_button_event (GdkEvent *source_event,
       !source_event->any.send_event &&
       (!pointer_grab ||
        (type == GDK_TOUCH_BEGIN && pointer_grab->implicit &&
-        !_gdk_event_get_pointer_emulated (source_event))))
+        !gdk_event_get_pointer_emulated (source_event))))
     {
       pointer_window =
        _gdk_window_find_descendant_at (toplevel_window,
@@ -9153,7 +9153,7 @@ proxy_button_event (GdkEvent *source_event,
        {
          if (w->event_mask & GDK_BUTTON_PRESS_MASK &&
               (type == GDK_BUTTON_PRESS ||
-               _gdk_event_get_pointer_emulated (source_event)))
+               gdk_event_get_pointer_emulated (source_event)))
            break;
 
           if (type == GDK_TOUCH_BEGIN &&
@@ -9175,7 +9175,7 @@ proxy_button_event (GdkEvent *source_event,
                                            serial, time_);
             }
           else if (type == GDK_BUTTON_PRESS ||
-                   _gdk_event_get_pointer_emulated (source_event))
+                   gdk_event_get_pointer_emulated (source_event))
             {
               _gdk_display_add_device_grab  (display,
                                              device,
@@ -9203,12 +9203,12 @@ proxy_button_event (GdkEvent *source_event,
                                 pointer_window,
                                 type, state,
                                 &evmask,
-                                _gdk_event_get_pointer_emulated (source_event),
+                                gdk_event_get_pointer_emulated (source_event),
                                 serial);
 
   if (type == GDK_TOUCH_BEGIN || type == GDK_TOUCH_END)
     {
-      if (_gdk_event_get_pointer_emulated (source_event))
+      if (gdk_event_get_pointer_emulated (source_event))
         {
           if ((evmask & GDK_TOUCH_MASK) == 0 ||
               !_gdk_display_has_touch_grab (display, device, sequence, serial))
@@ -9235,7 +9235,7 @@ proxy_button_event (GdkEvent *source_event,
 
   if ((type == GDK_BUTTON_PRESS ||
        (type == GDK_TOUCH_BEGIN &&
-        _gdk_event_get_pointer_emulated (source_event))) &&
+        gdk_event_get_pointer_emulated (source_event))) &&
       pointer_info->need_touch_press_enter)
     {
       GdkCrossingMode mode;
@@ -9263,7 +9263,7 @@ proxy_button_event (GdkEvent *source_event,
              source_event->scroll.direction == GDK_SCROLL_SMOOTH) ||
             ((evmask & GDK_SMOOTH_SCROLL_MASK) != 0 &&
              source_event->scroll.direction != GDK_SCROLL_SMOOTH &&
-             _gdk_event_get_pointer_emulated (source_event))))
+             gdk_event_get_pointer_emulated (source_event))))
     return FALSE;
 
   event = _gdk_make_event (event_win, type, source_event, FALSE);
@@ -9303,7 +9303,7 @@ proxy_button_event (GdkEvent *source_event,
         _gdk_event_button_generate (display, event);
       else if ((type == GDK_BUTTON_RELEASE ||
                 (type == GDK_TOUCH_END &&
-                 _gdk_event_get_pointer_emulated (source_event))) &&
+                 gdk_event_get_pointer_emulated (source_event))) &&
                pointer_window == pointer_info->window_under_pointer &&
                gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)
         {
@@ -9340,7 +9340,7 @@ proxy_button_event (GdkEvent *source_event,
       gdk_event_set_source_device (event, source_device);
 
       if (((type == GDK_TOUCH_END || type == GDK_TOUCH_CANCEL) &&
-           _gdk_event_get_pointer_emulated (source_event)) &&
+           gdk_event_get_pointer_emulated (source_event)) &&
            pointer_window == pointer_info->window_under_pointer &&
            gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)
         {
@@ -9674,7 +9674,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
 
   if (pointer_info &&
       (!is_touch_type (event->type) ||
-       _gdk_event_get_pointer_emulated (event)))
+       gdk_event_get_pointer_emulated (event)))
     {
       guint old_state, old_button;
 
@@ -9722,7 +9722,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
         }
 
       if (event->type == GDK_BUTTON_RELEASE ||
-          _gdk_event_get_pointer_emulated (event))
+          gdk_event_get_pointer_emulated (event))
         {
           button_release_grab =
             _gdk_display_has_device_grab (display, device, serial);
diff --git a/gdk/mir/gdkmireventsource.c b/gdk/mir/gdkmireventsource.c
index c8e7a48..458228a 100644
--- a/gdk/mir/gdkmireventsource.c
+++ b/gdk/mir/gdkmireventsource.c
@@ -133,7 +133,7 @@ generate_key_event (GdkWindow *window, GdkEventType type, guint state, guint key
   event->key.state = state;
   event->key.keyval = keyval;
   event->key.hardware_keycode = keycode + 8;
-  _gdk_event_set_scancode (event, keycode + 8);
+  gdk_event_set_scancode (event, keycode + 8);
   event->key.is_modifier = is_modifier;
   event->key.time = event_time;
   set_key_event_string (&event->key);
@@ -347,7 +347,7 @@ handle_touch_event (GdkWindow           *window,
       gdk_event->touch.x_root = mir_touch_event_axis_value (mir_touch_event, i, mir_touch_axis_x);
       gdk_event->touch.y_root = mir_touch_event_axis_value (mir_touch_event, i, mir_touch_axis_y);
       gdk_event->touch.emulating_pointer = TRUE;
-      _gdk_event_set_pointer_emulated (gdk_event, TRUE);
+      gdk_event_set_pointer_emulated (gdk_event, TRUE);
 
       send_event (window, get_pointer (window), gdk_event);
     }
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index 856c946..01a4008 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -1134,7 +1134,7 @@ fill_key_event (GdkWindow    *window,
   event->key.time = get_time_from_ns_event (nsevent);
   event->key.state = get_keyboard_modifiers_from_ns_event (nsevent);
   event->key.hardware_keycode = [nsevent keyCode];
-  _gdk_event_set_scancode (event, [nsevent keyCode]);
+  gdk_event_set_scancode (event, [nsevent keyCode]);
   event->key.group = ([nsevent modifierFlags] & NSAlternateKeyMask) ? 1 : 0;
   event->key.keyval = GDK_KEY_VoidSymbol;
 
@@ -1634,7 +1634,7 @@ gdk_event_translate (GdkEvent *event,
                 GdkEvent *emulated_event;
 
                 emulated_event = gdk_event_new (GDK_SCROLL);
-                _gdk_event_set_pointer_emulated (emulated_event, TRUE);
+                gdk_event_set_pointer_emulated (emulated_event, TRUE);
                 fill_scroll_event (window, emulated_event, nsevent,
                                    x, y, x_root, y_root,
                                    dx, dy, direction);
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index 71389e3..2da74de 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1083,7 +1083,7 @@ create_scroll_event (GdkWaylandSeat *seat,
   event->scroll.state = device_get_modifiers (seat->master_pointer);
   gdk_event_set_screen (event, display->screen);
 
-  _gdk_event_set_pointer_emulated (event, emulated);
+  gdk_event_set_pointer_emulated (event, emulated);
 
   get_coordinates (seat->master_pointer,
                    &event->scroll.x,
@@ -1846,7 +1846,7 @@ deliver_key_event (GdkWaylandSeat *seat,
   event->key.state = device_get_modifiers (seat->master_pointer);
   event->key.group = 0;
   event->key.hardware_keycode = key;
-  _gdk_event_set_scancode (event, key);
+  gdk_event_set_scancode (event, key);
   event->key.keyval = sym;
   event->key.is_modifier = _gdk_wayland_keymap_key_is_modifier (keymap, key);
 
@@ -2042,7 +2042,7 @@ _create_touch_event (GdkWaylandSeat       *seat,
 
   if (touch->initial_touch)
     {
-      _gdk_event_set_pointer_emulated (event, TRUE);
+      gdk_event_set_pointer_emulated (event, TRUE);
       event->touch.emulating_pointer = TRUE;
     }
 
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index 2c8f0fa..4f01da9 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -2340,7 +2340,7 @@ gdk_event_translate (MSG  *msg,
       event->key.length = 0;
       event->key.hardware_keycode = msg->wParam;
       /* save original scancode */
-      _gdk_event_set_scancode (event, msg->lParam >> 16);
+      gdk_event_set_scancode (event, msg->lParam >> 16);
       gdk_event_set_device (event, device_manager_win32->core_keyboard);
       gdk_event_set_source_device (event, device_manager_win32->system_keyboard);
       gdk_event_set_seat (event, gdk_device_get_seat (device_manager_win32->core_keyboard));
diff --git a/gdk/x11/gdkdevicemanager-core-x11.c b/gdk/x11/gdkdevicemanager-core-x11.c
index 84f9641..350a79b 100644
--- a/gdk/x11/gdkdevicemanager-core-x11.c
+++ b/gdk/x11/gdkdevicemanager-core-x11.c
@@ -160,7 +160,7 @@ translate_key_event (GdkDisplay              *display,
   event->key.state = (GdkModifierType) xevent->xkey.state;
   event->key.group = gdk_x11_keymap_get_group_for_state (keymap, xevent->xkey.state);
   event->key.hardware_keycode = xevent->xkey.keycode;
-  _gdk_event_set_scancode (event, xevent->xkey.keycode);
+  gdk_event_set_scancode (event, xevent->xkey.keycode);
 
   event->key.keyval = GDK_KEY_VoidSymbol;
 
diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c
index 1e5e77a..d75f4ab 100644
--- a/gdk/x11/gdkdevicemanager-xi2.c
+++ b/gdk/x11/gdkdevicemanager-xi2.c
@@ -1469,7 +1469,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
         event->key.group = xev->group.effective;
 
         event->key.hardware_keycode = xev->detail;
-        _gdk_event_set_scancode (event, xev->detail);
+        gdk_event_set_scancode (event, xev->detail);
         event->key.is_modifier = gdk_x11_keymap_key_is_modifier (keymap, event->key.hardware_keycode);
 
         device = g_hash_table_lookup (device_manager->id_table,
@@ -1563,7 +1563,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
 
 #ifdef XINPUT_2_2
             if (xev->flags & XIPointerEmulated)
-              _gdk_event_set_pointer_emulated (event, TRUE);
+              gdk_event_set_pointer_emulated (event, TRUE);
 #endif
           }
         else
@@ -1609,7 +1609,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
 
 #ifdef XINPUT_2_2
         if (xev->flags & XIPointerEmulated)
-          _gdk_event_set_pointer_emulated (event, TRUE);
+          gdk_event_set_pointer_emulated (event, TRUE);
 #endif
 
         if (return_val == FALSE)
@@ -1700,7 +1700,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
 
 #ifdef XINPUT_2_2
         if (xev->flags & XIPointerEmulated)
-          _gdk_event_set_pointer_emulated (event, TRUE);
+          gdk_event_set_pointer_emulated (event, TRUE);
 #endif
 
         /* There doesn't seem to be motion hints in XI */
@@ -1780,7 +1780,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
         if (xev->flags & XITouchEmulatingPointer)
           {
             event->touch.emulating_pointer = TRUE;
-            _gdk_event_set_pointer_emulated (event, TRUE);
+            gdk_event_set_pointer_emulated (event, TRUE);
           }
 
         if (return_val == FALSE)
@@ -1832,7 +1832,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
         if (xev->flags & XITouchEmulatingPointer)
           {
             event->touch.emulating_pointer = TRUE;
-            _gdk_event_set_pointer_emulated (event, TRUE);
+            gdk_event_set_pointer_emulated (event, TRUE);
           }
 
         event->touch.axes = translate_axes (event->touch.device,
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 78275d2..5bc8501 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -105,8 +105,6 @@
 
 #include  <gobject/gvaluecollector.h>
 
-#include <gdk/gdkprivate.h> /* for _gdk_event_get_pointer_emulated() */
-
 #include "gtkaccellabel.h"
 #include "gtkaccelmap.h"
 #include "gtkadjustment.h"
@@ -3556,7 +3554,7 @@ gtk_menu_scroll (GtkWidget      *widget,
 {
   GtkMenu *menu = GTK_MENU (widget);
 
-  if (_gdk_event_get_pointer_emulated ((GdkEvent *) event))
+  if (gdk_event_get_pointer_emulated ((GdkEvent *) event))
     return GDK_EVENT_PROPAGATE;
 
   switch (event->direction)


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