mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-12 11:50:21 +00:00
GdkDeviceTool: Add GdkAxisFlags info to tablet tools
Different tools may have different sets of axes, we should store that info somewhere.
This commit is contained in:
parent
8b2fd3ed1b
commit
9e72d24b23
@ -2031,6 +2031,7 @@ enum {
|
||||
TOOL_PROP_0,
|
||||
TOOL_PROP_SERIAL,
|
||||
TOOL_PROP_TOOL_TYPE,
|
||||
TOOL_PROP_AXES,
|
||||
N_TOOL_PROPS
|
||||
};
|
||||
|
||||
@ -2052,6 +2053,9 @@ gdk_device_tool_set_property (GObject *object,
|
||||
case TOOL_PROP_TOOL_TYPE:
|
||||
tool->type = g_value_get_enum (value);
|
||||
break;
|
||||
case TOOL_PROP_AXES:
|
||||
tool->tool_axes = g_value_get_flags (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -2074,6 +2078,9 @@ gdk_device_tool_get_property (GObject *object,
|
||||
case TOOL_PROP_TOOL_TYPE:
|
||||
g_value_set_enum (value, tool->type);
|
||||
break;
|
||||
case TOOL_PROP_AXES:
|
||||
g_value_set_flags (value, tool->tool_axes);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -2101,6 +2108,12 @@ gdk_device_tool_class_init (GdkDeviceToolClass *klass)
|
||||
GDK_DEVICE_TOOL_TYPE_UNKNOWN,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
tool_props[TOOL_PROP_AXES] = g_param_spec_flags ("axes",
|
||||
"Axes",
|
||||
"Tool axes",
|
||||
GDK_TYPE_AXIS_FLAGS, 0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
|
||||
g_object_class_install_properties (object_class, N_TOOL_PROPS, tool_props);
|
||||
}
|
||||
@ -2112,11 +2125,13 @@ gdk_device_tool_init (GdkDeviceTool *tool)
|
||||
|
||||
GdkDeviceTool *
|
||||
gdk_device_tool_new (guint64 serial,
|
||||
GdkDeviceToolType type)
|
||||
GdkDeviceToolType type,
|
||||
GdkAxisFlags tool_axes)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_DEVICE_TOOL,
|
||||
"serial", serial,
|
||||
"tool-type", type,
|
||||
"axes", tool_axes,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ struct _GdkDeviceTool
|
||||
GObject parent_instance;
|
||||
guint64 serial;
|
||||
GdkDeviceToolType type;
|
||||
GdkAxisFlags tool_axes;
|
||||
};
|
||||
|
||||
struct _GdkDeviceToolClass
|
||||
@ -200,7 +201,8 @@ void gdk_device_set_seat (GdkDevice *device,
|
||||
|
||||
/* Device tools */
|
||||
GdkDeviceTool *gdk_device_tool_new (guint64 serial,
|
||||
GdkDeviceToolType type);
|
||||
GdkDeviceToolType type,
|
||||
GdkAxisFlags tool_axes);
|
||||
void gdk_device_update_tool (GdkDevice *device,
|
||||
GdkDeviceTool *tool);
|
||||
|
||||
|
@ -1023,7 +1023,7 @@ handle_property_change (GdkX11DeviceManagerXI2 *device_manager,
|
||||
if (!tool && serial_id > 0)
|
||||
{
|
||||
tool = gdk_device_tool_new (serial_id,
|
||||
GDK_DEVICE_TOOL_TYPE_UNKNOWN);
|
||||
GDK_DEVICE_TOOL_TYPE_UNKNOWN, 0);
|
||||
gdk_seat_default_add_tool (GDK_SEAT_DEFAULT (seat), tool);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user