mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
Merge branch 'wip/carlosg/device-api-cleanup' into 'master'
Cleanups to device/event API See merge request GNOME/gtk!2313
This commit is contained in:
commit
b5f256937f
@ -355,14 +355,11 @@ gdk_device_get_name
|
||||
gdk_device_get_vendor_id
|
||||
gdk_device_get_product_id
|
||||
gdk_device_get_source
|
||||
gdk_device_get_axis_use
|
||||
gdk_device_get_associated_device
|
||||
gdk_device_list_physical_devices
|
||||
gdk_device_get_device_type
|
||||
gdk_device_get_display
|
||||
gdk_device_get_has_cursor
|
||||
gdk_device_get_n_axes
|
||||
gdk_device_get_axes
|
||||
gdk_device_get_seat
|
||||
gdk_device_get_num_touches
|
||||
gdk_device_get_device_tool
|
||||
@ -374,15 +371,14 @@ gdk_device_get_scroll_lock_state
|
||||
gdk_device_has_bidi_layouts
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_device_get_state
|
||||
gdk_device_get_surface_at_position
|
||||
GdkTimeCoord
|
||||
gdk_device_get_axis
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_device_tool_get_serial
|
||||
gdk_device_tool_get_tool_type
|
||||
gdk_device_tool_get_hardware_id
|
||||
gdk_device_tool_get_axes
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_AXIS_USE
|
||||
@ -439,6 +435,7 @@ gdk_seat_get_capabilities
|
||||
gdk_seat_get_pointer
|
||||
gdk_seat_get_keyboard
|
||||
gdk_seat_get_physical_devices
|
||||
gdk_seat_get_tools
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_SEAT
|
||||
@ -478,7 +475,6 @@ gdk_event_unref
|
||||
gdk_event_get_event_type
|
||||
gdk_event_get_surface
|
||||
gdk_event_get_device
|
||||
gdk_event_get_source_device
|
||||
gdk_event_get_device_tool
|
||||
gdk_event_get_time
|
||||
gdk_event_get_display
|
||||
|
@ -309,10 +309,9 @@ use the #GtkWindow:modal property of the dialog.
|
||||
### Adapt to coordinate API changes
|
||||
|
||||
A number of coordinate APIs in GTK 3 had _double variants:
|
||||
gdk_device_get_position(), gdk_device_get_surface_at_position(),
|
||||
gdk_surface_get_device_position(). These have been changed to use
|
||||
doubles, and the _double variants have been removed. Update your
|
||||
code accordingly.
|
||||
gdk_device_get_surface_at_position(), gdk_surface_get_device_position().
|
||||
These have been changed to use doubles, and the _double variants
|
||||
have been removed. Update your code accordingly.
|
||||
|
||||
Any APIs that deal with global (or root) coordinates have been
|
||||
removed in GTK 4, since not all backends support them. You should
|
||||
|
@ -23,10 +23,6 @@
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
|
||||
static void gdk_broadway_device_get_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
double *axes,
|
||||
GdkModifierType *mask);
|
||||
static void gdk_broadway_device_set_surface_cursor (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
GdkCursor *cursor);
|
||||
@ -58,7 +54,6 @@ gdk_broadway_device_class_init (GdkBroadwayDeviceClass *klass)
|
||||
{
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
device_class->get_state = gdk_broadway_device_get_state;
|
||||
device_class->set_surface_cursor = gdk_broadway_device_set_surface_cursor;
|
||||
device_class->query_state = gdk_broadway_device_query_state;
|
||||
device_class->grab = gdk_broadway_device_grab;
|
||||
@ -77,23 +72,6 @@ gdk_broadway_device_init (GdkBroadwayDevice *device_core)
|
||||
_gdk_device_add_axis (device, GDK_AXIS_Y, 0, 0, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_device_get_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
double *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
double x, y;
|
||||
|
||||
gdk_surface_get_device_position (surface, device, &x, &y, mask);
|
||||
|
||||
if (axes)
|
||||
{
|
||||
axes[0] = x;
|
||||
axes[1] = y;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_device_set_surface_cursor (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
|
@ -100,7 +100,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
|
||||
surface,
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
message->base.time,
|
||||
message->pointer.state,
|
||||
message->pointer.win_x,
|
||||
@ -119,7 +118,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
|
||||
surface,
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
message->base.time,
|
||||
message->pointer.state,
|
||||
message->pointer.win_x,
|
||||
@ -140,7 +138,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
{
|
||||
event = gdk_motion_event_new (surface,
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
NULL,
|
||||
message->base.time,
|
||||
message->pointer.state,
|
||||
@ -167,7 +164,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
: GDK_BUTTON_RELEASE,
|
||||
surface,
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
NULL,
|
||||
message->base.time,
|
||||
message->pointer.state,
|
||||
@ -187,7 +183,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
{
|
||||
event = gdk_scroll_event_new_discrete (surface,
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
NULL,
|
||||
message->base.time,
|
||||
0,
|
||||
@ -234,7 +229,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
GUINT_TO_POINTER (message->touch.sequence_id),
|
||||
surface,
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->touchscreen,
|
||||
message->base.time,
|
||||
state,
|
||||
message->touch.win_x,
|
||||
@ -263,7 +257,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
: GDK_KEY_RELEASE,
|
||||
surface,
|
||||
display_broadway->core_keyboard,
|
||||
display_broadway->keyboard,
|
||||
message->base.time,
|
||||
message->key.key,
|
||||
message->key.state,
|
||||
@ -280,7 +273,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
case BROADWAY_EVENT_UNGRAB_NOTIFY:
|
||||
_gdk_display_device_grab_update (display,
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
message->base.serial);
|
||||
break;
|
||||
|
||||
@ -321,7 +313,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
{
|
||||
event = gdk_focus_event_new (surface,
|
||||
display_broadway->core_keyboard,
|
||||
display_broadway->keyboard,
|
||||
FALSE);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
@ -332,7 +323,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
{
|
||||
event = gdk_focus_event_new (surface,
|
||||
display_broadway->core_keyboard,
|
||||
display_broadway->keyboard,
|
||||
TRUE);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
|
@ -95,7 +95,6 @@ enum {
|
||||
PROP_PRODUCT_ID,
|
||||
PROP_SEAT,
|
||||
PROP_NUM_TOUCHES,
|
||||
PROP_AXES,
|
||||
PROP_TOOL,
|
||||
PROP_DIRECTION,
|
||||
PROP_HAS_BIDI_LAYOUTS,
|
||||
@ -265,17 +264,6 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
0,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
/**
|
||||
* GdkDevice:axes:
|
||||
*
|
||||
* The axes currently available for this device.
|
||||
*/
|
||||
device_props[PROP_AXES] =
|
||||
g_param_spec_flags ("axes",
|
||||
P_("Axes"),
|
||||
P_("Axes"),
|
||||
GDK_TYPE_AXIS_FLAGS, 0,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
device_props[PROP_TOOL] =
|
||||
g_param_spec_object ("tool",
|
||||
@ -502,9 +490,6 @@ gdk_device_get_property (GObject *object,
|
||||
case PROP_NUM_TOUCHES:
|
||||
g_value_set_uint (value, device->num_touches);
|
||||
break;
|
||||
case PROP_AXES:
|
||||
g_value_set_flags (value, device->axis_flags);
|
||||
break;
|
||||
case PROP_TOOL:
|
||||
g_value_set_object (value, device->last_tool);
|
||||
break;
|
||||
@ -532,37 +517,6 @@ gdk_device_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_state: (skip)
|
||||
* @device: a #GdkDevice.
|
||||
* @surface: a #GdkSurface.
|
||||
* @axes: (nullable) (array): an array of doubles to store the values of
|
||||
* the axes of @device in, or %NULL.
|
||||
* @mask: (optional) (out): location to store the modifiers, or %NULL.
|
||||
*
|
||||
* Gets the current state of a pointer device relative to @surface. As a
|
||||
* physical device’s coordinates are those of its logical pointer, this
|
||||
* function may not be called on devices of type %GDK_DEVICE_TYPE_PHYSICAL,
|
||||
* unless there is an ongoing grab on them.
|
||||
*
|
||||
* See also: gdk_seat_grab().
|
||||
*/
|
||||
void
|
||||
gdk_device_get_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
double *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_PHYSICAL ||
|
||||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
|
||||
|
||||
if (GDK_DEVICE_GET_CLASS (device)->get_state)
|
||||
GDK_DEVICE_GET_CLASS (device)->get_state (device, surface, axes, mask);
|
||||
}
|
||||
|
||||
/*
|
||||
* gdk_device_get_position:
|
||||
* @device: pointer device to query status about.
|
||||
@ -985,10 +939,7 @@ _gdk_device_reset_axes (GdkDevice *device)
|
||||
for (i = device->axes->len - 1; i >= 0; i--)
|
||||
g_array_remove_index (device->axes, i);
|
||||
|
||||
device->axis_flags = 0;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_N_AXES]);
|
||||
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_AXES]);
|
||||
}
|
||||
|
||||
guint
|
||||
@ -1027,10 +978,7 @@ _gdk_device_add_axis (GdkDevice *device,
|
||||
device->axes = g_array_append_val (device->axes, axis_info);
|
||||
pos = device->axes->len - 1;
|
||||
|
||||
device->axis_flags |= (1 << use);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_N_AXES]);
|
||||
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_AXES]);
|
||||
|
||||
return pos;
|
||||
}
|
||||
@ -1374,20 +1322,6 @@ gdk_device_get_seat (GdkDevice *device)
|
||||
return device->seat;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_get_axes:
|
||||
* @device: a #GdkDevice
|
||||
*
|
||||
* Returns the axes currently available on the device.
|
||||
**/
|
||||
GdkAxisFlags
|
||||
gdk_device_get_axes (GdkDevice *device)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
|
||||
|
||||
return device->axis_flags;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_device_update_tool (GdkDevice *device,
|
||||
GdkDeviceTool *tool)
|
||||
|
@ -40,7 +40,6 @@ typedef struct _GdkTimeCoord GdkTimeCoord;
|
||||
* @GDK_SOURCE_MOUSE: the device is a mouse. (This will be reported for the core
|
||||
* pointer, even if it is something else, such as a trackball.)
|
||||
* @GDK_SOURCE_PEN: the device is a stylus of a graphics tablet or similar device.
|
||||
* @GDK_SOURCE_CURSOR: the device is a graphics tablet “puck” or similar device.
|
||||
* @GDK_SOURCE_KEYBOARD: the device is a keyboard.
|
||||
* @GDK_SOURCE_TOUCHSCREEN: the device is a direct-input touch device, such
|
||||
* as a touchscreen or tablet
|
||||
@ -56,7 +55,6 @@ typedef enum
|
||||
{
|
||||
GDK_SOURCE_MOUSE,
|
||||
GDK_SOURCE_PEN,
|
||||
GDK_SOURCE_CURSOR,
|
||||
GDK_SOURCE_KEYBOARD,
|
||||
GDK_SOURCE_TOUCHSCREEN,
|
||||
GDK_SOURCE_TOUCHPAD,
|
||||
@ -108,29 +106,12 @@ gboolean gdk_device_get_has_cursor (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkInputSource gdk_device_get_source (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
|
||||
guint index_);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_device_get_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
double *axes,
|
||||
GdkModifierType *mask);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSurface * gdk_device_get_surface_at_position (GdkDevice *device,
|
||||
double *win_x,
|
||||
double *win_y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_device_get_n_axes (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_device_get_axis (GdkDevice *device,
|
||||
double *axes,
|
||||
GdkAxisUse use,
|
||||
double *value);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay * gdk_device_get_display (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@ -149,9 +130,6 @@ const char *gdk_device_get_product_id (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkSeat *gdk_device_get_seat (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkAxisFlags gdk_device_get_axes (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint gdk_device_get_num_touches (GdkDevice *device);
|
||||
|
||||
|
@ -39,7 +39,6 @@ struct _GdkDevice
|
||||
char *name;
|
||||
GdkInputSource source;
|
||||
gboolean has_cursor;
|
||||
GdkAxisFlags axis_flags;
|
||||
GdkDeviceType type;
|
||||
GdkDisplay *display;
|
||||
/* The paired logical device for logical devices,
|
||||
|
@ -209,3 +209,11 @@ gdk_device_tool_get_tool_type (GdkDeviceTool *tool)
|
||||
|
||||
return tool->type;
|
||||
}
|
||||
|
||||
GdkAxisFlags
|
||||
gdk_device_tool_get_axes (GdkDeviceTool *tool)
|
||||
{
|
||||
g_return_val_if_fail (tool != NULL, 0);
|
||||
|
||||
return tool->tool_axes;
|
||||
}
|
||||
|
@ -71,6 +71,9 @@ guint64 gdk_device_tool_get_hardware_id (GdkDeviceTool *tool);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDeviceToolType gdk_device_tool_get_tool_type (GdkDeviceTool *tool);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkAxisFlags gdk_device_tool_get_axes (GdkDeviceTool *tool);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_TOOL_H__ */
|
||||
|
@ -491,7 +491,6 @@ generate_grab_broken_event (GdkDisplay *display,
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_grab_broken_event_new (surface,
|
||||
device,
|
||||
device,
|
||||
grab_surface,
|
||||
implicit);
|
||||
@ -603,7 +602,6 @@ get_current_toplevel (GdkDisplay *display,
|
||||
static void
|
||||
switch_to_pointer_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceGrabInfo *grab,
|
||||
GdkDeviceGrabInfo *last_grab,
|
||||
guint32 time,
|
||||
@ -680,7 +678,6 @@ _gdk_display_update_last_event (GdkDisplay *display,
|
||||
void
|
||||
_gdk_display_device_grab_update (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
gulong current_serial)
|
||||
{
|
||||
GdkDeviceGrabInfo *current_grab, *next_grab;
|
||||
@ -705,7 +702,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
|
||||
if (!current_grab->activated)
|
||||
{
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
||||
switch_to_pointer_grab (display, device, source_device, current_grab, NULL, time, current_serial);
|
||||
switch_to_pointer_grab (display, device, current_grab, NULL, time, current_serial);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -733,7 +730,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
|
||||
g_hash_table_insert (display->device_grabs, device, grabs);
|
||||
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
||||
switch_to_pointer_grab (display, device, source_device,
|
||||
switch_to_pointer_grab (display, device,
|
||||
next_grab, current_grab,
|
||||
time, current_serial);
|
||||
|
||||
|
@ -179,7 +179,6 @@ void _gdk_display_update_last_event (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
void _gdk_display_device_grab_update (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
gulong current_serial);
|
||||
GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
|
||||
GdkDevice *device);
|
||||
|
133
gdk/gdkevents.c
133
gdk/gdkevents.c
@ -153,7 +153,6 @@ gdk_event_finalize (GdkEvent *self)
|
||||
|
||||
g_clear_object (&self->surface);
|
||||
g_clear_object (&self->device);
|
||||
g_clear_object (&self->source_device);
|
||||
|
||||
g_type_free_instance ((GTypeInstance *) self);
|
||||
}
|
||||
@ -398,7 +397,6 @@ type_name ## _get_type (void) \
|
||||
* @event_type: the #GdkEventType to allocate
|
||||
* @surface: (nullable): the #GdkSurface of the event
|
||||
* @device: (nullable): the #GdkDevice of the event
|
||||
* @source_device: (nullable): the source #GdkDevice of the event
|
||||
* @time_: the event serial
|
||||
*
|
||||
* Allocates a #GdkEvent for the given @event_type, and sets its
|
||||
@ -410,7 +408,6 @@ static gpointer
|
||||
gdk_event_alloc (GdkEventType event_type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time_)
|
||||
{
|
||||
g_assert (event_type >= GDK_DELETE && event_type < GDK_EVENT_LAST);
|
||||
@ -428,7 +425,6 @@ gdk_event_alloc (GdkEventType event_type,
|
||||
event->event_type = event_type;
|
||||
event->surface = surface != NULL ? g_object_ref (surface) : NULL;
|
||||
event->device = device != NULL ? g_object_ref (device) : NULL;
|
||||
event->source_device = source_device != NULL ? g_object_ref (source_device) : NULL;
|
||||
event->time = time_;
|
||||
|
||||
return event;
|
||||
@ -487,15 +483,6 @@ check_event_sanity (GdkEvent *event)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (event->source_device != NULL &&
|
||||
gdk_surface_get_display (event->surface) != gdk_device_get_display (event->source_device))
|
||||
{
|
||||
char *type = g_enum_to_string (GDK_TYPE_EVENT_TYPE, event->event_type);
|
||||
g_warning ("Event of type %s with mismatched source device display", type);
|
||||
g_free (type);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
@ -704,7 +691,6 @@ gdk_event_queue_handle_scroll_compression (GdkDisplay *display)
|
||||
gdk_scroll_event_get_deltas (old_event, &dx, &dy);
|
||||
event = gdk_scroll_event_new (surface,
|
||||
device,
|
||||
gdk_event_get_source_device (old_event),
|
||||
gdk_event_get_device_tool (old_event),
|
||||
gdk_event_get_time (old_event),
|
||||
gdk_event_get_modifier_state (old_event),
|
||||
@ -732,25 +718,24 @@ gdk_motion_event_push_history (GdkEvent *event,
|
||||
GdkEvent *history_event)
|
||||
{
|
||||
GdkMotionEvent *self = (GdkMotionEvent *) event;
|
||||
GdkDeviceTool *tool;
|
||||
GdkTimeCoord hist;
|
||||
GdkDevice *device;
|
||||
int i, n_axes;
|
||||
int i;
|
||||
|
||||
g_assert (GDK_IS_EVENT_TYPE (event, GDK_MOTION_NOTIFY));
|
||||
g_assert (GDK_IS_EVENT_TYPE (history_event, GDK_MOTION_NOTIFY));
|
||||
|
||||
device = gdk_event_get_device (history_event);
|
||||
n_axes = gdk_device_get_n_axes (device);
|
||||
if (!self->tool)
|
||||
return;
|
||||
|
||||
tool = gdk_event_get_device_tool (history_event);
|
||||
|
||||
memset (&hist, 0, sizeof (GdkTimeCoord));
|
||||
hist.time = gdk_event_get_time (history_event);
|
||||
hist.flags = gdk_device_get_axes (device);
|
||||
hist.flags = gdk_device_tool_get_axes (tool);
|
||||
|
||||
for (i = 0; i < n_axes; i++)
|
||||
{
|
||||
GdkAxisUse use = gdk_device_get_axis_use (device, i);
|
||||
gdk_event_get_axis (history_event, use, &hist.axes[use]);
|
||||
}
|
||||
for (i = GDK_AXIS_X; i < GDK_AXIS_LAST; i++)
|
||||
gdk_event_get_axis (history_event, i, &hist.axes[i]);
|
||||
|
||||
if (G_UNLIKELY (!self->history))
|
||||
self->history = g_array_new (FALSE, TRUE, sizeof (GdkTimeCoord));
|
||||
@ -952,10 +937,8 @@ gdk_event_get_axis (GdkEvent *event,
|
||||
if (!gdk_event_get_axes (event, &axes, &n_axes))
|
||||
return FALSE;
|
||||
|
||||
if (axis_use >= gdk_device_get_n_axes (event->device))
|
||||
return FALSE;
|
||||
|
||||
return gdk_device_get_axis (event->device, axes, axis_use, value);
|
||||
*value = axes[axis_use];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1217,33 +1200,6 @@ gdk_event_get_device (GdkEvent *event)
|
||||
return event->device;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_get_source_device:
|
||||
* @event: a #GdkEvent
|
||||
*
|
||||
* This function returns the physical #GdkDevice that has triggered
|
||||
* the event, falling back to the logical device, as returned by
|
||||
* gdk_event_get_device(), if the event wasn’t caused by
|
||||
* interaction with a hardware device. This may happen for example
|
||||
* in synthesized crossing events after a #GdkSurface updates its
|
||||
* geometry or a grab is acquired/released.
|
||||
*
|
||||
* If the event does not contain a device field, this function will
|
||||
* return %NULL.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): a #GdkDevice, or %NULL.
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_event_get_source_device (GdkEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_EVENT (event), NULL);
|
||||
|
||||
if (event->source_device)
|
||||
return event->source_device;
|
||||
|
||||
return event->device;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_get_device_tool:
|
||||
* @event: a #GdkEvent
|
||||
@ -1402,13 +1358,13 @@ gdk_button_event_get_axes (GdkEvent *event,
|
||||
guint *n_axes)
|
||||
{
|
||||
GdkButtonEvent *self = (GdkButtonEvent *) event;
|
||||
GdkDevice *source_device = gdk_event_get_source_device (event);
|
||||
GdkDevice *source_device = gdk_event_get_device (event);
|
||||
|
||||
if (source_device == NULL)
|
||||
return FALSE;
|
||||
|
||||
*axes = self->axes;
|
||||
*n_axes = gdk_device_get_n_axes (source_device);
|
||||
*n_axes = GDK_AXIS_LAST;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -1433,7 +1389,6 @@ GdkEvent *
|
||||
gdk_button_event_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@ -1445,7 +1400,7 @@ gdk_button_event_new (GdkEventType type,
|
||||
g_return_val_if_fail (type == GDK_BUTTON_PRESS ||
|
||||
type == GDK_BUTTON_RELEASE, NULL);
|
||||
|
||||
GdkButtonEvent *self = gdk_event_alloc (type, surface, device, source_device, time);
|
||||
GdkButtonEvent *self = gdk_event_alloc (type, surface, device, time);
|
||||
|
||||
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
|
||||
self->axes = axes;
|
||||
@ -1510,7 +1465,6 @@ GDK_DEFINE_EVENT_TYPE (GdkKeyEvent, gdk_key_event,
|
||||
* @type: the event type, either %GDK_KEY_PRESS or %GDK_KEY_RELEASE
|
||||
* @surface: the #GdkSurface of the event
|
||||
* @device: the #GdkDevice related to the event
|
||||
* @source_device: the source #GdkDevice related to the event
|
||||
* @time: the event's timestamp
|
||||
* @keycode: the keycode of the event
|
||||
* @state: the modifiers state
|
||||
@ -1526,7 +1480,6 @@ GdkEvent *
|
||||
gdk_key_event_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint keycode,
|
||||
GdkModifierType state,
|
||||
@ -1537,7 +1490,7 @@ gdk_key_event_new (GdkEventType type,
|
||||
g_return_val_if_fail (type == GDK_KEY_PRESS ||
|
||||
type == GDK_KEY_RELEASE, NULL);
|
||||
|
||||
GdkKeyEvent *self = gdk_event_alloc (type, surface, device, source_device, time);
|
||||
GdkKeyEvent *self = gdk_event_alloc (type, surface, device, time);
|
||||
GdkEvent *event = (GdkEvent *) self;
|
||||
|
||||
self->keycode = keycode;
|
||||
@ -1901,7 +1854,7 @@ gdk_configure_event_new (GdkSurface *surface,
|
||||
|
||||
g_return_val_if_fail (width >= 0 && height >= 0, NULL);
|
||||
|
||||
self = gdk_event_alloc (GDK_CONFIGURE, surface, NULL, NULL, GDK_CURRENT_TIME);
|
||||
self = gdk_event_alloc (GDK_CONFIGURE, surface, NULL, GDK_CURRENT_TIME);
|
||||
self->width = width;
|
||||
self->height = height;
|
||||
|
||||
@ -1979,13 +1932,13 @@ gdk_touch_event_get_axes (GdkEvent *event,
|
||||
guint *n_axes)
|
||||
{
|
||||
GdkTouchEvent *self = (GdkTouchEvent *) event;
|
||||
GdkDevice *source_device = gdk_event_get_source_device (event);
|
||||
GdkDevice *source_device = gdk_event_get_device (event);
|
||||
|
||||
if (source_device == NULL)
|
||||
return FALSE;
|
||||
|
||||
*axes = self->axes;
|
||||
*n_axes = gdk_device_get_n_axes (source_device);
|
||||
*n_axes = GDK_AXIS_LAST;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -2013,7 +1966,6 @@ gdk_touch_event_new (GdkEventType type,
|
||||
GdkEventSequence *sequence,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
double x,
|
||||
@ -2028,7 +1980,7 @@ gdk_touch_event_new (GdkEventType type,
|
||||
type == GDK_TOUCH_UPDATE ||
|
||||
type == GDK_TOUCH_CANCEL, NULL);
|
||||
|
||||
self = gdk_event_alloc (type, surface, device, source_device, time);
|
||||
self = gdk_event_alloc (type, surface, device, time);
|
||||
self->sequence = sequence;
|
||||
self->state = state;
|
||||
self->x = x;
|
||||
@ -2117,7 +2069,6 @@ GdkEvent *
|
||||
gdk_crossing_event_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
double x,
|
||||
@ -2130,7 +2081,7 @@ gdk_crossing_event_new (GdkEventType type,
|
||||
g_return_val_if_fail (type == GDK_ENTER_NOTIFY ||
|
||||
type == GDK_LEAVE_NOTIFY, NULL);
|
||||
|
||||
self = gdk_event_alloc (type, surface, device, source_device, time);
|
||||
self = gdk_event_alloc (type, surface, device, time);
|
||||
|
||||
self->state = state;
|
||||
self->x = x;
|
||||
@ -2223,7 +2174,7 @@ GDK_DEFINE_EVENT_TYPE (GdkDeleteEvent, gdk_delete_event,
|
||||
GdkEvent *
|
||||
gdk_delete_event_new (GdkSurface *surface)
|
||||
{
|
||||
return gdk_event_alloc (GDK_DELETE, surface, NULL, NULL, GDK_CURRENT_TIME);
|
||||
return gdk_event_alloc (GDK_DELETE, surface, NULL, GDK_CURRENT_TIME);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
@ -2248,10 +2199,9 @@ GDK_DEFINE_EVENT_TYPE (GdkFocusEvent, gdk_focus_event,
|
||||
GdkEvent *
|
||||
gdk_focus_event_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
gboolean focus_in)
|
||||
{
|
||||
GdkFocusEvent *self = gdk_event_alloc (GDK_FOCUS_CHANGE, surface, device, source_device, GDK_CURRENT_TIME);
|
||||
GdkFocusEvent *self = gdk_event_alloc (GDK_FOCUS_CHANGE, surface, device, GDK_CURRENT_TIME);
|
||||
|
||||
self->focus_in = focus_in;
|
||||
|
||||
@ -2328,7 +2278,6 @@ GDK_DEFINE_EVENT_TYPE (GdkScrollEvent, gdk_scroll_event,
|
||||
GdkEvent *
|
||||
gdk_scroll_event_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@ -2336,7 +2285,7 @@ gdk_scroll_event_new (GdkSurface *surface,
|
||||
double delta_y,
|
||||
gboolean is_stop)
|
||||
{
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, source_device, time);
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
|
||||
|
||||
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
|
||||
self->state = state;
|
||||
@ -2351,14 +2300,13 @@ gdk_scroll_event_new (GdkSurface *surface,
|
||||
GdkEvent *
|
||||
gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkScrollDirection direction,
|
||||
gboolean emulated)
|
||||
{
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, source_device, time);
|
||||
GdkScrollEvent *self = gdk_event_alloc (GDK_SCROLL, surface, device, time);
|
||||
|
||||
self->tool = tool != NULL ? g_object_ref (tool) : NULL;
|
||||
self->state = state;
|
||||
@ -2481,7 +2429,6 @@ GDK_DEFINE_EVENT_TYPE (GdkTouchpadEvent, gdk_touchpad_event,
|
||||
GdkEvent *
|
||||
gdk_touchpad_event_new_swipe (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkTouchpadGesturePhase phase,
|
||||
@ -2491,7 +2438,7 @@ gdk_touchpad_event_new_swipe (GdkSurface *surface,
|
||||
double dx,
|
||||
double dy)
|
||||
{
|
||||
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_SWIPE, surface, device, source_device, time);
|
||||
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_SWIPE, surface, device, time);
|
||||
|
||||
self->state = state;
|
||||
self->phase = phase;
|
||||
@ -2507,7 +2454,6 @@ gdk_touchpad_event_new_swipe (GdkSurface *surface,
|
||||
GdkEvent *
|
||||
gdk_touchpad_event_new_pinch (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkTouchpadGesturePhase phase,
|
||||
@ -2519,7 +2465,7 @@ gdk_touchpad_event_new_pinch (GdkSurface *surface,
|
||||
double scale,
|
||||
double angle_delta)
|
||||
{
|
||||
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_PINCH, surface, device, source_device, time);
|
||||
GdkTouchpadEvent *self = gdk_event_alloc (GDK_TOUCHPAD_PINCH, surface, device, time);
|
||||
|
||||
self->state = state;
|
||||
self->phase = phase;
|
||||
@ -2661,14 +2607,13 @@ GDK_DEFINE_EVENT_TYPE (GdkPadEvent, gdk_pad_event,
|
||||
GdkEvent *
|
||||
gdk_pad_event_new_ring (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint group,
|
||||
guint index,
|
||||
guint mode,
|
||||
double value)
|
||||
{
|
||||
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_RING, surface, device, source_device, time);
|
||||
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_RING, surface, device, time);
|
||||
|
||||
self->group = group;
|
||||
self->index = index;
|
||||
@ -2681,14 +2626,13 @@ gdk_pad_event_new_ring (GdkSurface *surface,
|
||||
GdkEvent *
|
||||
gdk_pad_event_new_strip (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint group,
|
||||
guint index,
|
||||
guint mode,
|
||||
double value)
|
||||
{
|
||||
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_STRIP, surface, device, source_device, time);
|
||||
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_STRIP, surface, device, time);
|
||||
|
||||
self->group = group;
|
||||
self->index = index;
|
||||
@ -2702,7 +2646,6 @@ GdkEvent *
|
||||
gdk_pad_event_new_button (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint group,
|
||||
guint button,
|
||||
@ -2713,7 +2656,7 @@ gdk_pad_event_new_button (GdkEventType type,
|
||||
g_return_val_if_fail (type == GDK_PAD_BUTTON_PRESS ||
|
||||
type == GDK_PAD_BUTTON_RELEASE, NULL);
|
||||
|
||||
self = gdk_event_alloc (type, surface, device, source_device, time);
|
||||
self = gdk_event_alloc (type, surface, device, time);
|
||||
|
||||
self->group = group;
|
||||
self->button = button;
|
||||
@ -2725,12 +2668,11 @@ gdk_pad_event_new_button (GdkEventType type,
|
||||
GdkEvent *
|
||||
gdk_pad_event_new_group_mode (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint group,
|
||||
guint mode)
|
||||
{
|
||||
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_GROUP_MODE, surface, device, source_device, time);
|
||||
GdkPadEvent *self = gdk_event_alloc (GDK_PAD_GROUP_MODE, surface, device, time);
|
||||
|
||||
self->group = group;
|
||||
self->mode = mode;
|
||||
@ -2859,13 +2801,13 @@ gdk_motion_event_get_axes (GdkEvent *event,
|
||||
guint *n_axes)
|
||||
{
|
||||
GdkMotionEvent *self = (GdkMotionEvent *) event;
|
||||
GdkDevice *source_device = gdk_event_get_source_device (event);
|
||||
GdkDevice *source_device = gdk_event_get_device (event);
|
||||
|
||||
if (source_device == NULL)
|
||||
return FALSE;
|
||||
|
||||
*axes = self->axes;
|
||||
*n_axes = gdk_device_get_n_axes (source_device);
|
||||
*n_axes = GDK_AXIS_LAST;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -2888,7 +2830,6 @@ GDK_DEFINE_EVENT_TYPE (GdkMotionEvent, gdk_motion_event,
|
||||
GdkEvent *
|
||||
gdk_motion_event_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@ -2896,7 +2837,7 @@ gdk_motion_event_new (GdkSurface *surface,
|
||||
double y,
|
||||
double *axes)
|
||||
{
|
||||
GdkMotionEvent *self = gdk_event_alloc (GDK_MOTION_NOTIFY, surface, device, source_device, time);
|
||||
GdkMotionEvent *self = gdk_event_alloc (GDK_MOTION_NOTIFY, surface, device, time);
|
||||
|
||||
self->tool = tool ? g_object_ref (tool) : NULL;
|
||||
self->state = state;
|
||||
@ -3004,7 +2945,6 @@ GdkEvent *
|
||||
gdk_proximity_event_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time)
|
||||
{
|
||||
@ -3013,7 +2953,7 @@ gdk_proximity_event_new (GdkEventType type,
|
||||
g_return_val_if_fail (type == GDK_PROXIMITY_IN ||
|
||||
type == GDK_PROXIMITY_OUT, NULL);
|
||||
|
||||
self = gdk_event_alloc (type, surface, device, source_device, time);
|
||||
self = gdk_event_alloc (type, surface, device, time);
|
||||
|
||||
self->tool = tool ? g_object_ref (tool) : NULL;
|
||||
|
||||
@ -3089,7 +3029,7 @@ gdk_dnd_event_new (GdkEventType type,
|
||||
type == GDK_DRAG_LEAVE ||
|
||||
type == GDK_DROP_START, NULL);
|
||||
|
||||
self = gdk_event_alloc (type, surface, device, NULL, time);
|
||||
self = gdk_event_alloc (type, surface, device, time);
|
||||
|
||||
self->drop = drop != NULL ? g_object_ref (drop) : NULL;
|
||||
self->x = x;
|
||||
@ -3142,11 +3082,10 @@ GDK_DEFINE_EVENT_TYPE (GdkGrabBrokenEvent, gdk_grab_broken_event,
|
||||
GdkEvent *
|
||||
gdk_grab_broken_event_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkSurface *grab_surface,
|
||||
gboolean implicit)
|
||||
{
|
||||
GdkGrabBrokenEvent *self = gdk_event_alloc (GDK_GRAB_BROKEN, surface, device, source_device, GDK_CURRENT_TIME);
|
||||
GdkGrabBrokenEvent *self = gdk_event_alloc (GDK_GRAB_BROKEN, surface, device, GDK_CURRENT_TIME);
|
||||
|
||||
self->grab_surface = grab_surface;
|
||||
self->implicit = implicit;
|
||||
|
@ -350,9 +350,6 @@ GdkSeat * gdk_event_get_seat (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_event_get_device (GdkEvent *event);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_event_get_source_device (GdkEvent *event);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDeviceTool * gdk_event_get_device_tool (GdkEvent *event);
|
||||
|
||||
|
@ -42,7 +42,6 @@ typedef struct _GdkEventClass GdkEventClass;
|
||||
* @event_type: the specialized event type
|
||||
* @surface: the surface of the event
|
||||
* @device: the device of the event
|
||||
* @source_device: the source device
|
||||
* @time: a serial identifier of the event that can be used to order
|
||||
* two events
|
||||
* @flags: event flags
|
||||
@ -63,7 +62,6 @@ struct _GdkEvent
|
||||
|
||||
/* The devices associated to the event */
|
||||
GdkDevice *device;
|
||||
GdkDevice *source_device;
|
||||
|
||||
guint32 time;
|
||||
guint16 flags;
|
||||
@ -450,7 +448,6 @@ void gdk_event_init_types (void);
|
||||
GdkEvent * gdk_button_event_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@ -461,7 +458,6 @@ GdkEvent * gdk_button_event_new (GdkEventType type,
|
||||
|
||||
GdkEvent * gdk_motion_event_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@ -472,7 +468,6 @@ GdkEvent * gdk_motion_event_new (GdkSurface *surface,
|
||||
GdkEvent * gdk_crossing_event_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
double x,
|
||||
@ -483,14 +478,12 @@ GdkEvent * gdk_crossing_event_new (GdkEventType type,
|
||||
GdkEvent * gdk_proximity_event_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time);
|
||||
|
||||
GdkEvent * gdk_key_event_new (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint keycode,
|
||||
GdkModifierType modifiers,
|
||||
@ -500,7 +493,6 @@ GdkEvent * gdk_key_event_new (GdkEventType type,
|
||||
|
||||
GdkEvent * gdk_focus_event_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
gboolean focus_in);
|
||||
|
||||
GdkEvent * gdk_configure_event_new (GdkSurface *surface,
|
||||
@ -511,7 +503,6 @@ GdkEvent * gdk_delete_event_new (GdkSurface *surface);
|
||||
|
||||
GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@ -521,7 +512,6 @@ GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
|
||||
|
||||
GdkEvent * gdk_scroll_event_new_discrete (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkDeviceTool *tool,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
@ -532,7 +522,6 @@ GdkEvent * gdk_touch_event_new (GdkEventType type,
|
||||
GdkEventSequence *sequence,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
double x,
|
||||
@ -542,7 +531,6 @@ GdkEvent * gdk_touch_event_new (GdkEventType type,
|
||||
|
||||
GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkTouchpadGesturePhase phase,
|
||||
@ -554,7 +542,6 @@ GdkEvent * gdk_touchpad_event_new_swipe (GdkSurface *surface,
|
||||
|
||||
GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
GdkModifierType state,
|
||||
GdkTouchpadGesturePhase phase,
|
||||
@ -568,7 +555,6 @@ GdkEvent * gdk_touchpad_event_new_pinch (GdkSurface *surface,
|
||||
|
||||
GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint group,
|
||||
guint index,
|
||||
@ -577,7 +563,6 @@ GdkEvent * gdk_pad_event_new_ring (GdkSurface *surface,
|
||||
|
||||
GdkEvent * gdk_pad_event_new_strip (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint group,
|
||||
guint index,
|
||||
@ -587,7 +572,6 @@ GdkEvent * gdk_pad_event_new_strip (GdkSurface *surface,
|
||||
GdkEvent * gdk_pad_event_new_button (GdkEventType type,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint group,
|
||||
guint button,
|
||||
@ -595,7 +579,6 @@ GdkEvent * gdk_pad_event_new_button (GdkEventType type,
|
||||
|
||||
GdkEvent * gdk_pad_event_new_group_mode (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
guint32 time,
|
||||
guint group,
|
||||
guint mode);
|
||||
@ -610,7 +593,6 @@ GdkEvent * gdk_dnd_event_new (GdkEventType type,
|
||||
|
||||
GdkEvent * gdk_grab_broken_event_new (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkDevice *source_device,
|
||||
GdkSurface *grab_surface,
|
||||
gboolean implicit);
|
||||
|
||||
|
@ -268,7 +268,13 @@ void gdk_device_ungrab (GdkDevice *device,
|
||||
void gdk_device_get_position (GdkDevice *device,
|
||||
double *x,
|
||||
double *y);
|
||||
|
||||
int gdk_device_get_n_axes (GdkDevice *device);
|
||||
gboolean gdk_device_get_axis (GdkDevice *device,
|
||||
double *axes,
|
||||
GdkAxisUse use,
|
||||
double *value);
|
||||
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
|
||||
guint index_);
|
||||
|
||||
void gdk_surface_get_root_coords (GdkSurface *surface,
|
||||
int x,
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <glib-object.h>
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkdevice.h"
|
||||
#include "gdkdevicetoolprivate.h"
|
||||
#include "gdkseatprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkintl.h"
|
||||
@ -438,11 +439,45 @@ GdkDeviceTool *
|
||||
gdk_seat_get_tool (GdkSeat *seat,
|
||||
guint64 serial,
|
||||
guint64 hw_id)
|
||||
{
|
||||
GdkDeviceTool *match = NULL;
|
||||
GList *tools, *l;
|
||||
|
||||
tools = gdk_seat_get_tools (seat);
|
||||
|
||||
for (l = tools; l; l = l->next)
|
||||
{
|
||||
GdkDeviceTool *tool = l->data;
|
||||
|
||||
if (tool->serial == serial && tool->hw_id == hw_id)
|
||||
{
|
||||
match = tool;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (tools);
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_seat_get_tools:
|
||||
* @seat: A #GdkSeat
|
||||
*
|
||||
* Returns all #GdkDeviceTool<!-- -->s that are known to the
|
||||
* application.
|
||||
*
|
||||
* Returns: (transfer container) (element-type Gdk.DeviceTool): A list of tools. Free with
|
||||
* g_list_free().
|
||||
**/
|
||||
GList *
|
||||
gdk_seat_get_tools (GdkSeat *seat)
|
||||
{
|
||||
GdkSeatClass *seat_class;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SEAT (seat), NULL);
|
||||
|
||||
seat_class = GDK_SEAT_GET_CLASS (seat);
|
||||
return seat_class->get_tool (seat, serial, hw_id);
|
||||
return seat_class->get_tools (seat);
|
||||
}
|
||||
|
@ -78,6 +78,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_seat_get_physical_devices (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
|
||||
GList * gdk_seat_get_tools (GdkSeat *seat);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDevice * gdk_seat_get_pointer (GdkSeat *seat);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -228,7 +228,6 @@ device_get_capability (GdkDevice *device)
|
||||
case GDK_SOURCE_TOUCHSCREEN:
|
||||
return GDK_SEAT_CAPABILITY_TOUCH;
|
||||
case GDK_SOURCE_PEN:
|
||||
case GDK_SOURCE_CURSOR:
|
||||
return GDK_SEAT_CAPABILITY_TABLET_STYLUS;
|
||||
case GDK_SOURCE_TABLET_PAD:
|
||||
return GDK_SEAT_CAPABILITY_TABLET_PAD;
|
||||
@ -280,13 +279,12 @@ gdk_seat_default_get_physical_devices (GdkSeat *seat,
|
||||
return devices;
|
||||
}
|
||||
|
||||
static GdkDeviceTool *
|
||||
gdk_seat_default_get_tool (GdkSeat *seat,
|
||||
guint64 serial,
|
||||
guint64 hw_id)
|
||||
static GList *
|
||||
gdk_seat_default_get_tools (GdkSeat *seat)
|
||||
{
|
||||
GdkSeatDefaultPrivate *priv;
|
||||
GdkDeviceTool *tool;
|
||||
GList *tools = NULL;
|
||||
guint i;
|
||||
|
||||
priv = gdk_seat_default_get_instance_private (GDK_SEAT_DEFAULT (seat));
|
||||
@ -297,12 +295,10 @@ gdk_seat_default_get_tool (GdkSeat *seat,
|
||||
for (i = 0; i < priv->tools->len; i++)
|
||||
{
|
||||
tool = g_ptr_array_index (priv->tools, i);
|
||||
|
||||
if (tool->serial == serial && tool->hw_id == hw_id)
|
||||
return tool;
|
||||
tools = g_list_prepend (tools, tool);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return tools;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -320,8 +316,7 @@ gdk_seat_default_class_init (GdkSeatDefaultClass *klass)
|
||||
|
||||
seat_class->get_logical_device = gdk_seat_default_get_logical_device;
|
||||
seat_class->get_physical_devices = gdk_seat_default_get_physical_devices;
|
||||
|
||||
seat_class->get_tool = gdk_seat_default_get_tool;
|
||||
seat_class->get_tools = gdk_seat_default_get_tools;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -57,9 +57,7 @@ struct _GdkSeatClass
|
||||
GList * (* get_physical_devices) (GdkSeat *seat,
|
||||
GdkSeatCapabilities capabilities);
|
||||
|
||||
GdkDeviceTool * (* get_tool) (GdkSeat *seat,
|
||||
guint64 serial,
|
||||
guint64 tool_id);
|
||||
GList * (* get_tools) (GdkSeat *seat);
|
||||
};
|
||||
|
||||
void gdk_seat_device_added (GdkSeat *seat,
|
||||
|
@ -2222,13 +2222,12 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
gboolean unlink_event = FALSE;
|
||||
GdkDeviceGrabInfo *button_release_grab;
|
||||
GdkPointerSurfaceInfo *pointer_info = NULL;
|
||||
GdkDevice *device, *source_device;
|
||||
GdkDevice *device;
|
||||
GdkEventType type;
|
||||
|
||||
_gdk_display_update_last_event (display, event);
|
||||
|
||||
device = gdk_event_get_device (event);
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
|
||||
if (device)
|
||||
{
|
||||
@ -2236,15 +2235,10 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
gdk_device_get_source (device) != GDK_SOURCE_TABLET_PAD)
|
||||
{
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
|
||||
if (source_device != pointer_info->last_physical_device &&
|
||||
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_PHYSICAL)
|
||||
pointer_info->last_physical_device = source_device;
|
||||
else if (pointer_info->last_physical_device)
|
||||
source_device = pointer_info->last_physical_device;
|
||||
pointer_info->last_physical_device = device;
|
||||
}
|
||||
|
||||
_gdk_display_device_grab_update (display, device, source_device, serial);
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
}
|
||||
|
||||
event_surface = gdk_event_get_surface (event);
|
||||
@ -2272,8 +2266,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
serial,
|
||||
gdk_event_get_time (event),
|
||||
TRUE);
|
||||
_gdk_display_device_grab_update (display, device,
|
||||
source_device, serial);
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
}
|
||||
}
|
||||
else if (type == GDK_BUTTON_RELEASE ||
|
||||
@ -2292,7 +2285,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
{
|
||||
button_release_grab->serial_end = serial;
|
||||
button_release_grab->implicit_ungrab = FALSE;
|
||||
_gdk_display_device_grab_update (display, device, source_device, serial);
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,27 +123,7 @@ gdk_macos_device_ungrab (GdkDevice *device,
|
||||
if (grab != NULL)
|
||||
grab->serial_end = 0;
|
||||
|
||||
_gdk_display_device_grab_update (display, device, device, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_device_get_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
double *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
double x_pos, y_pos;
|
||||
|
||||
g_assert (GDK_IS_MACOS_DEVICE (device));
|
||||
g_assert (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
gdk_surface_get_device_position (surface, device, &x_pos, &y_pos, mask);
|
||||
|
||||
if (axes != NULL)
|
||||
{
|
||||
axes[0] = x_pos;
|
||||
axes[1] = y_pos;
|
||||
}
|
||||
_gdk_display_device_grab_update (display, device, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -192,7 +172,6 @@ gdk_macos_device_class_init (GdkMacosDeviceClass *klass)
|
||||
{
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
device_class->get_state = gdk_macos_device_get_state;
|
||||
device_class->grab = gdk_macos_device_grab;
|
||||
device_class->query_state = gdk_macos_device_query_state;
|
||||
device_class->set_surface_cursor = gdk_macos_device_set_surface_cursor;
|
||||
|
@ -186,7 +186,7 @@ struct _GdkWaylandTabletData
|
||||
GdkWaylandTabletToolData *current_tool;
|
||||
|
||||
int axis_indices[GDK_AXIS_LAST];
|
||||
double *axes;
|
||||
double axes[GDK_AXIS_LAST];
|
||||
};
|
||||
|
||||
struct _GdkWaylandSeat
|
||||
@ -307,23 +307,6 @@ static void deliver_key_event (GdkWaylandSeat *seat,
|
||||
uint32_t state,
|
||||
gboolean from_key_repeat);
|
||||
|
||||
static void
|
||||
gdk_wayland_device_get_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
double *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
double x, y;
|
||||
|
||||
gdk_surface_get_device_position (surface, device, &x, &y, mask);
|
||||
|
||||
if (axes)
|
||||
{
|
||||
axes[0] = x;
|
||||
axes[1] = y;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_pointer_stop_cursor_animation (GdkWaylandPointerData *pointer)
|
||||
{
|
||||
@ -578,7 +561,6 @@ emulate_crossing (GdkSurface *surface,
|
||||
event = gdk_crossing_event_new (type,
|
||||
surface,
|
||||
device,
|
||||
device,
|
||||
time_,
|
||||
state,
|
||||
x, y,
|
||||
@ -603,7 +585,6 @@ emulate_touch_crossing (GdkSurface *surface,
|
||||
event = gdk_crossing_event_new (type,
|
||||
surface,
|
||||
device,
|
||||
source,
|
||||
time_,
|
||||
0,
|
||||
touch->x, touch->y,
|
||||
@ -619,7 +600,7 @@ emulate_focus (GdkSurface *surface,
|
||||
gboolean focus_in,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkEvent *event = gdk_focus_event_new (surface, device, device, focus_in);
|
||||
GdkEvent *event = gdk_focus_event_new (surface, device, focus_in);
|
||||
|
||||
_gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event);
|
||||
}
|
||||
@ -814,7 +795,6 @@ gdk_wayland_device_class_init (GdkWaylandDeviceClass *klass)
|
||||
{
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
device_class->get_state = gdk_wayland_device_get_state;
|
||||
device_class->set_surface_cursor = gdk_wayland_device_set_surface_cursor;
|
||||
device_class->query_state = gdk_wayland_device_query_state;
|
||||
device_class->grab = gdk_wayland_device_grab;
|
||||
@ -1344,7 +1324,6 @@ flush_discrete_scroll_event (GdkWaylandSeat *seat,
|
||||
|
||||
source = get_scroll_device (seat, seat->pointer_info.frame.source);
|
||||
event = gdk_scroll_event_new_discrete (seat->pointer_info.focus,
|
||||
seat->logical_pointer,
|
||||
source,
|
||||
NULL,
|
||||
seat->pointer_info.time,
|
||||
@ -1366,7 +1345,6 @@ flush_smooth_scroll_event (GdkWaylandSeat *seat,
|
||||
|
||||
source = get_scroll_device (seat, seat->pointer_info.frame.source);
|
||||
event = gdk_scroll_event_new (seat->pointer_info.focus,
|
||||
seat->logical_pointer,
|
||||
source,
|
||||
NULL,
|
||||
seat->pointer_info.time,
|
||||
@ -1484,7 +1462,6 @@ pointer_handle_enter (void *data,
|
||||
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
|
||||
seat->pointer_info.focus,
|
||||
seat->logical_pointer,
|
||||
seat->pointer,
|
||||
0,
|
||||
0,
|
||||
seat->pointer_info.surface_x,
|
||||
@ -1533,14 +1510,12 @@ pointer_handle_leave (void *data,
|
||||
display_serial, NULL, TRUE);
|
||||
_gdk_display_device_grab_update (seat->display,
|
||||
seat->logical_pointer,
|
||||
seat->pointer,
|
||||
display_serial);
|
||||
}
|
||||
|
||||
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
|
||||
seat->pointer_info.focus,
|
||||
seat->logical_pointer,
|
||||
seat->pointer,
|
||||
0,
|
||||
0,
|
||||
seat->pointer_info.surface_x,
|
||||
@ -1584,7 +1559,6 @@ pointer_handle_motion (void *data,
|
||||
|
||||
event = gdk_motion_event_new (seat->pointer_info.focus,
|
||||
seat->logical_pointer,
|
||||
seat->pointer,
|
||||
NULL,
|
||||
time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
@ -1648,7 +1622,6 @@ pointer_handle_button (void *data,
|
||||
event = gdk_button_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE,
|
||||
seat->pointer_info.focus,
|
||||
seat->logical_pointer,
|
||||
seat->pointer,
|
||||
NULL,
|
||||
time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
@ -1912,7 +1885,6 @@ keyboard_handle_enter (void *data,
|
||||
|
||||
event = gdk_focus_event_new (seat->keyboard_focus,
|
||||
seat->logical_keyboard,
|
||||
seat->keyboard,
|
||||
TRUE);
|
||||
|
||||
GDK_SEAT_NOTE (seat, EVENTS,
|
||||
@ -1947,7 +1919,6 @@ keyboard_handle_leave (void *data,
|
||||
|
||||
event = gdk_focus_event_new (seat->keyboard_focus,
|
||||
seat->logical_keyboard,
|
||||
seat->keyboard,
|
||||
FALSE);
|
||||
|
||||
g_object_unref (seat->keyboard_focus);
|
||||
@ -2074,7 +2045,6 @@ deliver_key_event (GdkWaylandSeat *seat,
|
||||
event = gdk_key_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
|
||||
seat->keyboard_focus,
|
||||
seat->logical_keyboard,
|
||||
seat->keyboard,
|
||||
time_,
|
||||
key,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
@ -2391,7 +2361,6 @@ touch_handle_down (void *data,
|
||||
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
|
||||
touch->surface,
|
||||
seat->logical_touch,
|
||||
seat->touch,
|
||||
time,
|
||||
device_get_modifiers (seat->logical_touch),
|
||||
touch->x, touch->y,
|
||||
@ -2434,7 +2403,6 @@ touch_handle_up (void *data,
|
||||
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
|
||||
touch->surface,
|
||||
seat->logical_touch,
|
||||
seat->touch,
|
||||
time,
|
||||
device_get_modifiers (seat->logical_touch),
|
||||
touch->x, touch->y,
|
||||
@ -2479,7 +2447,6 @@ touch_handle_motion (void *data,
|
||||
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
|
||||
touch->surface,
|
||||
seat->logical_touch,
|
||||
seat->touch,
|
||||
time,
|
||||
device_get_modifiers (seat->logical_touch),
|
||||
touch->x, touch->y,
|
||||
@ -2525,7 +2492,6 @@ touch_handle_cancel (void *data,
|
||||
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
|
||||
touch->surface,
|
||||
seat->logical_touch,
|
||||
seat->touch,
|
||||
GDK_CURRENT_TIME,
|
||||
device_get_modifiers (seat->logical_touch),
|
||||
touch->x, touch->y,
|
||||
@ -2554,7 +2520,6 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
|
||||
seat->pointer_info.time = _time;
|
||||
|
||||
event = gdk_touchpad_event_new_swipe (seat->pointer_info.focus,
|
||||
seat->logical_pointer,
|
||||
seat->pointer,
|
||||
_time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
@ -2651,7 +2616,6 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
|
||||
seat->pointer_info.time = _time;
|
||||
|
||||
event = gdk_touchpad_event_new_pinch (seat->pointer_info.focus,
|
||||
seat->logical_pointer,
|
||||
seat->pointer,
|
||||
_time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
@ -2773,9 +2737,6 @@ _gdk_wayland_seat_remove_tablet (GdkWaylandSeat *seat,
|
||||
if (tablet->pointer_info.focus)
|
||||
g_object_unref (tablet->pointer_info.focus);
|
||||
|
||||
if (tablet->axes)
|
||||
g_free (tablet->axes);
|
||||
|
||||
wl_surface_destroy (tablet->pointer_info.pointer_surface);
|
||||
g_object_unref (tablet->logical_device);
|
||||
g_object_unref (tablet->stylus_device);
|
||||
@ -3076,7 +3037,7 @@ seat_handle_capabilities (void *data,
|
||||
seat->logical_touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
|
||||
"name", "Wayland Touch Logical Pointer",
|
||||
"type", GDK_DEVICE_TYPE_LOGICAL,
|
||||
"source", GDK_SOURCE_MOUSE,
|
||||
"source", GDK_SOURCE_TOUCHSCREEN,
|
||||
"has-cursor", TRUE,
|
||||
"display", seat->display,
|
||||
"seat", seat,
|
||||
@ -3124,14 +3085,13 @@ get_scroll_device (GdkWaylandSeat *seat,
|
||||
{
|
||||
seat->wheel_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
|
||||
"name", "Wayland Wheel Scrolling",
|
||||
"type", GDK_DEVICE_TYPE_PHYSICAL,
|
||||
"type", GDK_DEVICE_TYPE_LOGICAL,
|
||||
"source", GDK_SOURCE_MOUSE,
|
||||
"has-cursor", TRUE,
|
||||
"display", seat->display,
|
||||
"seat", seat,
|
||||
NULL);
|
||||
_gdk_device_set_associated_device (seat->wheel_scrolling, seat->logical_pointer);
|
||||
gdk_seat_device_added (GDK_SEAT (seat), seat->wheel_scrolling);
|
||||
gdk_seat_device_added (GDK_SEAT (seat), seat->wheel_scrolling);
|
||||
}
|
||||
return seat->wheel_scrolling;
|
||||
|
||||
@ -3140,14 +3100,13 @@ get_scroll_device (GdkWaylandSeat *seat,
|
||||
{
|
||||
seat->finger_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
|
||||
"name", "Wayland Finger Scrolling",
|
||||
"type", GDK_DEVICE_TYPE_PHYSICAL,
|
||||
"type", GDK_DEVICE_TYPE_LOGICAL,
|
||||
"source", GDK_SOURCE_TOUCHPAD,
|
||||
"has-cursor", TRUE,
|
||||
"display", seat->display,
|
||||
"seat", seat,
|
||||
NULL);
|
||||
_gdk_device_set_associated_device (seat->finger_scrolling, seat->logical_pointer);
|
||||
gdk_seat_device_added (GDK_SEAT (seat), seat->finger_scrolling);
|
||||
gdk_seat_device_added (GDK_SEAT (seat), seat->finger_scrolling);
|
||||
}
|
||||
return seat->finger_scrolling;
|
||||
|
||||
@ -3156,14 +3115,13 @@ get_scroll_device (GdkWaylandSeat *seat,
|
||||
{
|
||||
seat->continuous_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
|
||||
"name", "Wayland Continuous Scrolling",
|
||||
"type", GDK_DEVICE_TYPE_PHYSICAL,
|
||||
"type", GDK_DEVICE_TYPE_LOGICAL,
|
||||
"source", GDK_SOURCE_TRACKPOINT,
|
||||
"has-cursor", TRUE,
|
||||
"display", seat->display,
|
||||
"seat", seat,
|
||||
NULL);
|
||||
_gdk_device_set_associated_device (seat->continuous_scrolling, seat->logical_pointer);
|
||||
gdk_seat_device_added (GDK_SEAT (seat), seat->continuous_scrolling);
|
||||
gdk_seat_device_added (GDK_SEAT (seat), seat->continuous_scrolling);
|
||||
}
|
||||
return seat->continuous_scrolling;
|
||||
|
||||
@ -3389,12 +3347,6 @@ gdk_wayland_device_tablet_clone_tool_axes (GdkWaylandTabletData *tablet,
|
||||
tablet->axis_indices[GDK_AXIS_SLIDER] = axis_pos;
|
||||
}
|
||||
|
||||
if (tablet->axes)
|
||||
g_free (tablet->axes);
|
||||
|
||||
tablet->axes =
|
||||
g_new0 (double, gdk_device_get_n_axes (tablet->stylus_device));
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (tablet->stylus_device));
|
||||
}
|
||||
|
||||
@ -3456,7 +3408,6 @@ tablet_tool_handle_proximity_in (void *data,
|
||||
event = gdk_proximity_event_new (GDK_PROXIMITY_IN,
|
||||
tablet->pointer_info.focus,
|
||||
tablet->logical_device,
|
||||
tablet->stylus_device,
|
||||
tool->tool,
|
||||
tablet->pointer_info.time);
|
||||
gdk_wayland_tablet_set_frame_event (tablet, event);
|
||||
@ -3487,7 +3438,6 @@ tablet_tool_handle_proximity_out (void *data,
|
||||
event = gdk_proximity_event_new (GDK_PROXIMITY_OUT,
|
||||
tablet->pointer_info.focus,
|
||||
tablet->logical_device,
|
||||
tablet->stylus_device,
|
||||
tool->tool,
|
||||
tablet->pointer_info.time);
|
||||
gdk_wayland_tablet_set_frame_event (tablet, event);
|
||||
@ -3510,7 +3460,7 @@ static double *
|
||||
tablet_copy_axes (GdkWaylandTabletData *tablet)
|
||||
{
|
||||
return g_memdup (tablet->axes,
|
||||
sizeof (double) * gdk_device_get_n_axes (tablet->stylus_device));
|
||||
sizeof (double) * GDK_AXIS_LAST);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3524,7 +3474,6 @@ tablet_create_button_event_frame (GdkWaylandTabletData *tablet,
|
||||
event = gdk_button_event_new (evtype,
|
||||
tablet->pointer_info.focus,
|
||||
tablet->logical_device,
|
||||
tablet->stylus_device,
|
||||
tablet->current_tool->tool,
|
||||
tablet->pointer_info.time,
|
||||
device_get_modifiers (seat->logical_pointer),
|
||||
@ -3589,7 +3538,6 @@ tablet_tool_handle_motion (void *data,
|
||||
|
||||
event = gdk_motion_event_new (tablet->pointer_info.focus,
|
||||
tablet->logical_device,
|
||||
tablet->stylus_device,
|
||||
tool->tool,
|
||||
tablet->pointer_info.time,
|
||||
device_get_modifiers (tablet->logical_device),
|
||||
@ -3610,7 +3558,7 @@ tablet_tool_handle_pressure (void *data,
|
||||
int axis_index = tablet->axis_indices[GDK_AXIS_PRESSURE];
|
||||
|
||||
_gdk_device_translate_axis (tablet->stylus_device, axis_index,
|
||||
pressure, &tablet->axes[axis_index]);
|
||||
pressure, &tablet->axes[GDK_AXIS_PRESSURE]);
|
||||
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d pressure %d",
|
||||
@ -3627,7 +3575,7 @@ tablet_tool_handle_distance (void *data,
|
||||
int axis_index = tablet->axis_indices[GDK_AXIS_DISTANCE];
|
||||
|
||||
_gdk_device_translate_axis (tablet->stylus_device, axis_index,
|
||||
distance, &tablet->axes[axis_index]);
|
||||
distance, &tablet->axes[GDK_AXIS_DISTANCE]);
|
||||
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d distance %d",
|
||||
@ -3647,10 +3595,10 @@ tablet_tool_handle_tilt (void *data,
|
||||
|
||||
_gdk_device_translate_axis (tablet->stylus_device, xtilt_axis_index,
|
||||
wl_fixed_to_double (xtilt),
|
||||
&tablet->axes[xtilt_axis_index]);
|
||||
&tablet->axes[GDK_AXIS_XTILT]);
|
||||
_gdk_device_translate_axis (tablet->stylus_device, ytilt_axis_index,
|
||||
wl_fixed_to_double (ytilt),
|
||||
&tablet->axes[ytilt_axis_index]);
|
||||
&tablet->axes[GDK_AXIS_YTILT]);
|
||||
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d tilt %f/%f",
|
||||
@ -3705,7 +3653,7 @@ tablet_tool_handle_rotation (void *data,
|
||||
|
||||
_gdk_device_translate_axis (tablet->stylus_device, axis_index,
|
||||
wl_fixed_to_double (degrees),
|
||||
&tablet->axes[axis_index]);
|
||||
&tablet->axes[GDK_AXIS_ROTATION]);
|
||||
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d rotation %f",
|
||||
@ -3723,7 +3671,7 @@ tablet_tool_handle_slider (void *data,
|
||||
int axis_index = tablet->axis_indices[GDK_AXIS_SLIDER];
|
||||
|
||||
_gdk_device_translate_axis (tablet->stylus_device, axis_index,
|
||||
position, &tablet->axes[axis_index]);
|
||||
position, &tablet->axes[GDK_AXIS_SLIDER]);
|
||||
|
||||
GDK_SEAT_NOTE (tool->seat, EVENTS,
|
||||
g_message ("tablet tool %d slider %d",
|
||||
@ -3751,7 +3699,6 @@ tablet_tool_handle_wheel (void *data,
|
||||
/* Send smooth event */
|
||||
event = gdk_scroll_event_new (tablet->pointer_info.focus,
|
||||
tablet->logical_device,
|
||||
tablet->stylus_device,
|
||||
tablet->current_tool->tool,
|
||||
tablet->pointer_info.time,
|
||||
device_get_modifiers (tablet->logical_device),
|
||||
@ -3762,7 +3709,6 @@ tablet_tool_handle_wheel (void *data,
|
||||
|
||||
/* Send discrete event */
|
||||
event = gdk_scroll_event_new_discrete (tablet->pointer_info.focus,
|
||||
tablet->logical_device,
|
||||
tablet->stylus_device,
|
||||
tablet->current_tool->tool,
|
||||
tablet->pointer_info.time,
|
||||
@ -3873,7 +3819,6 @@ tablet_pad_ring_handle_frame (void *data,
|
||||
g_message ("tablet pad ring handle frame, ring = %p", wp_tablet_pad_ring));
|
||||
|
||||
event = gdk_pad_event_new_ring (seat->keyboard_focus,
|
||||
pad->device,
|
||||
pad->device,
|
||||
time,
|
||||
g_list_index (pad->mode_groups, group),
|
||||
@ -3948,7 +3893,6 @@ tablet_pad_strip_handle_frame (void *data,
|
||||
wp_tablet_pad_strip));
|
||||
|
||||
event = gdk_pad_event_new_strip (seat->keyboard_focus,
|
||||
pad->device,
|
||||
pad->device,
|
||||
time,
|
||||
g_list_index (pad->mode_groups, group),
|
||||
@ -4074,7 +4018,6 @@ tablet_pad_group_handle_mode (void *data,
|
||||
n_group = g_list_index (pad->mode_groups, group);
|
||||
|
||||
event = gdk_pad_event_new_group_mode (seat->keyboard_focus,
|
||||
pad->device,
|
||||
pad->device,
|
||||
time,
|
||||
n_group,
|
||||
@ -4190,7 +4133,6 @@ tablet_pad_handle_button (void *data,
|
||||
: GDK_PAD_BUTTON_RELEASE,
|
||||
GDK_WAYLAND_SEAT (pad->seat)->keyboard_focus,
|
||||
pad->device,
|
||||
pad->device,
|
||||
time,
|
||||
n_group,
|
||||
button,
|
||||
@ -4767,6 +4709,22 @@ gdk_wayland_seat_get_physical_devices (GdkSeat *seat,
|
||||
return physical_devices;
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_wayland_seat_get_tools (GdkSeat *seat)
|
||||
{
|
||||
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
|
||||
GList *tools = NULL, *l;
|
||||
|
||||
for (l = wayland_seat->tablet_tools; l; l = l->next)
|
||||
{
|
||||
GdkWaylandTabletToolData *tool = l->data;
|
||||
|
||||
tools = g_list_prepend (tools, tool->tool);
|
||||
}
|
||||
|
||||
return tools;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_seat_class_init (GdkWaylandSeatClass *klass)
|
||||
{
|
||||
@ -4780,6 +4738,7 @@ gdk_wayland_seat_class_init (GdkWaylandSeatClass *klass)
|
||||
seat_class->ungrab = gdk_wayland_seat_ungrab;
|
||||
seat_class->get_logical_device = gdk_wayland_seat_get_logical_device;
|
||||
seat_class->get_physical_devices = gdk_wayland_seat_get_physical_devices;
|
||||
seat_class->get_tools = gdk_wayland_seat_get_tools;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -4904,7 +4863,7 @@ _gdk_wayland_seat_get_implicit_grab_serial (GdkSeat *seat,
|
||||
|
||||
if (event)
|
||||
{
|
||||
GdkDevice *source = gdk_event_get_source_device (event);
|
||||
GdkDevice *source = gdk_event_get_device (event);
|
||||
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (seat);
|
||||
GList *l;
|
||||
|
||||
@ -4987,7 +4946,6 @@ gdk_wayland_device_unset_touch_grab (GdkDevice *gdk_device,
|
||||
GDK_SLOT_TO_EVENT_SEQUENCE (touch->id),
|
||||
touch->surface,
|
||||
seat->logical_touch,
|
||||
seat->touch,
|
||||
GDK_CURRENT_TIME,
|
||||
device_get_modifiers (seat->logical_touch),
|
||||
touch->x, touch->y,
|
||||
|
@ -59,19 +59,6 @@ _gdk_device_virtual_set_active (GdkDevice *device,
|
||||
g_signal_emit_by_name (G_OBJECT (device), "changed");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_virtual_get_state (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
double *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
GdkDeviceVirtual *virtual = GDK_DEVICE_VIRTUAL (device);
|
||||
GdkDevice *active = virtual->active_device;
|
||||
|
||||
GDK_DEVICE_GET_CLASS (active)->get_state (active,
|
||||
window, axes, mask);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_virtual_set_surface_cursor (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
@ -164,7 +151,7 @@ gdk_device_virtual_ungrab (GdkDevice *device,
|
||||
ReleaseCapture ();
|
||||
}
|
||||
|
||||
_gdk_display_device_grab_update (display, device, device, 0);
|
||||
_gdk_display_device_grab_update (display, device, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -172,7 +159,6 @@ gdk_device_virtual_class_init (GdkDeviceVirtualClass *klass)
|
||||
{
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
device_class->get_state = gdk_device_virtual_get_state;
|
||||
device_class->set_surface_cursor = gdk_device_virtual_set_surface_cursor;
|
||||
device_class->query_state = gdk_device_virtual_query_state;
|
||||
device_class->grab = gdk_device_virtual_grab;
|
||||
|
@ -29,23 +29,6 @@
|
||||
|
||||
G_DEFINE_TYPE (GdkDeviceWin32, gdk_device_win32, GDK_TYPE_DEVICE)
|
||||
|
||||
static void
|
||||
gdk_device_win32_get_state (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
double *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
double x, y;
|
||||
|
||||
gdk_surface_get_device_position (window, device, &x, &y, mask);
|
||||
|
||||
if (axes)
|
||||
{
|
||||
axes[0] = round (x);
|
||||
axes[1] = round (y);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_win32_set_surface_cursor (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
@ -224,7 +207,6 @@ gdk_device_win32_class_init (GdkDeviceWin32Class *klass)
|
||||
{
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
device_class->get_state = gdk_device_win32_get_state;
|
||||
device_class->set_surface_cursor = gdk_device_win32_set_surface_cursor;
|
||||
device_class->query_state = gdk_device_win32_query_state;
|
||||
device_class->grab = gdk_device_win32_grab;
|
||||
|
@ -54,33 +54,6 @@ get_current_mask (void)
|
||||
return mask;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_wintab_get_state (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
double *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
GdkDeviceWintab *device_wintab;
|
||||
|
||||
device_wintab = GDK_DEVICE_WINTAB (device);
|
||||
|
||||
/* For now just use the last known button and axis state of the device.
|
||||
* Since graphical tablets send an insane amount of motion events each
|
||||
* second, the info should be fairly up to date */
|
||||
if (mask)
|
||||
{
|
||||
*mask = get_current_mask ();
|
||||
*mask &= 0xFF; /* Mask away core pointer buttons */
|
||||
*mask |= ((device_wintab->button_state << 8)
|
||||
& (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK
|
||||
| GDK_BUTTON3_MASK | GDK_BUTTON4_MASK
|
||||
| GDK_BUTTON5_MASK));
|
||||
}
|
||||
|
||||
if (axes && device_wintab->last_axis_data)
|
||||
_gdk_device_wintab_translate_axes (device_wintab, window, axes, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_wintab_set_surface_cursor (GdkDevice *device,
|
||||
GdkSurface *window,
|
||||
@ -228,18 +201,18 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab,
|
||||
minfo.rcWork.bottom - minfo.rcWork.top,
|
||||
i,
|
||||
device_wintab->last_axis_data[i],
|
||||
&axes[i]);
|
||||
&axes[use]);
|
||||
}
|
||||
if (use == GDK_AXIS_X)
|
||||
temp_x = axes[i];
|
||||
temp_x = axes[use];
|
||||
else if (use == GDK_AXIS_Y)
|
||||
temp_y = axes[i];
|
||||
temp_y = axes[use];
|
||||
|
||||
break;
|
||||
default:
|
||||
_gdk_device_translate_axis (device, i,
|
||||
device_wintab->last_axis_data[i],
|
||||
&axes[i]);
|
||||
&axes[use]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -256,7 +229,6 @@ gdk_device_wintab_class_init (GdkDeviceWintabClass *klass)
|
||||
{
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
device_class->get_state = gdk_device_wintab_get_state;
|
||||
device_class->set_surface_cursor = gdk_device_wintab_set_surface_cursor;
|
||||
device_class->query_state = gdk_device_wintab_query_state;
|
||||
device_class->grab = gdk_device_wintab_grab;
|
||||
|
@ -1044,7 +1044,7 @@ gdk_input_other_event (GdkDisplay *display,
|
||||
if (event_type == GDK_BUTTON_PRESS ||
|
||||
event_type == GDK_BUTTON_RELEASE)
|
||||
{
|
||||
axes = g_new (double, num_axes);
|
||||
axes = g_new (double, GDK_AXIS_LAST);
|
||||
|
||||
_gdk_device_wintab_translate_axes (source_device,
|
||||
window,
|
||||
@ -1061,7 +1061,6 @@ gdk_input_other_event (GdkDisplay *display,
|
||||
event = gdk_button_event_new (event_type,
|
||||
window,
|
||||
device_manager->core_pointer,
|
||||
GDK_DEVICE (source_device),
|
||||
NULL,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
event_state,
|
||||
@ -1080,7 +1079,7 @@ gdk_input_other_event (GdkDisplay *display,
|
||||
}
|
||||
else
|
||||
{
|
||||
axes = g_new (double, num_axes);
|
||||
axes = g_new (double, GDK_AXIS_LAST);
|
||||
_gdk_device_wintab_translate_axes (source_device,
|
||||
window,
|
||||
axes,
|
||||
@ -1095,7 +1094,6 @@ gdk_input_other_event (GdkDisplay *display,
|
||||
|
||||
event = gdk_motion_event_new (window,
|
||||
device_manager->core_pointer,
|
||||
GDK_DEVICE (source_device),
|
||||
NULL,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
event_state,
|
||||
|
@ -201,13 +201,11 @@ generate_focus_event (GdkDeviceManagerWin32 *device_manager,
|
||||
gboolean in)
|
||||
{
|
||||
GdkDevice *device;
|
||||
GdkDevice *source_device;
|
||||
GdkEvent *event;
|
||||
|
||||
device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->core_keyboard;
|
||||
source_device = GDK_DEVICE_MANAGER_WIN32 (device_manager)->system_keyboard;
|
||||
|
||||
event = gdk_focus_event_new (window, device, source_device, in);
|
||||
event = gdk_focus_event_new (window, device, in);
|
||||
|
||||
_gdk_win32_append_event (event);
|
||||
}
|
||||
@ -220,22 +218,14 @@ generate_grab_broken_event (GdkDeviceManagerWin32 *device_manager,
|
||||
{
|
||||
GdkEvent *event;
|
||||
GdkDevice *device;
|
||||
GdkDevice *source_device;
|
||||
|
||||
if (keyboard)
|
||||
{
|
||||
device = device_manager->core_keyboard;
|
||||
source_device = device_manager->system_keyboard;
|
||||
}
|
||||
device = device_manager->core_keyboard;
|
||||
else
|
||||
{
|
||||
device = device_manager->core_pointer;
|
||||
source_device = device_manager->system_pointer;
|
||||
}
|
||||
device = device_manager->core_pointer;
|
||||
|
||||
event = gdk_grab_broken_event_new (window,
|
||||
device,
|
||||
source_device,
|
||||
grab_window,
|
||||
FALSE);
|
||||
|
||||
@ -1079,7 +1069,6 @@ send_crossing_event (GdkDisplay *display,
|
||||
event = gdk_crossing_event_new (type,
|
||||
window,
|
||||
device_manager->core_pointer,
|
||||
device_manager->system_pointer,
|
||||
_gdk_win32_get_next_tick (time_),
|
||||
mask,
|
||||
pt.x / impl->surface_scale,
|
||||
@ -1588,7 +1577,6 @@ generate_button_event (GdkEventType type,
|
||||
event = gdk_button_event_new (type,
|
||||
window,
|
||||
device_manager->core_pointer,
|
||||
device_manager->system_pointer,
|
||||
NULL,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_pointer_event_state (msg),
|
||||
@ -2132,7 +2120,6 @@ gdk_event_translate (MSG *msg,
|
||||
event = gdk_key_event_new (GDK_KEY_PRESS,
|
||||
window,
|
||||
device_manager_win32->core_keyboard,
|
||||
device_manager_win32->system_keyboard,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
0,
|
||||
0,
|
||||
@ -2337,7 +2324,6 @@ gdk_event_translate (MSG *msg,
|
||||
: GDK_KEY_RELEASE,
|
||||
window,
|
||||
device_manager_win32->core_keyboard,
|
||||
device_manager_win32->system_keyboard,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
state,
|
||||
keycode,
|
||||
@ -2412,7 +2398,6 @@ gdk_event_translate (MSG *msg,
|
||||
event = gdk_key_event_new (GDK_KEY_PRESS,
|
||||
window,
|
||||
device_manager_win32->core_keyboard,
|
||||
device_manager_win32->system_keyboard,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_key_event_state (key_state),
|
||||
0,
|
||||
@ -2426,7 +2411,6 @@ gdk_event_translate (MSG *msg,
|
||||
event = gdk_key_event_new (GDK_KEY_RELEASE,
|
||||
window,
|
||||
device_manager_win32->core_keyboard,
|
||||
device_manager_win32->system_keyboard,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_key_event_state (key_state),
|
||||
0,
|
||||
@ -2639,7 +2623,6 @@ gdk_event_translate (MSG *msg,
|
||||
|
||||
event = gdk_motion_event_new (window,
|
||||
device_manager_win32->core_pointer,
|
||||
device_manager_win32->system_pointer,
|
||||
NULL,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_pointer_event_state (msg),
|
||||
@ -2765,7 +2748,6 @@ gdk_event_translate (MSG *msg,
|
||||
|
||||
event = gdk_scroll_event_new (window,
|
||||
device_manager_win32->core_pointer,
|
||||
device_manager_win32->system_pointer,
|
||||
NULL,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_pointer_event_state (msg),
|
||||
@ -2788,7 +2770,6 @@ gdk_event_translate (MSG *msg,
|
||||
|
||||
event = gdk_scroll_event_new_discrete (window,
|
||||
device_manager_win32->core_pointer,
|
||||
device_manager_win32->system_pointer,
|
||||
NULL,
|
||||
_gdk_win32_get_next_tick (msg->time),
|
||||
build_pointer_event_state (msg),
|
||||
|
@ -70,10 +70,6 @@ static void gdk_x11_device_xi2_set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void gdk_x11_device_xi2_get_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
double *axes,
|
||||
GdkModifierType *mask);
|
||||
static void gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
GdkCursor *cursor);
|
||||
@ -115,7 +111,6 @@ gdk_x11_device_xi2_class_init (GdkX11DeviceXI2Class *klass)
|
||||
object_class->get_property = gdk_x11_device_xi2_get_property;
|
||||
object_class->set_property = gdk_x11_device_xi2_set_property;
|
||||
|
||||
device_class->get_state = gdk_x11_device_xi2_get_state;
|
||||
device_class->set_surface_cursor = gdk_x11_device_xi2_set_surface_cursor;
|
||||
device_class->query_state = gdk_x11_device_xi2_query_state;
|
||||
device_class->grab = gdk_x11_device_xi2_grab;
|
||||
@ -187,78 +182,6 @@ gdk_x11_device_xi2_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_device_xi2_get_state (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
double *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
GdkX11DeviceXI2 *device_xi2 = GDK_X11_DEVICE_XI2 (device);
|
||||
|
||||
if (axes)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
XIDeviceInfo *info;
|
||||
int i, j, ndevices;
|
||||
Screen *xscreen;
|
||||
|
||||
display = gdk_device_get_display (device);
|
||||
xscreen = GDK_X11_SCREEN (GDK_X11_DISPLAY (display)->screen)->xscreen;
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
info = XIQueryDevice (GDK_DISPLAY_XDISPLAY (display),
|
||||
device_xi2->device_id, &ndevices);
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
|
||||
for (i = 0, j = 0; info && i < info->num_classes; i++)
|
||||
{
|
||||
XIAnyClassInfo *class_info = info->classes[i];
|
||||
GdkAxisUse use;
|
||||
double value;
|
||||
|
||||
if (class_info->type != XIValuatorClass)
|
||||
continue;
|
||||
|
||||
value = ((XIValuatorClassInfo *) class_info)->value;
|
||||
use = gdk_device_get_axis_use (device, j);
|
||||
|
||||
switch ((guint) use)
|
||||
{
|
||||
case GDK_AXIS_X:
|
||||
case GDK_AXIS_Y:
|
||||
case GDK_AXIS_IGNORE:
|
||||
{
|
||||
int root_x, root_y;
|
||||
|
||||
/* FIXME: Maybe root coords caching should happen here */
|
||||
gdk_surface_get_origin (surface, &root_x, &root_y);
|
||||
_gdk_device_translate_screen_coord (device, surface,
|
||||
root_x, root_y,
|
||||
WidthOfScreen (xscreen),
|
||||
HeightOfScreen (xscreen),
|
||||
j, value,
|
||||
&axes[j]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_gdk_device_translate_axis (device, j, value, &axes[j]);
|
||||
break;
|
||||
}
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
if (info)
|
||||
XIFreeDeviceInfo (info);
|
||||
}
|
||||
|
||||
if (mask)
|
||||
gdk_x11_device_xi2_query_state (device, surface,
|
||||
NULL,
|
||||
NULL, NULL,
|
||||
mask);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_device_xi2_set_surface_cursor (GdkDevice *device,
|
||||
GdkSurface *surface,
|
||||
|
@ -489,9 +489,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
|
||||
|
||||
tmp_name = g_ascii_strdown (dev->name, -1);
|
||||
|
||||
if (strstr (tmp_name, "cursor"))
|
||||
input_source = GDK_SOURCE_CURSOR;
|
||||
else if (strstr (tmp_name, " pad"))
|
||||
if (strstr (tmp_name, " pad"))
|
||||
input_source = GDK_SOURCE_TABLET_PAD;
|
||||
else if (strstr (tmp_name, "wacom") ||
|
||||
strstr (tmp_name, "pen") ||
|
||||
@ -1199,7 +1197,7 @@ translate_axes (GdkDevice *device,
|
||||
double *vals;
|
||||
|
||||
n_axes = gdk_device_get_n_axes (device);
|
||||
axes = g_new0 (double, n_axes);
|
||||
axes = g_new0 (double, GDK_AXIS_LAST);
|
||||
vals = valuators->values;
|
||||
|
||||
for (i = 0; i < MIN (valuators->mask_len * 8, n_axes); i++)
|
||||
@ -1208,10 +1206,7 @@ translate_axes (GdkDevice *device,
|
||||
double val;
|
||||
|
||||
if (!XIMaskIsSet (valuators->mask, i))
|
||||
{
|
||||
axes[i] = gdk_x11_device_xi2_get_last_axis_value (GDK_X11_DEVICE_XI2 (device), i);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
|
||||
use = gdk_device_get_axis_use (device, i);
|
||||
val = *vals++;
|
||||
@ -1222,13 +1217,13 @@ translate_axes (GdkDevice *device,
|
||||
case GDK_AXIS_Y:
|
||||
{
|
||||
if (use == GDK_AXIS_X)
|
||||
axes[i] = x;
|
||||
axes[use] = x;
|
||||
else
|
||||
axes[i] = y;
|
||||
axes[use] = y;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
_gdk_device_translate_axis (device, i, val, &axes[i]);
|
||||
_gdk_device_translate_axis (device, i, val, &axes[use]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1445,7 +1440,7 @@ _gdk_device_manager_xi2_handle_focus (GdkSurface *surface,
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_focus_event_new (surface, device, source_device, focus_in);
|
||||
event = gdk_focus_event_new (surface, device, focus_in);
|
||||
gdk_display_put_event (gdk_surface_get_display (surface), event);
|
||||
gdk_event_unref (event);
|
||||
}
|
||||
@ -1586,7 +1581,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
: GDK_KEY_RELEASE,
|
||||
surface,
|
||||
device,
|
||||
source_device,
|
||||
xev->time,
|
||||
xev->detail,
|
||||
state,
|
||||
@ -1652,7 +1646,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
|
||||
event = gdk_scroll_event_new_discrete (surface,
|
||||
device,
|
||||
source_device,
|
||||
NULL,
|
||||
xev->time,
|
||||
@ -1686,7 +1679,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
: GDK_BUTTON_RELEASE,
|
||||
surface,
|
||||
device,
|
||||
source_device,
|
||||
source_device->last_tool,
|
||||
xev->time,
|
||||
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
|
||||
@ -1739,7 +1731,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
event = gdk_scroll_event_new (surface,
|
||||
device,
|
||||
source_device,
|
||||
NULL,
|
||||
xev->time,
|
||||
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
|
||||
@ -1760,7 +1751,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
event = gdk_motion_event_new (surface,
|
||||
device,
|
||||
source_device,
|
||||
source_device->last_tool,
|
||||
xev->time,
|
||||
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
|
||||
@ -1812,7 +1802,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
GUINT_TO_POINTER (xev->detail),
|
||||
surface,
|
||||
device,
|
||||
source_device,
|
||||
xev->time,
|
||||
state,
|
||||
x, y,
|
||||
@ -1860,7 +1849,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
GUINT_TO_POINTER (xev->detail),
|
||||
surface,
|
||||
device,
|
||||
source_device,
|
||||
xev->time,
|
||||
state,
|
||||
x, y,
|
||||
@ -1927,7 +1915,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
: GDK_LEAVE_NOTIFY,
|
||||
surface,
|
||||
device,
|
||||
source_device,
|
||||
xev->time,
|
||||
state,
|
||||
(double) xev->event_x / scale,
|
||||
|
@ -1760,15 +1760,9 @@ device_grab_update_callback (GdkDisplay *display,
|
||||
gpointer data,
|
||||
gulong serial)
|
||||
{
|
||||
GdkPointerSurfaceInfo *pointer_info;
|
||||
GdkDevice *device = data;
|
||||
|
||||
pointer_info = _gdk_display_get_pointer_info (display, device);
|
||||
_gdk_display_device_grab_update (display, device,
|
||||
pointer_info->last_physical_device != NULL
|
||||
? pointer_info->last_physical_device
|
||||
: device,
|
||||
serial);
|
||||
_gdk_display_device_grab_update (display, device, serial);
|
||||
}
|
||||
|
||||
#define XSERVER_TIME_IS_LATER(time1, time2) \
|
||||
|
@ -117,7 +117,6 @@ handle_focus_change (GdkEvent *event)
|
||||
|
||||
focus_event = gdk_focus_event_new (gdk_event_get_surface (event),
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
focus_in);
|
||||
gdk_display_put_event (gdk_event_get_display (event), focus_event);
|
||||
gdk_event_unref (focus_event);
|
||||
@ -138,7 +137,6 @@ create_synth_crossing_event (GdkEventType evtype,
|
||||
event = gdk_crossing_event_new (evtype,
|
||||
gdk_event_get_surface (real_event),
|
||||
gdk_event_get_device (real_event),
|
||||
gdk_event_get_source_device (real_event),
|
||||
gdk_event_get_time (real_event),
|
||||
gdk_event_get_modifier_state (real_event),
|
||||
x, y,
|
||||
|
@ -258,7 +258,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
direction = gdk_scroll_event_get_direction (event);
|
||||
if (direction == GDK_SCROLL_SMOOTH)
|
||||
{
|
||||
GdkDevice *device = gdk_event_get_source_device (event);
|
||||
GdkDevice *device = gdk_event_get_device (event);
|
||||
GdkInputSource input_source = gdk_device_get_source (device);
|
||||
|
||||
gdk_scroll_event_get_deltas (event, &dx, &dy);
|
||||
|
@ -2875,7 +2875,7 @@ gtk_flow_box_click_gesture_released (GtkGestureClick *gesture,
|
||||
|
||||
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
|
||||
source = gdk_device_get_source (gdk_event_get_source_device (event));
|
||||
source = gdk_device_get_source (gdk_event_get_device (event));
|
||||
|
||||
if (source == GDK_SOURCE_TOUCHSCREEN)
|
||||
modify = !modify;
|
||||
|
@ -611,7 +611,7 @@ gtk_gesture_handle_event (GtkEventController *controller,
|
||||
GdkModifierType state;
|
||||
GtkWidget *target;
|
||||
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
source_device = gdk_event_get_device (event);
|
||||
|
||||
if (!source_device)
|
||||
return FALSE;
|
||||
|
@ -202,7 +202,7 @@ gtk_gesture_click_begin (GtkGesture *gesture,
|
||||
priv = gtk_gesture_click_get_instance_private (click);
|
||||
event = gtk_gesture_get_last_event (gesture, sequence);
|
||||
current = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||
device = gdk_event_get_source_device (event);
|
||||
device = gdk_event_get_device (event);
|
||||
event_type = gdk_event_get_event_type (event);
|
||||
|
||||
if (event_type == GDK_BUTTON_PRESS)
|
||||
|
@ -143,7 +143,7 @@ gtk_gesture_single_handle_event (GtkEventController *controller,
|
||||
gboolean retval, test_touchscreen = FALSE;
|
||||
GdkEventType event_type;
|
||||
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
source_device = gdk_event_get_device (event);
|
||||
|
||||
if (!source_device)
|
||||
return FALSE;
|
||||
|
@ -603,7 +603,6 @@ gtk_im_context_filter_key (GtkIMContext *context,
|
||||
key = gdk_key_event_new (press ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
|
||||
surface,
|
||||
device,
|
||||
source_device,
|
||||
time,
|
||||
keycode,
|
||||
state,
|
||||
|
@ -809,7 +809,6 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
|
||||
GdkEvent *tmp_event = gdk_key_event_new (GDK_KEY_PRESS,
|
||||
gdk_event_get_surface (event),
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_time (event),
|
||||
priv->compose_buffer[len + i],
|
||||
gdk_event_get_modifier_state (event),
|
||||
|
@ -1849,7 +1849,7 @@ gtk_list_box_click_gesture_released (GtkGestureClick *gesture,
|
||||
state = gdk_event_get_modifier_state (event);
|
||||
extend = (state & GDK_SHIFT_MASK) != 0;
|
||||
modify = (state & GDK_CONTROL_MASK) != 0;
|
||||
source = gdk_device_get_source (gdk_event_get_source_device (event));
|
||||
source = gdk_device_get_source (gdk_event_get_device (event));
|
||||
|
||||
if (source == GDK_SOURCE_TOUCHSCREEN)
|
||||
modify = !modify;
|
||||
|
@ -1127,7 +1127,6 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
return gdk_button_event_new (type,
|
||||
new_surface,
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_device_tool (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
@ -1137,7 +1136,6 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
case GDK_MOTION_NOTIFY:
|
||||
return gdk_motion_event_new (new_surface,
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_device_tool (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
@ -1151,7 +1149,6 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
gdk_event_get_event_sequence (event),
|
||||
new_surface,
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
x, y,
|
||||
@ -1161,7 +1158,6 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
gdk_touchpad_event_get_deltas (event, &dx, &dy);
|
||||
return gdk_touchpad_event_new_swipe (new_surface,
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
gdk_touchpad_event_get_gesture_phase (event),
|
||||
@ -1172,7 +1168,6 @@ rewrite_event_for_surface (GdkEvent *event,
|
||||
gdk_touchpad_event_get_deltas (event, &dx, &dy);
|
||||
return gdk_touchpad_event_new_pinch (new_surface,
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
gdk_touchpad_event_get_gesture_phase (event),
|
||||
@ -1266,7 +1261,6 @@ rewrite_event_for_toplevel (GdkEvent *event)
|
||||
return gdk_key_event_new (gdk_event_get_event_type (event),
|
||||
surface,
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_key_event_get_keycode (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
@ -1542,6 +1536,17 @@ handle_pointing_event (GdkEvent *event)
|
||||
type = gdk_event_get_event_type (event);
|
||||
sequence = gdk_event_get_event_sequence (event);
|
||||
|
||||
if (type == GDK_SCROLL &&
|
||||
(gdk_device_get_source (device) == GDK_SOURCE_TOUCHPAD ||
|
||||
gdk_device_get_source (device) == GDK_SOURCE_TRACKPOINT ||
|
||||
gdk_device_get_source (device) == GDK_SOURCE_MOUSE))
|
||||
{
|
||||
/* A bit of a kludge, resolve target lookups for scrolling devices
|
||||
* on the seat pointer.
|
||||
*/
|
||||
device = gdk_seat_get_pointer (gdk_event_get_seat (event));
|
||||
}
|
||||
|
||||
switch ((guint) type)
|
||||
{
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
|
@ -210,7 +210,7 @@ gtk_pad_controller_filter_event (GtkEventController *controller,
|
||||
return TRUE;
|
||||
|
||||
if (pad_controller->pad &&
|
||||
gdk_event_get_source_device (event) != pad_controller->pad)
|
||||
gdk_event_get_device (event) != pad_controller->pad)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@ -233,7 +233,7 @@ gtk_pad_controller_handle_event (GtkEventController *controller,
|
||||
if (event_type == GDK_PAD_GROUP_MODE)
|
||||
{
|
||||
gtk_pad_controller_handle_mode_switch (pad_controller,
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_device (event),
|
||||
group,
|
||||
mode);
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
|
@ -873,7 +873,7 @@ gesture_drag_begin_cb (GtkGestureDrag *gesture,
|
||||
|
||||
sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
|
||||
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
|
||||
device = gdk_event_get_source_device (event);
|
||||
device = gdk_event_get_device (event);
|
||||
paned->panning = FALSE;
|
||||
|
||||
is_touch = (gdk_event_get_event_type (event) == GDK_TOUCH_BEGIN ||
|
||||
|
@ -602,7 +602,6 @@ close_menu (GtkPopover *popover)
|
||||
static gboolean
|
||||
gtk_popover_has_mnemonic_modifier_pressed (GtkPopover *popover)
|
||||
{
|
||||
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
|
||||
GList *seats, *s;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
@ -610,10 +609,10 @@ gtk_popover_has_mnemonic_modifier_pressed (GtkPopover *popover)
|
||||
|
||||
for (s = seats; s; s = s->next)
|
||||
{
|
||||
GdkDevice *dev = gdk_seat_get_pointer (s->data);
|
||||
GdkDevice *dev = gdk_seat_get_keyboard (s->data);
|
||||
GdkModifierType mask;
|
||||
|
||||
gdk_device_get_state (dev, priv->surface, NULL, &mask);
|
||||
mask = gdk_device_get_modifier_state (dev);
|
||||
if ((mask & gtk_accelerator_get_default_mod_mask ()) == GDK_ALT_MASK)
|
||||
{
|
||||
retval = TRUE;
|
||||
|
@ -1881,7 +1881,7 @@ gtk_range_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
state_mask = gdk_event_get_modifier_state (event);
|
||||
shift_pressed = (state_mask & GDK_SHIFT_MASK) != 0;
|
||||
|
||||
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
||||
source_device = gdk_event_get_device ((GdkEvent *) event);
|
||||
source = gdk_device_get_source (source_device);
|
||||
|
||||
g_object_get (gtk_widget_get_settings (widget),
|
||||
|
@ -1254,7 +1254,7 @@ captured_motion (GtkEventController *controller,
|
||||
state = gtk_event_controller_get_current_event_state (controller);
|
||||
event = gtk_event_controller_get_current_event (controller);
|
||||
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
source_device = gdk_event_get_device (event);
|
||||
input_source = gdk_device_get_source (source_device);
|
||||
|
||||
if (priv->hscrollbar_visible)
|
||||
|
@ -2714,7 +2714,7 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
sel_end = priv->current_pos;
|
||||
have_selection = sel_start != sel_end;
|
||||
|
||||
source = gdk_event_get_source_device (event);
|
||||
source = gdk_event_get_device (event);
|
||||
is_touchscreen = gtk_simulate_touchscreen () ||
|
||||
gdk_device_get_source (source) == GDK_SOURCE_TOUCHSCREEN;
|
||||
|
||||
@ -2991,7 +2991,7 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
|
||||
else
|
||||
tmp_pos = gtk_text_find_position (self, x);
|
||||
|
||||
source = gdk_event_get_source_device (event);
|
||||
source = gdk_event_get_device (event);
|
||||
input_source = gdk_device_get_source (source);
|
||||
|
||||
if (priv->select_words)
|
||||
|
@ -5384,7 +5384,7 @@ gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture,
|
||||
GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
gtk_text_view_reset_blink_time (text_view);
|
||||
|
||||
device = gdk_event_get_source_device ((GdkEvent *) event);
|
||||
device = gdk_event_get_device ((GdkEvent *) event);
|
||||
is_touchscreen = gtk_simulate_touchscreen () ||
|
||||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
|
||||
|
||||
@ -7220,7 +7220,7 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture,
|
||||
drag_gesture_get_text_surface_coords (gesture, text_view,
|
||||
&start_x, &start_y, &x, &y);
|
||||
|
||||
device = gdk_event_get_source_device (event);
|
||||
device = gdk_event_get_device (event);
|
||||
|
||||
is_touchscreen = gtk_simulate_touchscreen () ||
|
||||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
|
||||
@ -7355,7 +7355,7 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
return;
|
||||
|
||||
event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
|
||||
device = gdk_event_get_source_device (event);
|
||||
device = gdk_event_get_device (event);
|
||||
is_touchscreen = gtk_simulate_touchscreen () ||
|
||||
gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN;
|
||||
|
||||
|
@ -897,7 +897,7 @@ tooltips_enabled (GdkEvent *event)
|
||||
GDK_BUTTON5_MASK)) != 0)
|
||||
return FALSE;
|
||||
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
source_device = gdk_event_get_device (event);
|
||||
|
||||
if (!source_device)
|
||||
return FALSE;
|
||||
|
@ -1922,7 +1922,6 @@ _gtk_widget_emulate_press (GtkWidget *widget,
|
||||
gdk_event_get_event_sequence (event),
|
||||
gdk_event_get_surface (event),
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
p.x, p.y,
|
||||
@ -1934,7 +1933,6 @@ _gtk_widget_emulate_press (GtkWidget *widget,
|
||||
press = gdk_button_event_new (GDK_BUTTON_PRESS,
|
||||
gdk_event_get_surface (event),
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_device_tool (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
@ -1960,7 +1958,6 @@ _gtk_widget_emulate_press (GtkWidget *widget,
|
||||
press = gdk_button_event_new (GDK_BUTTON_PRESS,
|
||||
gdk_event_get_surface (event),
|
||||
gdk_event_get_device (event),
|
||||
gdk_event_get_source_device (event),
|
||||
gdk_event_get_device_tool (event),
|
||||
gdk_event_get_time (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
|
@ -4757,7 +4757,6 @@ gtk_window_real_activate_focus (GtkWindow *window)
|
||||
static gboolean
|
||||
gtk_window_has_mnemonic_modifier_pressed (GtkWindow *window)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
GList *seats, *s;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
@ -4765,10 +4764,10 @@ gtk_window_has_mnemonic_modifier_pressed (GtkWindow *window)
|
||||
|
||||
for (s = seats; s; s = s->next)
|
||||
{
|
||||
GdkDevice *dev = gdk_seat_get_pointer (s->data);
|
||||
GdkDevice *dev = gdk_seat_get_keyboard (s->data);
|
||||
GdkModifierType mask;
|
||||
|
||||
gdk_device_get_state (dev, priv->surface, NULL, &mask);
|
||||
mask = gdk_device_get_modifier_state (dev);
|
||||
if ((mask & gtk_accelerator_get_default_mod_mask ()) == GDK_ALT_MASK)
|
||||
{
|
||||
retval = TRUE;
|
||||
|
@ -675,15 +675,13 @@ init_media (GtkInspectorGeneral *gen)
|
||||
static void populate_seats (GtkInspectorGeneral *gen);
|
||||
|
||||
static void
|
||||
add_device (GtkInspectorGeneral *gen,
|
||||
GdkDevice *device)
|
||||
add_tool (GtkInspectorGeneral *gen,
|
||||
GdkDeviceTool *tool)
|
||||
{
|
||||
const char *name, *value;
|
||||
GdkAxisFlags axes;
|
||||
gchar *value;
|
||||
GString *str;
|
||||
int i;
|
||||
guint n_touches;
|
||||
char *text;
|
||||
GdkAxisFlags axes;
|
||||
const char *axis_name[] = {
|
||||
"Ignore",
|
||||
"X",
|
||||
@ -698,24 +696,26 @@ add_device (GtkInspectorGeneral *gen,
|
||||
"Rotation",
|
||||
"Slider"
|
||||
};
|
||||
const char *source_name[] = {
|
||||
"Mouse",
|
||||
const char *tool_type[] = {
|
||||
"Unknown",
|
||||
"Pen",
|
||||
"Cursor",
|
||||
"Keyboard",
|
||||
"Touchscreen",
|
||||
"Touchpad",
|
||||
"Trackpoint",
|
||||
"Pad"
|
||||
"Eraser",
|
||||
"Brush",
|
||||
"Pencil",
|
||||
"Airbrush",
|
||||
"Mouse",
|
||||
"Lens",
|
||||
};
|
||||
|
||||
name = gdk_device_get_name (device);
|
||||
value = source_name[gdk_device_get_source (device)];
|
||||
add_label_row (gen, GTK_LIST_BOX (gen->device_box), name, value, 10);
|
||||
|
||||
str = g_string_new ("");
|
||||
value = g_strdup_printf ("Serial %" G_GUINT64_FORMAT, gdk_device_tool_get_serial (tool));
|
||||
add_label_row (gen, GTK_LIST_BOX (gen->device_box), "Tool", value, 10);
|
||||
g_free (value);
|
||||
|
||||
axes = gdk_device_get_axes (device);
|
||||
add_label_row (gen, GTK_LIST_BOX (gen->device_box), "Type",
|
||||
tool_type[gdk_device_tool_get_tool_type (tool)], 20);
|
||||
|
||||
axes = gdk_device_tool_get_axes (tool);
|
||||
for (i = GDK_AXIS_X; i < GDK_AXIS_LAST; i++)
|
||||
{
|
||||
if ((axes & (1 << i)) != 0)
|
||||
@ -730,6 +730,29 @@ add_device (GtkInspectorGeneral *gen,
|
||||
add_label_row (gen, GTK_LIST_BOX (gen->device_box), "Axes", str->str, 20);
|
||||
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
add_device (GtkInspectorGeneral *gen,
|
||||
GdkDevice *device)
|
||||
{
|
||||
const char *name, *value;
|
||||
guint n_touches;
|
||||
char *text;
|
||||
const char *source_name[] = {
|
||||
"Mouse",
|
||||
"Pen",
|
||||
"Cursor",
|
||||
"Keyboard",
|
||||
"Touchscreen",
|
||||
"Touchpad",
|
||||
"Trackpoint",
|
||||
"Pad"
|
||||
};
|
||||
|
||||
name = gdk_device_get_name (device);
|
||||
value = source_name[gdk_device_get_source (device)];
|
||||
add_label_row (gen, GTK_LIST_BOX (gen->device_box), name, value, 10);
|
||||
|
||||
g_object_get (device, "num-touches", &n_touches, NULL);
|
||||
if (n_touches > 0)
|
||||
@ -786,6 +809,8 @@ add_seat (GtkInspectorGeneral *gen,
|
||||
g_object_set_data (G_OBJECT (seat), "inspector-connected", GINT_TO_POINTER (1));
|
||||
g_signal_connect_swapped (seat, "device-added", G_CALLBACK (populate_seats), gen);
|
||||
g_signal_connect_swapped (seat, "device-removed", G_CALLBACK (populate_seats), gen);
|
||||
g_signal_connect_swapped (seat, "tool-added", G_CALLBACK (populate_seats), gen);
|
||||
g_signal_connect_swapped (seat, "tool-removed", G_CALLBACK (populate_seats), gen);
|
||||
}
|
||||
|
||||
text = g_strdup_printf ("Seat %d", num);
|
||||
@ -801,6 +826,13 @@ add_seat (GtkInspectorGeneral *gen,
|
||||
add_device (gen, GDK_DEVICE (l->data));
|
||||
|
||||
g_list_free (list);
|
||||
|
||||
list = gdk_seat_get_tools (seat);
|
||||
|
||||
for (l = list; l; l = l->next)
|
||||
add_tool (gen, l->data);
|
||||
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -21,7 +21,6 @@ key_event_new (GdkEventType event_type,
|
||||
event->event_type = event_type;
|
||||
event->surface = g_object_ref (surface);
|
||||
event->device = g_object_ref (device);
|
||||
event->source_device = g_object_ref (source_device);
|
||||
event->time = time_;
|
||||
|
||||
key_event->keycode = keycode;
|
||||
|
Loading…
Reference in New Issue
Block a user