Merge branch 'getters-and-setters' into 'master'

gdk:Getters and setters

See merge request GNOME/gtk!1472
This commit is contained in:
Matthias Clasen 2020-02-24 20:31:22 +00:00
commit 90fb0caf28
16 changed files with 169 additions and 243 deletions

View File

@ -188,6 +188,7 @@ gdk_surface_is_destroyed
gdk_surface_is_visible
gdk_surface_is_viewable
gdk_surface_get_state
gdk_surface_get_autohide
gdk_surface_minimize
gdk_surface_unminimize
gdk_surface_stick
@ -463,6 +464,8 @@ gdk_device_get_n_axes
gdk_device_get_n_keys
gdk_device_get_axes
gdk_device_get_seat
gdk_device_get_num_touches
gdk_device_get_device_tool
<SUBSECTION>
gdk_device_get_state
@ -747,10 +750,12 @@ GdkDragAction
GDK_ACTION_ALL
gdk_drag_get_display
gdk_drag_get_content
gdk_drag_get_actions
gdk_drag_get_selected_action
gdk_drag_get_formats
gdk_drag_get_device
gdk_drag_get_surface
gdk_drag_get_drag_surface
gdk_drag_set_hotspot
@ -994,6 +999,7 @@ gdk_wayland_surface_get_type
<TITLE>Application launching</TITLE>
<FILE>gdkapplaunchcontext</FILE>
GdkAppLaunchContext
gdk_app_launch_context_get_display
gdk_app_launch_context_set_desktop
gdk_app_launch_context_set_timestamp
gdk_app_launch_context_set_icon

View File

@ -110,8 +110,7 @@ create_core_pointer (GdkDisplay *display)
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_MOUSE,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
NULL);
@ -123,8 +122,7 @@ create_core_keyboard (GdkDisplay *display)
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_KEYBOARD,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", display,
NULL);
@ -136,8 +134,7 @@ create_touchscreen (GdkDisplay *display)
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
"name", "Touchscreen",
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_TOUCHSCREEN,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", display,
NULL);

View File

@ -60,7 +60,7 @@
*/
static void gdk_app_launch_context_finalize (GObject *object);
static gchar * gdk_app_launch_context_get_display (GAppLaunchContext *context,
static gchar * gdk_app_launch_context_get_display_name (GAppLaunchContext *context,
GAppInfo *info,
GList *files);
static gchar * gdk_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
@ -125,7 +125,7 @@ gdk_app_launch_context_class_init (GdkAppLaunchContextClass *klass)
gobject_class->finalize = gdk_app_launch_context_finalize;
context_class->get_display = gdk_app_launch_context_get_display;
context_class->get_display = gdk_app_launch_context_get_display_name;
context_class->get_startup_notify_id = gdk_app_launch_context_get_startup_notify_id;
context_class->launch_failed = gdk_app_launch_context_launch_failed;
@ -158,7 +158,7 @@ gdk_app_launch_context_finalize (GObject *object)
}
static gchar *
gdk_app_launch_context_get_display (GAppLaunchContext *context,
gdk_app_launch_context_get_display_name (GAppLaunchContext *context,
GAppInfo *info,
GList *files)
{
@ -173,6 +173,22 @@ gdk_app_launch_context_get_display (GAppLaunchContext *context,
return g_strdup (gdk_display_get_name (display));
}
/**
* gdk_app_launch_context_get_display:
* @context: a #GdkAppLaunchContext
*
* Gets the #GdkDispolat that @context is for.
*
* Returns: the display of @context
*/
GdkDisplay *
gdk_app_launch_context_get_display (GdkAppLaunchContext *context)
{
g_return_val_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context), NULL);
return context->display;
}
/**
* gdk_app_launch_context_set_desktop:
* @context: a #GdkAppLaunchContext

View File

@ -38,6 +38,9 @@ G_BEGIN_DECLS
GDK_AVAILABLE_IN_ALL
GType gdk_app_launch_context_get_type (void);
GDK_AVAILABLE_IN_ALL
GdkDisplay * gdk_app_launch_context_get_display (GdkAppLaunchContext *context);
GDK_AVAILABLE_IN_ALL
void gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,
gint desktop);
@ -51,6 +54,7 @@ GDK_AVAILABLE_IN_ALL
void gdk_app_launch_context_set_icon_name (GdkAppLaunchContext *context,
const char *icon_name);
G_END_DECLS
#endif /* __GDK_APP_LAUNCH_CONTEXT_H__ */

View File

@ -92,8 +92,7 @@ enum {
PROP_NAME,
PROP_ASSOCIATED_DEVICE,
PROP_TYPE,
PROP_INPUT_SOURCE,
PROP_INPUT_MODE,
PROP_SOURCE,
PROP_HAS_CURSOR,
PROP_N_AXES,
PROP_VENDOR_ID,
@ -169,12 +168,12 @@ gdk_device_class_init (GdkDeviceClass *klass)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkDevice:input-source:
* GdkDevice:source:
*
* Source type for the device.
*/
device_props[PROP_INPUT_SOURCE] =
g_param_spec_enum ("input-source",
device_props[PROP_SOURCE] =
g_param_spec_enum ("source",
P_("Input source"),
P_("Source type for the device"),
GDK_TYPE_INPUT_SOURCE,
@ -182,19 +181,6 @@ gdk_device_class_init (GdkDeviceClass *klass)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
/*
* GdkDevice:input-mode:
*
* Input mode for the device.
*/
device_props[PROP_INPUT_MODE] =
g_param_spec_enum ("input-mode",
P_("Input mode for the device"),
P_("Input mode for the device"),
GDK_TYPE_INPUT_MODE,
GDK_MODE_DISABLED,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDevice:has-cursor:
*
@ -414,12 +400,9 @@ gdk_device_set_property (GObject *object,
case PROP_TYPE:
device->type = g_value_get_enum (value);
break;
case PROP_INPUT_SOURCE:
case PROP_SOURCE:
device->source = g_value_get_enum (value);
break;
case PROP_INPUT_MODE:
gdk_device_set_mode (device, g_value_get_enum (value));
break;
case PROP_HAS_CURSOR:
device->has_cursor = g_value_get_boolean (value);
break;
@ -463,12 +446,9 @@ gdk_device_get_property (GObject *object,
case PROP_TYPE:
g_value_set_enum (value, device->type);
break;
case PROP_INPUT_SOURCE:
case PROP_SOURCE:
g_value_set_enum (value, device->source);
break;
case PROP_INPUT_MODE:
g_value_set_enum (value, device->mode);
break;
case PROP_HAS_CURSOR:
g_value_set_boolean (value, device->has_cursor);
break;
@ -519,7 +499,7 @@ gdk_device_get_state (GdkDevice *device,
GdkModifierType *mask)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
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_SLAVE ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
@ -542,7 +522,7 @@ gdk_device_get_position (GdkDevice *device,
double *y)
{
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
g_return_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device));
@ -577,7 +557,7 @@ gdk_device_get_surface_at_position (GdkDevice *device,
GdkSurface *surface;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_SLAVE ||
gdk_display_device_is_grabbed (gdk_device_get_display (device), device), NULL);
@ -626,7 +606,7 @@ gdk_device_get_history (GdkDevice *device,
gint *n_events)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, FALSE);
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
if (n_events)
@ -727,56 +707,6 @@ gdk_device_get_source (GdkDevice *device)
return device->source;
}
/**
* gdk_device_get_mode:
* @device: a #GdkDevice
*
* Determines the mode of the device.
*
* Returns: a #GdkInputMode
**/
GdkInputMode
gdk_device_get_mode (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->mode;
}
/**
* gdk_device_set_mode:
* @device: a #GdkDevice.
* @mode: the input mode.
*
* Sets a the mode of an input device. The mode controls if the
* device is active and whether the devices range is mapped to the
* entire screen or to a single surface.
*
* Note: This is only meaningful for floating devices, master devices (and
* slaves connected to these) drive the pointer cursor, which is not limited
* by the input mode.
*
* Returns: %TRUE if the mode was successfully changed.
**/
gboolean
gdk_device_set_mode (GdkDevice *device,
GdkInputMode mode)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
if (device->mode == mode)
return TRUE;
if (mode == GDK_MODE_DISABLED &&
gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
return FALSE;
device->mode = mode;
g_object_notify_by_pspec (G_OBJECT (device), device_props[PROP_INPUT_MODE]);
return TRUE;
}
/**
* gdk_device_get_n_keys:
* @device: a #GdkDevice
@ -866,7 +796,7 @@ gdk_device_get_axis_use (GdkDevice *device,
GdkAxisInfo *info;
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, GDK_AXIS_IGNORE);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, GDK_AXIS_IGNORE);
g_return_val_if_fail (index_ < device->axes->len, GDK_AXIS_IGNORE);
info = &g_array_index (device->axes, GdkAxisInfo, index_);
@ -890,7 +820,7 @@ gdk_device_set_axis_use (GdkDevice *device,
GdkAxisInfo *info;
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
g_return_if_fail (device->source != GDK_SOURCE_KEYBOARD);
g_return_if_fail (index_ < device->axes->len);
info = &g_array_index (device->axes, GdkAxisInfo, index_);
@ -1075,7 +1005,7 @@ gint
gdk_device_get_n_axes (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, 0);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, 0);
return device->axes->len;
}
@ -1098,7 +1028,7 @@ gdk_device_get_axis_names (GdkDevice *device)
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
if (device->axes->len == 0)
return NULL;
@ -1140,7 +1070,7 @@ gdk_device_get_axis_value (GdkDevice *device,
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, FALSE);
if (axes == NULL)
return FALSE;
@ -1184,7 +1114,7 @@ gdk_device_get_axis (GdkDevice *device,
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, FALSE);
if (axes == NULL)
return FALSE;
@ -1506,9 +1436,6 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
GdkAxisInfo axis_info;
gdouble axis_width, scale, offset;
if (device->mode != GDK_MODE_SCREEN)
return FALSE;
if (index_ >= device->axes->len)
return FALSE;
@ -1626,7 +1553,7 @@ gdk_device_get_last_event_surface (GdkDevice *device)
GdkPointerSurfaceInfo *info;
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
g_return_val_if_fail (device->source != GDK_SOURCE_KEYBOARD, NULL);
display = gdk_device_get_display (device);
info = _gdk_display_get_pointer_info (display, device);
@ -1754,8 +1681,18 @@ gdk_device_update_tool (GdkDevice *device,
}
}
GdkInputMode
gdk_device_get_input_mode (GdkDevice *device)
guint
gdk_device_get_num_touches (GdkDevice *device)
{
return device->mode;
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
return device->num_touches;
}
GdkDeviceTool *
gdk_device_get_device_tool (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
return device->last_tool;
}

View File

@ -24,6 +24,7 @@
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevicetool.h>
G_BEGIN_DECLS
@ -68,25 +69,6 @@ typedef enum
GDK_SOURCE_TABLET_PAD
} GdkInputSource;
/**
* GdkInputMode:
* @GDK_MODE_DISABLED: the device is disabled and will not report any events.
* @GDK_MODE_SCREEN: the device is enabled. The devices coordinate space
* maps to the entire screen.
* @GDK_MODE_SURFACE: the device is enabled. The devices coordinate space
* is mapped to a single surface. The manner in which this surface
* is chosen is undefined, but it will typically be the same
* way in which the focus surface for key events is determined.
*
* An enumeration that describes the mode of an input device.
*/
typedef enum
{
GDK_MODE_DISABLED,
GDK_MODE_SCREEN,
GDK_MODE_SURFACE
} GdkInputMode;
/**
* GdkDeviceType:
* @GDK_DEVICE_TYPE_MASTER: Device is a master (or virtual) device. There will
@ -133,12 +115,6 @@ gboolean gdk_device_get_has_cursor (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkInputSource gdk_device_get_source (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkInputMode gdk_device_get_mode (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_set_mode (GdkDevice *device,
GdkInputMode mode);
GDK_AVAILABLE_IN_ALL
gint gdk_device_get_n_keys (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
@ -221,6 +197,12 @@ 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);
GDK_AVAILABLE_IN_ALL
GdkDeviceTool * gdk_device_get_device_tool (GdkDevice *device);
G_END_DECLS
#endif /* __GDK_DEVICE_H__ */

View File

@ -44,7 +44,6 @@ struct _GdkDevice
gchar *name;
GdkInputSource source;
GdkInputMode mode;
gboolean has_cursor;
gint num_keys;
GdkAxisFlags axis_flags;
@ -180,8 +179,6 @@ void gdk_device_set_seat (GdkDevice *device,
void gdk_device_update_tool (GdkDevice *device,
GdkDeviceTool *tool);
GdkInputMode gdk_device_get_input_mode (GdkDevice *device);
G_END_DECLS
#endif /* __GDK_DEVICE_PRIVATE_H__ */

View File

@ -214,6 +214,42 @@ gdk_drag_get_device (GdkDrag *drag)
return priv->device;
}
/**
* gdk_drag_get_content:
* @drag: a #GdkDrag
*
* Returns the #GdkContentProvider associated to the GdkDrag object.
*
* Returns: (transfer none): The #GdkContentProvider associated to @drag.
**/
GdkContentProvider *
gdk_drag_get_content (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->content;
}
/**
* gdk_drag_get_surface:
* @drag: a #GdkDrag
*
* Returns the #GdkSurface where the drag originates.
*
* Returns: (transfer none): The #GdkSurface where the drag originates
**/
GdkSurface *
gdk_drag_get_surface (GdkDrag *drag)
{
GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
return priv->surface;
}
static void
gdk_drag_init (GdkDrag *drag)
{

View File

@ -91,6 +91,13 @@ void gdk_drag_set_hotspot (GdkDrag *drag,
gint hot_x,
gint hot_y);
GDK_AVAILABLE_IN_ALL
GdkContentProvider *
gdk_drag_get_content (GdkDrag *drag);
GDK_AVAILABLE_IN_ALL
GdkSurface * gdk_drag_get_surface (GdkDrag *drag);
G_END_DECLS
#endif /* __GDK_DND_H__ */

View File

@ -2695,12 +2695,9 @@ _gdk_windowing_got_event (GdkDisplay *display,
_gdk_display_device_grab_update (display, device, source_device, serial);
if (gdk_device_get_input_mode (device) == GDK_MODE_DISABLED ||
!_gdk_display_check_grab_ownership (display, device, serial))
if (!_gdk_display_check_grab_ownership (display, device, serial))
{
/* Device events are blocked by another
* device grab, or the device is disabled
*/
/* Device events are blocked by another device grab */
unlink_event = TRUE;
goto out;
}
@ -4186,3 +4183,20 @@ gdk_surface_translate_coordinates (GdkSurface *from,
return TRUE;
}
/**
* gdk_surface_get_autohide:
* @surface: a #GdkSurface
*
* Returns whether this surface is set to hide on outside clicks.
*
* Returns: %TRUE if @surface will autohide
*/
gboolean
gdk_surface_get_autohide (GdkSurface *surface)
{
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
return surface->autohide;
}

View File

@ -408,6 +408,9 @@ gboolean gdk_surface_is_visible (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_is_viewable (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
gboolean gdk_surface_get_autohide (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkSurfaceState gdk_surface_get_state (GdkSurface *surface);

View File

@ -2780,8 +2780,7 @@ tablet_handle_done (void *data,
master = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", master_name,
"type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_MOUSE,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", display,
"seat", seat,
@ -2793,8 +2792,7 @@ tablet_handle_done (void *data,
stylus_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", tablet->name,
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_PEN,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_PEN,
"has-cursor", FALSE,
"display", display,
"seat", seat,
@ -2805,8 +2803,7 @@ tablet_handle_done (void *data,
eraser_device = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", eraser_name,
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_ERASER,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_ERASER,
"has-cursor", FALSE,
"display", display,
"seat", seat,
@ -2915,8 +2912,7 @@ seat_handle_capabilities (void *data,
seat->pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Pointer",
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_MOUSE,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@ -2986,8 +2982,7 @@ seat_handle_capabilities (void *data,
seat->keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Keyboard",
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_KEYBOARD,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
"seat", seat,
@ -3015,8 +3010,7 @@ seat_handle_capabilities (void *data,
seat->touch_master = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch Master Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_MOUSE,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@ -3028,8 +3022,7 @@ seat_handle_capabilities (void *data,
seat->touch = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Touch",
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_TOUCHSCREEN,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_TOUCHSCREEN,
"has-cursor", FALSE,
"display", seat->display,
"seat", seat,
@ -3066,8 +3059,7 @@ get_scroll_device (GdkWaylandSeat *seat,
seat->wheel_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Wheel Scrolling",
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_MOUSE,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@ -3083,8 +3075,7 @@ get_scroll_device (GdkWaylandSeat *seat,
seat->finger_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Finger Scrolling",
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_TOUCHPAD,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_TOUCHPAD,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@ -3100,8 +3091,7 @@ get_scroll_device (GdkWaylandSeat *seat,
seat->continuous_scrolling = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Wayland Continuous Scrolling",
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_TRACKPOINT,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_TRACKPOINT,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@ -4102,8 +4092,7 @@ tablet_pad_handle_done (void *data,
g_object_new (GDK_TYPE_WAYLAND_DEVICE_PAD,
"name", "Pad device",
"type", GDK_DEVICE_TYPE_SLAVE,
"input-source", GDK_SOURCE_TABLET_PAD,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_TABLET_PAD,
"display", gdk_seat_get_display (pad->seat),
"seat", pad->seat,
NULL);
@ -4281,8 +4270,7 @@ init_devices (GdkWaylandSeat *seat)
seat->master_pointer = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_MOUSE,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_MOUSE,
"has-cursor", TRUE,
"display", seat->display,
"seat", seat,
@ -4294,8 +4282,7 @@ init_devices (GdkWaylandSeat *seat)
seat->master_keyboard = g_object_new (GDK_TYPE_WAYLAND_DEVICE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_KEYBOARD,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", seat->display,
"seat", seat,

View File

@ -233,11 +233,6 @@ _gdk_device_wintab_translate_axes (GdkDeviceWintab *device_wintab,
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
_gdk_device_translate_surface_coord (device, window, i,
device_wintab->last_axis_data[i],
&axes[i]);
else
{
HMONITOR hmonitor;
MONITORINFO minfo = {sizeof (MONITORINFO),};

View File

@ -79,8 +79,7 @@ create_pointer (GdkDeviceManagerWin32 *device_manager,
return g_object_new (g_type,
"name", name,
"type", type,
"input-source", GDK_SOURCE_MOUSE,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_MOUSE,
"has-cursor", type == GDK_DEVICE_TYPE_MASTER,
"display", _gdk_display,
NULL);
@ -95,8 +94,7 @@ create_keyboard (GdkDeviceManagerWin32 *device_manager,
return g_object_new (g_type,
"name", name,
"type", type,
"input-source", GDK_SOURCE_KEYBOARD,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_KEYBOARD,
"has-cursor", FALSE,
"display", _gdk_display,
NULL);
@ -558,8 +556,7 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
device = g_object_new (GDK_TYPE_DEVICE_WINTAB,
"name", device_name,
"type", GDK_DEVICE_TYPE_FLOATING,
"input-source", GDK_SOURCE_PEN,
"input-mode", GDK_MODE_SCREEN,
"source", GDK_SOURCE_PEN,
"has-cursor", lc.lcOptions & CXO_SYSTEM,
"display", display,
NULL);
@ -940,8 +937,7 @@ gdk_input_other_event (GdkDisplay *display,
device_manager->dev_entered_proximity -= 1;
if (source_device != NULL &&
source_device->sends_core &&
gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED)
source_device->sends_core)
{
_gdk_device_virtual_set_active (device_manager->core_pointer,
GDK_DEVICE (source_device));
@ -950,7 +946,6 @@ gdk_input_other_event (GdkDisplay *display,
}
else if (source_device != NULL &&
source_device->sends_core &&
gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED &&
_gdk_input_ignore_core == 0)
{
/* A fallback for cases when two devices (disabled and enabled)
@ -970,8 +965,7 @@ gdk_input_other_event (GdkDisplay *display,
_gdk_input_ignore_core += 1;
}
if (source_device == NULL ||
gdk_device_get_mode (GDK_DEVICE (source_device)) == GDK_MODE_DISABLED)
if (source_device == NULL)
return NULL;
/* Don't produce any button or motion events while a window is being
@ -1127,8 +1121,7 @@ gdk_input_other_event (GdkDisplay *display,
packet.pkCursor)) == NULL)
return NULL;
if (source_device->sends_core &&
gdk_device_get_mode (GDK_DEVICE (source_device)) != GDK_MODE_DISABLED)
if (source_device->sends_core)
{
_gdk_device_virtual_set_active (device_manager->core_pointer,
GDK_DEVICE (source_device));

View File

@ -230,9 +230,6 @@ gdk_x11_device_xi2_get_state (GdkDevice *device,
case GDK_AXIS_X:
case GDK_AXIS_Y:
case GDK_AXIS_IGNORE:
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
_gdk_device_translate_surface_coord (device, surface, j, value, &axes[j]);
else
{
gint root_x, root_y;

View File

@ -473,7 +473,6 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
GdkInputSource touch_source;
GdkDeviceType type;
GdkDevice *device;
GdkInputMode mode;
gint num_touches = 0;
gchar *vendor_id = NULL, *product_id = NULL;
@ -520,17 +519,14 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
case XIMasterKeyboard:
case XIMasterPointer:
type = GDK_DEVICE_TYPE_MASTER;
mode = GDK_MODE_SCREEN;
break;
case XISlaveKeyboard:
case XISlavePointer:
type = GDK_DEVICE_TYPE_SLAVE;
mode = GDK_MODE_DISABLED;
break;
case XIFloatingSlave:
default:
type = GDK_DEVICE_TYPE_FLOATING;
mode = GDK_MODE_DISABLED;
break;
}
@ -538,12 +534,10 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
({
const gchar *type_names[] = { "master", "slave", "floating" };
const gchar *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct touch", "indirect touch", "trackpoint", "pad" };
const gchar *mode_names[] = { "disabled", "screen", "window" };
g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\tmode: %s\n\thas cursor: %d\n\ttouches: %d",
g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\thas cursor: %d\n\ttouches: %d",
dev->name,
type_names[type],
source_names[input_source],
mode_names[mode],
dev->use == XIMasterPointer,
num_touches);
}));
@ -555,8 +549,7 @@ create_device (GdkX11DeviceManagerXI2 *device_manager,
device = g_object_new (GDK_TYPE_X11_DEVICE_XI2,
"name", dev->name,
"type", type,
"input-source", input_source,
"input-mode", mode,
"source", input_source,
"has-cursor", (dev->use == XIMasterPointer),
"display", display,
"device-id", dev->deviceid,
@ -1228,9 +1221,6 @@ translate_axes (GdkDevice *device,
{
case GDK_AXIS_X:
case GDK_AXIS_Y:
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
_gdk_device_translate_surface_coord (device, surface, i, val, &axes[i]);
else
{
if (use == GDK_AXIS_X)
axes[i] = x;
@ -1661,17 +1651,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
surface,
&xev->valuators);
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
{
/* Update event coordinates from axes */
gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
}
else
{
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
}
event = gdk_event_button_new (ev->evtype == XI_ButtonPress
? GDK_BUTTON_PRESS
@ -1746,17 +1727,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
surface,
&xev->valuators);
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
{
/* Update event coordinates from axes */
gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
}
else
{
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
}
event = gdk_event_motion_new (surface,
device,
@ -1803,17 +1775,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
surface,
&xev->valuators);
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
{
/* Update event coordinates from axes */
gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
}
else
{
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
}
event = gdk_event_touch_new (ev->evtype == XI_TouchBegin
? GDK_TOUCH_BEGIN
: GDK_TOUCH_END,
@ -1861,17 +1825,8 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
surface,
&xev->valuators);
if (gdk_device_get_mode (device) == GDK_MODE_SURFACE)
{
/* Update event coordinates from axes */
gdk_device_get_axis (device, axes, GDK_AXIS_X, &x);
gdk_device_get_axis (device, axes, GDK_AXIS_Y, &y);
}
else
{
x = (double) xev->event_x / scale;
y = (double) xev->event_y / scale;
}
event = gdk_event_touch_new (GDK_TOUCH_UPDATE,
GUINT_TO_POINTER (xev->detail),