forked from AuroraMiddleware/gtk
gdk: Figure out the GdkSeat of an event from the GdkDevice
Removes the need for gdk_event_set_seat() and the GdkSeat field from GdkEventPrivate.
This commit is contained in:
parent
526486da6b
commit
8595e4b1d1
@ -525,7 +525,6 @@ gdk_event_copy (const GdkEvent *event)
|
||||
GdkEventPrivate *private = (GdkEventPrivate *)event;
|
||||
|
||||
new_private->display = private->display;
|
||||
new_private->seat = private->seat;
|
||||
g_set_object (&new_private->user_data, private->user_data);
|
||||
}
|
||||
|
||||
@ -1992,40 +1991,11 @@ gdk_event_get_event_type (const GdkEvent *event)
|
||||
GdkSeat *
|
||||
gdk_event_get_seat (const GdkEvent *event)
|
||||
{
|
||||
const GdkEventPrivate *priv;
|
||||
GdkDevice *device;
|
||||
|
||||
if (!gdk_event_is_allocated (event))
|
||||
return NULL;
|
||||
device = gdk_event_get_device (event);
|
||||
|
||||
priv = (const GdkEventPrivate *) event;
|
||||
|
||||
if (!priv->seat)
|
||||
{
|
||||
GdkDevice *device;
|
||||
|
||||
g_warning ("Event with type %d not holding a GdkSeat. "
|
||||
"It is most likely synthesized outside Gdk/GTK+",
|
||||
event->any.type);
|
||||
|
||||
device = gdk_event_get_device (event);
|
||||
|
||||
return device ? gdk_device_get_seat (device) : NULL;
|
||||
}
|
||||
|
||||
return priv->seat;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_event_set_seat (GdkEvent *event,
|
||||
GdkSeat *seat)
|
||||
{
|
||||
GdkEventPrivate *priv;
|
||||
|
||||
if (gdk_event_is_allocated (event))
|
||||
{
|
||||
priv = (GdkEventPrivate *) event;
|
||||
priv->seat = seat;
|
||||
}
|
||||
return device ? gdk_device_get_seat (device) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,7 +147,6 @@ struct _GdkEventPrivate
|
||||
{
|
||||
GdkEvent event;
|
||||
GdkDisplay *display;
|
||||
GdkSeat *seat;
|
||||
GObject *user_data;
|
||||
};
|
||||
|
||||
@ -297,9 +296,6 @@ void gdk_event_set_pointer_emulated (GdkEvent *event,
|
||||
void gdk_event_set_scancode (GdkEvent *event,
|
||||
guint16 scancode);
|
||||
|
||||
void gdk_event_set_seat (GdkEvent *event,
|
||||
GdkSeat *seat);
|
||||
|
||||
void _gdk_event_emit (GdkEvent *event);
|
||||
GList* _gdk_event_queue_find_first (GdkDisplay *display);
|
||||
void _gdk_event_queue_remove_link (GdkDisplay *display,
|
||||
|
@ -603,7 +603,6 @@ emulate_crossing (GdkWindow *window,
|
||||
event->crossing.detail = GDK_NOTIFY_NONLINEAR;
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
|
||||
gdk_window_get_device_position_double (window, device,
|
||||
&event->crossing.x, &event->crossing.y,
|
||||
@ -634,7 +633,6 @@ emulate_touch_crossing (GdkWindow *window,
|
||||
event->crossing.detail = GDK_NOTIFY_NONLINEAR;
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, source);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
|
||||
event->crossing.x = touch->x;
|
||||
event->crossing.y = touch->y;
|
||||
@ -657,7 +655,6 @@ emulate_focus (GdkWindow *window,
|
||||
event->focus_change.in = focus_in;
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
|
||||
_gdk_wayland_display_deliver_event (gdk_window_get_display (window), event);
|
||||
}
|
||||
@ -1385,7 +1382,6 @@ pointer_handle_enter (void *data,
|
||||
event->any.window = g_object_ref (seat->pointer_info.focus);
|
||||
gdk_event_set_device (event, seat->master_pointer);
|
||||
gdk_event_set_source_device (event, seat->pointer);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (seat->master_pointer));
|
||||
event->crossing.subwindow = NULL;
|
||||
event->crossing.time = (guint32)(g_get_monotonic_time () / 1000);
|
||||
event->crossing.mode = GDK_CROSSING_NORMAL;
|
||||
@ -1434,7 +1430,6 @@ pointer_handle_leave (void *data,
|
||||
event->any.window = g_object_ref (seat->pointer_info.focus);
|
||||
gdk_event_set_device (event, seat->master_pointer);
|
||||
gdk_event_set_source_device (event, seat->pointer);
|
||||
gdk_event_set_seat (event, GDK_SEAT (seat));
|
||||
event->crossing.subwindow = NULL;
|
||||
event->crossing.time = (guint32)(g_get_monotonic_time () / 1000);
|
||||
event->crossing.mode = GDK_CROSSING_NORMAL;
|
||||
@ -1485,7 +1480,6 @@ pointer_handle_motion (void *data,
|
||||
event->any.window = g_object_ref (seat->pointer_info.focus);
|
||||
gdk_event_set_device (event, seat->master_pointer);
|
||||
gdk_event_set_source_device (event, seat->pointer);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (seat->master_pointer));
|
||||
event->motion.time = time;
|
||||
event->motion.axes = NULL;
|
||||
event->motion.state = device_get_modifiers (seat->master_pointer);
|
||||
@ -1553,7 +1547,6 @@ pointer_handle_button (void *data,
|
||||
event->any.window = g_object_ref (seat->pointer_info.focus);
|
||||
gdk_event_set_device (event, seat->master_pointer);
|
||||
gdk_event_set_source_device (event, seat->pointer);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (seat->master_pointer));
|
||||
event->button.time = time;
|
||||
event->button.axes = NULL;
|
||||
event->button.state = device_get_modifiers (seat->master_pointer);
|
||||
@ -1801,7 +1794,6 @@ keyboard_handle_enter (void *data,
|
||||
event->focus_change.in = TRUE;
|
||||
gdk_event_set_device (event, seat->master_keyboard);
|
||||
gdk_event_set_source_device (event, seat->keyboard);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (seat->master_pointer));
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("focus in, seat %p surface %p",
|
||||
@ -1839,7 +1831,6 @@ keyboard_handle_leave (void *data,
|
||||
event->focus_change.in = FALSE;
|
||||
gdk_event_set_device (event, seat->master_keyboard);
|
||||
gdk_event_set_source_device (event, seat->keyboard);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (seat->master_keyboard));
|
||||
|
||||
g_object_unref (seat->keyboard_focus);
|
||||
seat->keyboard_focus = NULL;
|
||||
@ -2028,7 +2019,6 @@ deliver_key_event (GdkWaylandSeat *seat,
|
||||
event->any.window = seat->keyboard_focus ? g_object_ref (seat->keyboard_focus) : NULL;
|
||||
gdk_event_set_device (event, seat->master_keyboard);
|
||||
gdk_event_set_source_device (event, seat->keyboard);
|
||||
gdk_event_set_seat (event, GDK_SEAT (seat));
|
||||
event->key.time = time_;
|
||||
event->key.state = device_get_modifiers (seat->master_pointer);
|
||||
event->key.group = 0;
|
||||
@ -2235,7 +2225,6 @@ _create_touch_event (GdkWaylandSeat *seat,
|
||||
event->any.window = g_object_ref (touch->window);
|
||||
gdk_event_set_device (event, seat->touch_master);
|
||||
gdk_event_set_source_device (event, seat->touch);
|
||||
gdk_event_set_seat (event, GDK_SEAT (seat));
|
||||
event->touch.time = time;
|
||||
event->touch.state = device_get_modifiers (seat->touch_master);
|
||||
gdk_event_set_display (event, seat->display);
|
||||
@ -2445,7 +2434,6 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
|
||||
event->any.window = g_object_ref (seat->pointer_info.focus);
|
||||
gdk_event_set_device (event, seat->master_pointer);
|
||||
gdk_event_set_source_device (event, seat->pointer);
|
||||
gdk_event_set_seat (event, GDK_SEAT (seat));
|
||||
event->touchpad_swipe.time = _time;
|
||||
event->touchpad_swipe.state = device_get_modifiers (seat->master_pointer);
|
||||
gdk_event_set_display (event, seat->display);
|
||||
@ -2547,7 +2535,6 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
|
||||
event->any.window = g_object_ref (seat->pointer_info.focus);
|
||||
gdk_event_set_device (event, seat->master_pointer);
|
||||
gdk_event_set_source_device (event, seat->pointer);
|
||||
gdk_event_set_seat (event, GDK_SEAT (seat));
|
||||
event->touchpad_pinch.time = _time;
|
||||
event->touchpad_pinch.state = device_get_modifiers (seat->master_pointer);
|
||||
gdk_event_set_display (event, seat->display);
|
||||
|
@ -1439,7 +1439,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
|
||||
event->key.keyval = GDK_KEY_VoidSymbol;
|
||||
|
||||
@ -1522,7 +1521,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
|
||||
event->scroll.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
}
|
||||
@ -1544,7 +1542,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
gdk_event_set_device_tool (event, source_device->last_tool);
|
||||
|
||||
event->button.axes = translate_axes (device,
|
||||
@ -1626,7 +1623,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
|
||||
event->scroll.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
break;
|
||||
@ -1642,7 +1638,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
gdk_event_set_device_tool (event, source_device->last_tool);
|
||||
|
||||
event->motion.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
@ -1697,7 +1692,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
|
||||
event->touch.axes = translate_axes (device,
|
||||
event->touch.x,
|
||||
@ -1761,7 +1755,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
|
||||
event->touch.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
|
||||
@ -1822,7 +1815,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
gdk_event_set_seat (event, gdk_device_get_seat (device));
|
||||
|
||||
if (ev->evtype == XI_Enter &&
|
||||
xev->detail != XINotifyInferior && xev->mode != XINotifyPassiveUngrab &&
|
||||
|
Loading…
Reference in New Issue
Block a user