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.
This commit is contained in:
Matthias Clasen 2016-05-10 15:16:45 -04:00
parent 126156e820
commit 0f476590fb
13 changed files with 43 additions and 44 deletions

View File

@ -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));

View File

@ -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;

View File

@ -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__ */

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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));

View File

@ -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;

View File

@ -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,

View File

@ -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)