mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
Move GdkDeviceTool into its own files
This commit is contained in:
parent
6db7de3f7b
commit
9044f78751
@ -66,6 +66,7 @@ gdk_public_h_sources = \
|
||||
gdkcairo.h \
|
||||
gdkcursor.h \
|
||||
gdkdevice.h \
|
||||
gdkdevicetool.h \
|
||||
gdkdevicemanager.h \
|
||||
gdkdisplay.h \
|
||||
gdkdisplaymanager.h \
|
||||
@ -106,6 +107,7 @@ gdk_private_headers = \
|
||||
gdkcursorprivate.h \
|
||||
gdkdevicemanagerprivate.h \
|
||||
gdkdeviceprivate.h \
|
||||
gdkdevicetoolprivate.h \
|
||||
gdkdisplaymanagerprivate.h \
|
||||
gdkdisplayprivate.h \
|
||||
gdkdndprivate.h \
|
||||
@ -133,6 +135,7 @@ gdk_c_sources = \
|
||||
gdkcursor.c \
|
||||
gdkdeprecated.c \
|
||||
gdkdevice.c \
|
||||
gdkdevicetool.c \
|
||||
gdkdevicemanager.c \
|
||||
gdkdisplay.c \
|
||||
gdkdisplaymanager.c \
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <gdk/gdkcairo.h>
|
||||
#include <gdk/gdkcursor.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
#include <gdk/gdkdevicemanager.h>
|
||||
#include <gdk/gdkdisplay.h>
|
||||
#include <gdk/gdkdisplaymanager.h>
|
||||
|
149
gdk/gdkdevice.c
149
gdk/gdkdevice.c
@ -20,6 +20,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevicetool.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
@ -2025,116 +2026,6 @@ gdk_device_get_axes (GdkDevice *device)
|
||||
return device->axis_flags;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GdkDeviceTool, gdk_device_tool, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
TOOL_PROP_0,
|
||||
TOOL_PROP_SERIAL,
|
||||
TOOL_PROP_TOOL_TYPE,
|
||||
TOOL_PROP_AXES,
|
||||
N_TOOL_PROPS
|
||||
};
|
||||
|
||||
GParamSpec *tool_props[N_TOOL_PROPS] = { 0 };
|
||||
|
||||
static void
|
||||
gdk_device_tool_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDeviceTool *tool = GDK_DEVICE_TOOL (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case TOOL_PROP_SERIAL:
|
||||
tool->serial = g_value_get_uint64 (value);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_tool_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDeviceTool *tool = GDK_DEVICE_TOOL (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case TOOL_PROP_SERIAL:
|
||||
g_value_set_uint64 (value, tool->serial);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_tool_class_init (GdkDeviceToolClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = gdk_device_tool_set_property;
|
||||
object_class->get_property = gdk_device_tool_get_property;
|
||||
|
||||
tool_props[TOOL_PROP_SERIAL] = g_param_spec_uint64 ("serial",
|
||||
"Serial",
|
||||
"Serial number",
|
||||
0, G_MAXUINT64, 0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
tool_props[TOOL_PROP_TOOL_TYPE] = g_param_spec_enum ("tool-type",
|
||||
"Tool type",
|
||||
"Tool type",
|
||||
GDK_TYPE_DEVICE_TOOL_TYPE,
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_tool_init (GdkDeviceTool *tool)
|
||||
{
|
||||
}
|
||||
|
||||
GdkDeviceTool *
|
||||
gdk_device_tool_new (guint64 serial,
|
||||
GdkDeviceToolType type,
|
||||
GdkAxisFlags tool_axes)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_DEVICE_TOOL,
|
||||
"serial", serial,
|
||||
"tool-type", type,
|
||||
"axes", tool_axes,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_device_update_tool (GdkDevice *device,
|
||||
GdkDeviceTool *tool)
|
||||
@ -2145,41 +2036,3 @@ gdk_device_update_tool (GdkDevice *device,
|
||||
if (g_set_object (&device->last_tool, tool))
|
||||
g_signal_emit (device, signals[TOOL_CHANGED], 0, tool);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_tool_get_serial:
|
||||
* @tool: a #GdkDeviceTool
|
||||
*
|
||||
* Gets the serial of this tool, this value can be used to identify a
|
||||
* physical tool (eg. a tablet pen) across program executions.
|
||||
*
|
||||
* Returns: The serial ID for this tool
|
||||
*
|
||||
* Since: 3.22
|
||||
**/
|
||||
guint
|
||||
gdk_device_tool_get_serial (GdkDeviceTool *tool)
|
||||
{
|
||||
g_return_val_if_fail (tool != NULL, 0);
|
||||
|
||||
return tool->serial;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_tool_get_tool_type:
|
||||
* @tool: a #GdkDeviceTool
|
||||
*
|
||||
* Gets the #GdkDeviceToolType of the tool.
|
||||
*
|
||||
* Returns: The physical type for this tool. This can be used to figure out what
|
||||
* sort of pen is being used, such as an airbrush or a pencil.
|
||||
*
|
||||
* Since: 3.22
|
||||
**/
|
||||
GdkDeviceToolType
|
||||
gdk_device_tool_get_tool_type (GdkDeviceTool *tool)
|
||||
{
|
||||
g_return_val_if_fail (tool != NULL, GDK_DEVICE_TOOL_TYPE_UNKNOWN);
|
||||
|
||||
return tool->type;
|
||||
}
|
||||
|
103
gdk/gdkdevice.h
103
gdk/gdkdevice.h
@ -32,12 +32,7 @@ G_BEGIN_DECLS
|
||||
#define GDK_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE, GdkDevice))
|
||||
#define GDK_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE))
|
||||
|
||||
#define GDK_TYPE_DEVICE_TOOL (gdk_device_tool_get_type ())
|
||||
#define GDK_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_TOOL, GdkDeviceTool))
|
||||
#define GDK_IS_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_TOOL))
|
||||
|
||||
typedef struct _GdkTimeCoord GdkTimeCoord;
|
||||
typedef struct _GdkDeviceTool GdkDeviceTool;
|
||||
|
||||
/**
|
||||
* GdkInputSource:
|
||||
@ -85,68 +80,6 @@ typedef enum
|
||||
GDK_MODE_WINDOW
|
||||
} GdkInputMode;
|
||||
|
||||
/**
|
||||
* GdkAxisUse:
|
||||
* @GDK_AXIS_IGNORE: the axis is ignored.
|
||||
* @GDK_AXIS_X: the axis is used as the x axis.
|
||||
* @GDK_AXIS_Y: the axis is used as the y axis.
|
||||
* @GDK_AXIS_PRESSURE: the axis is used for pressure information.
|
||||
* @GDK_AXIS_XTILT: the axis is used for x tilt information.
|
||||
* @GDK_AXIS_YTILT: the axis is used for y tilt information.
|
||||
* @GDK_AXIS_WHEEL: the axis is used for wheel information.
|
||||
* @GDK_AXIS_DISTANCE: the axis is used for pen/tablet distance information. (Since: 3.22)
|
||||
* @GDK_AXIS_ROTATION: the axis is used for pen rotation information. (Since: 3.22)
|
||||
* @GDK_AXIS_SLIDER: the axis is used for pen slider information. (Since: 3.22)
|
||||
* @GDK_AXIS_LAST: a constant equal to the numerically highest axis value.
|
||||
*
|
||||
* An enumeration describing the way in which a device
|
||||
* axis (valuator) maps onto the predefined valuator
|
||||
* types that GTK+ understands.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_AXIS_IGNORE,
|
||||
GDK_AXIS_X,
|
||||
GDK_AXIS_Y,
|
||||
GDK_AXIS_PRESSURE,
|
||||
GDK_AXIS_XTILT,
|
||||
GDK_AXIS_YTILT,
|
||||
GDK_AXIS_WHEEL,
|
||||
GDK_AXIS_DISTANCE,
|
||||
GDK_AXIS_ROTATION,
|
||||
GDK_AXIS_SLIDER,
|
||||
GDK_AXIS_LAST
|
||||
} GdkAxisUse;
|
||||
|
||||
/**
|
||||
* GdkAxisFlags:
|
||||
* @GDK_AXIS_FLAG_X: X axis is present
|
||||
* @GDK_AXIS_FLAG_Y: Y axis is present
|
||||
* @GDK_AXIS_FLAG_PRESSURE: Pressure axis is present
|
||||
* @GDK_AXIS_FLAG_XTILT: X tilt axis is present
|
||||
* @GDK_AXIS_FLAG_YTILT: Y tilt axis is present
|
||||
* @GDK_AXIS_FLAG_WHEEL: Wheel axis is present
|
||||
* @GDK_AXIS_FLAG_DISTANCE: Distance axis is present
|
||||
* @GDK_AXIS_FLAG_ROTATION: Z-axis rotation is present
|
||||
* @GDK_AXIS_FLAG_SLIDER: Slider axis is present
|
||||
*
|
||||
* Flags describing the current capabilities of a device/tool.
|
||||
*
|
||||
* Since: 3.22
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_AXIS_FLAG_X = 1 << GDK_AXIS_X,
|
||||
GDK_AXIS_FLAG_Y = 1 << GDK_AXIS_Y,
|
||||
GDK_AXIS_FLAG_PRESSURE = 1 << GDK_AXIS_PRESSURE,
|
||||
GDK_AXIS_FLAG_XTILT = 1 << GDK_AXIS_XTILT,
|
||||
GDK_AXIS_FLAG_YTILT = 1 << GDK_AXIS_YTILT,
|
||||
GDK_AXIS_FLAG_WHEEL = 1 << GDK_AXIS_WHEEL,
|
||||
GDK_AXIS_FLAG_DISTANCE = 1 << GDK_AXIS_DISTANCE,
|
||||
GDK_AXIS_FLAG_ROTATION = 1 << GDK_AXIS_ROTATION,
|
||||
GDK_AXIS_FLAG_SLIDER = 1 << GDK_AXIS_SLIDER,
|
||||
} GdkAxisFlags;
|
||||
|
||||
/**
|
||||
* GdkDeviceType:
|
||||
* @GDK_DEVICE_TYPE_MASTER: Device is a master (or virtual) device. There will
|
||||
@ -164,33 +97,6 @@ typedef enum {
|
||||
GDK_DEVICE_TYPE_FLOATING
|
||||
} GdkDeviceType;
|
||||
|
||||
/**
|
||||
* GdkDeviceToolType:
|
||||
* @GDK_DEVICE_TOOL_TYPE_UNKNOWN: Tool is of an unknown type.
|
||||
* @GDK_DEVICE_TOOL_TYPE_PEN: Tool is a standard tablet stylus.
|
||||
* @GDK_DEVICE_TOOL_TYPE_ERASER: Tool is standard tablet eraser.
|
||||
* @GDK_DEVICE_TOOL_TYPE_BRUSH: Tool is a brush stylus.
|
||||
* @GDK_DEVICE_TOOL_TYPE_PENCIL: Tool is a pencil stylus.
|
||||
* @GDK_DEVICE_TOOL_TYPE_AIRBRUSH: Tool is an airbrush stylus.
|
||||
* @GDK_DEVICE_TOOL_TYPE_MOUSE: Tool is a mouse.
|
||||
* @GDK_DEVICE_TOOL_TYPE_LENS: Tool is a lens cursor.
|
||||
*
|
||||
* Indicates the specific type of tool being used being a tablet. Such as an
|
||||
* airbrush, pencil, etc.
|
||||
*
|
||||
* Since: 3.22
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_DEVICE_TOOL_TYPE_UNKNOWN,
|
||||
GDK_DEVICE_TOOL_TYPE_PEN,
|
||||
GDK_DEVICE_TOOL_TYPE_ERASER,
|
||||
GDK_DEVICE_TOOL_TYPE_BRUSH,
|
||||
GDK_DEVICE_TOOL_TYPE_PENCIL,
|
||||
GDK_DEVICE_TOOL_TYPE_AIRBRUSH,
|
||||
GDK_DEVICE_TOOL_TYPE_MOUSE,
|
||||
GDK_DEVICE_TOOL_TYPE_LENS,
|
||||
} GdkDeviceToolType;
|
||||
|
||||
/* We don't allocate each coordinate this big, but we use it to
|
||||
* be ANSI compliant and avoid accessing past the defined limits.
|
||||
*/
|
||||
@ -352,15 +258,6 @@ GdkSeat *gdk_device_get_seat (GdkDevice *device);
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GdkAxisFlags gdk_device_get_axes (GdkDevice *device);
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GType gdk_device_tool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
guint gdk_device_tool_get_serial (GdkDeviceTool *tool);
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GdkDeviceToolType gdk_device_tool_get_tool_type (GdkDeviceTool *tool);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_H__ */
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define __GDK_DEVICE_PRIVATE_H__
|
||||
|
||||
#include "gdkdevice.h"
|
||||
#include "gdkdevicetool.h"
|
||||
#include "gdkdevicemanager.h"
|
||||
#include "gdkevents.h"
|
||||
#include "gdkseat.h"
|
||||
@ -30,22 +31,8 @@ G_BEGIN_DECLS
|
||||
#define GDK_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE, GdkDeviceClass))
|
||||
|
||||
typedef struct _GdkDeviceClass GdkDeviceClass;
|
||||
typedef struct _GdkDeviceToolClass GdkDeviceToolClass;
|
||||
typedef struct _GdkDeviceKey GdkDeviceKey;
|
||||
|
||||
struct _GdkDeviceTool
|
||||
{
|
||||
GObject parent_instance;
|
||||
guint64 serial;
|
||||
GdkDeviceToolType type;
|
||||
GdkAxisFlags tool_axes;
|
||||
};
|
||||
|
||||
struct _GdkDeviceToolClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
struct _GdkDeviceKey
|
||||
{
|
||||
guint keyval;
|
||||
@ -199,10 +186,6 @@ GdkWindow * _gdk_device_window_at_position (GdkDevice *device,
|
||||
void gdk_device_set_seat (GdkDevice *device,
|
||||
GdkSeat *seat);
|
||||
|
||||
/* Device tools */
|
||||
GdkDeviceTool *gdk_device_tool_new (guint64 serial,
|
||||
GdkDeviceToolType type,
|
||||
GdkAxisFlags tool_axes);
|
||||
void gdk_device_update_tool (GdkDevice *device,
|
||||
GdkDeviceTool *tool);
|
||||
|
||||
|
173
gdk/gdkdevicetool.c
Normal file
173
gdk/gdkdevicetool.c
Normal file
@ -0,0 +1,173 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "gdkdevicetoolprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GdkDeviceTool, gdk_device_tool, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
TOOL_PROP_0,
|
||||
TOOL_PROP_SERIAL,
|
||||
TOOL_PROP_TOOL_TYPE,
|
||||
TOOL_PROP_AXES,
|
||||
N_TOOL_PROPS
|
||||
};
|
||||
|
||||
GParamSpec *tool_props[N_TOOL_PROPS] = { 0 };
|
||||
|
||||
static void
|
||||
gdk_device_tool_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDeviceTool *tool = GDK_DEVICE_TOOL (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case TOOL_PROP_SERIAL:
|
||||
tool->serial = g_value_get_uint64 (value);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_tool_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDeviceTool *tool = GDK_DEVICE_TOOL (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case TOOL_PROP_SERIAL:
|
||||
g_value_set_uint64 (value, tool->serial);
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_tool_class_init (GdkDeviceToolClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->set_property = gdk_device_tool_set_property;
|
||||
object_class->get_property = gdk_device_tool_get_property;
|
||||
|
||||
tool_props[TOOL_PROP_SERIAL] = g_param_spec_uint64 ("serial",
|
||||
"Serial",
|
||||
"Serial number",
|
||||
0, G_MAXUINT64, 0,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY);
|
||||
tool_props[TOOL_PROP_TOOL_TYPE] = g_param_spec_enum ("tool-type",
|
||||
"Tool type",
|
||||
"Tool type",
|
||||
GDK_TYPE_DEVICE_TOOL_TYPE,
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_tool_init (GdkDeviceTool *tool)
|
||||
{
|
||||
}
|
||||
|
||||
GdkDeviceTool *
|
||||
gdk_device_tool_new (guint64 serial,
|
||||
GdkDeviceToolType type,
|
||||
GdkAxisFlags tool_axes)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_DEVICE_TOOL,
|
||||
"serial", serial,
|
||||
"tool-type", type,
|
||||
"axes", tool_axes,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_tool_get_serial:
|
||||
* @tool: a #GdkDeviceTool
|
||||
*
|
||||
* Gets the serial of this tool, this value can be used to identify a
|
||||
* physical tool (eg. a tablet pen) across program executions.
|
||||
*
|
||||
* Returns: The serial ID for this tool
|
||||
*
|
||||
* Since: 3.22
|
||||
**/
|
||||
guint
|
||||
gdk_device_tool_get_serial (GdkDeviceTool *tool)
|
||||
{
|
||||
g_return_val_if_fail (tool != NULL, 0);
|
||||
|
||||
return tool->serial;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_device_tool_get_tool_type:
|
||||
* @tool: a #GdkDeviceTool
|
||||
*
|
||||
* Gets the #GdkDeviceToolType of the tool.
|
||||
*
|
||||
* Returns: The physical type for this tool. This can be used to figure out what
|
||||
* sort of pen is being used, such as an airbrush or a pencil.
|
||||
*
|
||||
* Since: 3.22
|
||||
**/
|
||||
GdkDeviceToolType
|
||||
gdk_device_tool_get_tool_type (GdkDeviceTool *tool)
|
||||
{
|
||||
g_return_val_if_fail (tool != NULL, GDK_DEVICE_TOOL_TYPE_UNKNOWN);
|
||||
|
||||
return tool->type;
|
||||
}
|
75
gdk/gdkdevicetool.h
Normal file
75
gdk/gdkdevicetool.h
Normal file
@ -0,0 +1,75 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DEVICE_TOOL_H__
|
||||
#define __GDK_DEVICE_TOOL_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_DEVICE_TOOL (gdk_device_tool_get_type ())
|
||||
#define GDK_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_TOOL, GdkDeviceTool))
|
||||
#define GDK_IS_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_TOOL))
|
||||
|
||||
typedef struct _GdkDeviceTool GdkDeviceTool;
|
||||
|
||||
/**
|
||||
* GdkDeviceToolType:
|
||||
* @GDK_DEVICE_TOOL_TYPE_UNKNOWN: Tool is of an unknown type.
|
||||
* @GDK_DEVICE_TOOL_TYPE_PEN: Tool is a standard tablet stylus.
|
||||
* @GDK_DEVICE_TOOL_TYPE_ERASER: Tool is standard tablet eraser.
|
||||
* @GDK_DEVICE_TOOL_TYPE_BRUSH: Tool is a brush stylus.
|
||||
* @GDK_DEVICE_TOOL_TYPE_PENCIL: Tool is a pencil stylus.
|
||||
* @GDK_DEVICE_TOOL_TYPE_AIRBRUSH: Tool is an airbrush stylus.
|
||||
* @GDK_DEVICE_TOOL_TYPE_MOUSE: Tool is a mouse.
|
||||
* @GDK_DEVICE_TOOL_TYPE_LENS: Tool is a lens cursor.
|
||||
*
|
||||
* Indicates the specific type of tool being used being a tablet. Such as an
|
||||
* airbrush, pencil, etc.
|
||||
*
|
||||
* Since: 3.22
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_DEVICE_TOOL_TYPE_UNKNOWN,
|
||||
GDK_DEVICE_TOOL_TYPE_PEN,
|
||||
GDK_DEVICE_TOOL_TYPE_ERASER,
|
||||
GDK_DEVICE_TOOL_TYPE_BRUSH,
|
||||
GDK_DEVICE_TOOL_TYPE_PENCIL,
|
||||
GDK_DEVICE_TOOL_TYPE_AIRBRUSH,
|
||||
GDK_DEVICE_TOOL_TYPE_MOUSE,
|
||||
GDK_DEVICE_TOOL_TYPE_LENS,
|
||||
} GdkDeviceToolType;
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GType gdk_device_tool_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
guint gdk_device_tool_get_serial (GdkDeviceTool *tool);
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GdkDeviceToolType gdk_device_tool_get_tool_type (GdkDeviceTool *tool);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_TOOL_H__ */
|
46
gdk/gdkdevicetoolprivate.h
Normal file
46
gdk/gdkdevicetoolprivate.h
Normal file
@ -0,0 +1,46 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2009 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DEVICE_TOOL_PRIVATE_H__
|
||||
#define __GDK_DEVICE_TOOL_PRIVATE_H__
|
||||
|
||||
#include "gdkdevicetool.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkDeviceToolClass GdkDeviceToolClass;
|
||||
|
||||
struct _GdkDeviceTool
|
||||
{
|
||||
GObject parent_instance;
|
||||
guint64 serial;
|
||||
GdkDeviceToolType type;
|
||||
GdkAxisFlags tool_axes;
|
||||
};
|
||||
|
||||
struct _GdkDeviceToolClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GdkDeviceTool *gdk_device_tool_new (guint64 serial,
|
||||
GdkDeviceToolType type,
|
||||
GdkAxisFlags tool_axes);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DEVICE_TOOL_PRIVATE_H__ */
|
@ -33,6 +33,7 @@
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdnd.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "gdkseatdefaultprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevicetoolprivate.h"
|
||||
|
||||
typedef struct _GdkSeatDefaultPrivate GdkSeatDefaultPrivate;
|
||||
|
||||
|
@ -529,6 +529,68 @@ typedef enum
|
||||
GDK_WINDOW_TYPE_HINT_DND
|
||||
} GdkWindowTypeHint;
|
||||
|
||||
/**
|
||||
* GdkAxisUse:
|
||||
* @GDK_AXIS_IGNORE: the axis is ignored.
|
||||
* @GDK_AXIS_X: the axis is used as the x axis.
|
||||
* @GDK_AXIS_Y: the axis is used as the y axis.
|
||||
* @GDK_AXIS_PRESSURE: the axis is used for pressure information.
|
||||
* @GDK_AXIS_XTILT: the axis is used for x tilt information.
|
||||
* @GDK_AXIS_YTILT: the axis is used for y tilt information.
|
||||
* @GDK_AXIS_WHEEL: the axis is used for wheel information.
|
||||
* @GDK_AXIS_DISTANCE: the axis is used for pen/tablet distance information. (Since: 3.22)
|
||||
* @GDK_AXIS_ROTATION: the axis is used for pen rotation information. (Since: 3.22)
|
||||
* @GDK_AXIS_SLIDER: the axis is used for pen slider information. (Since: 3.22)
|
||||
* @GDK_AXIS_LAST: a constant equal to the numerically highest axis value.
|
||||
*
|
||||
* An enumeration describing the way in which a device
|
||||
* axis (valuator) maps onto the predefined valuator
|
||||
* types that GTK+ understands.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_AXIS_IGNORE,
|
||||
GDK_AXIS_X,
|
||||
GDK_AXIS_Y,
|
||||
GDK_AXIS_PRESSURE,
|
||||
GDK_AXIS_XTILT,
|
||||
GDK_AXIS_YTILT,
|
||||
GDK_AXIS_WHEEL,
|
||||
GDK_AXIS_DISTANCE,
|
||||
GDK_AXIS_ROTATION,
|
||||
GDK_AXIS_SLIDER,
|
||||
GDK_AXIS_LAST
|
||||
} GdkAxisUse;
|
||||
|
||||
/**
|
||||
* GdkAxisFlags:
|
||||
* @GDK_AXIS_FLAG_X: X axis is present
|
||||
* @GDK_AXIS_FLAG_Y: Y axis is present
|
||||
* @GDK_AXIS_FLAG_PRESSURE: Pressure axis is present
|
||||
* @GDK_AXIS_FLAG_XTILT: X tilt axis is present
|
||||
* @GDK_AXIS_FLAG_YTILT: Y tilt axis is present
|
||||
* @GDK_AXIS_FLAG_WHEEL: Wheel axis is present
|
||||
* @GDK_AXIS_FLAG_DISTANCE: Distance axis is present
|
||||
* @GDK_AXIS_FLAG_ROTATION: Z-axis rotation is present
|
||||
* @GDK_AXIS_FLAG_SLIDER: Slider axis is present
|
||||
*
|
||||
* Flags describing the current capabilities of a device/tool.
|
||||
*
|
||||
* Since: 3.22
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_AXIS_FLAG_X = 1 << GDK_AXIS_X,
|
||||
GDK_AXIS_FLAG_Y = 1 << GDK_AXIS_Y,
|
||||
GDK_AXIS_FLAG_PRESSURE = 1 << GDK_AXIS_PRESSURE,
|
||||
GDK_AXIS_FLAG_XTILT = 1 << GDK_AXIS_XTILT,
|
||||
GDK_AXIS_FLAG_YTILT = 1 << GDK_AXIS_YTILT,
|
||||
GDK_AXIS_FLAG_WHEEL = 1 << GDK_AXIS_WHEEL,
|
||||
GDK_AXIS_FLAG_DISTANCE = 1 << GDK_AXIS_DISTANCE,
|
||||
GDK_AXIS_FLAG_ROTATION = 1 << GDK_AXIS_ROTATION,
|
||||
GDK_AXIS_FLAG_SLIDER = 1 << GDK_AXIS_SLIDER,
|
||||
} GdkAxisFlags;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_TYPES_H__ */
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "gdkwayland.h"
|
||||
#include "gdkkeysyms.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevicetoolprivate.h"
|
||||
#include "gdkdevicemanagerprivate.h"
|
||||
#include "gdkseatprivate.h"
|
||||
#include "pointer-gestures-unstable-v1-client-protocol.h"
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include "gdkdevicemanagerprivate-core.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevicetoolprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkeventtranslator.h"
|
||||
#include "gdkprivate-x11.h"
|
||||
|
Loading…
Reference in New Issue
Block a user