gtk/gdk/gdkdevice.h

227 lines
8.2 KiB
C
Raw Normal View History

2010-05-25 22:38:44 +00:00
/* 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
2012-02-27 13:01:10 +00:00
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
2010-05-25 22:38:44 +00:00
*/
#ifndef __GDK_DEVICE_H__
#define __GDK_DEVICE_H__
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
2010-05-25 22:38:44 +00:00
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
2010-05-25 22:38:44 +00:00
#include <gdk/gdktypes.h>
#include <gdk/gdkdevicetool.h>
2010-05-25 22:38:44 +00:00
G_BEGIN_DECLS
#define GDK_TYPE_DEVICE (gdk_device_get_type ())
#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))
typedef struct _GdkTimeCoord GdkTimeCoord;
/**
* GdkInputSource:
* @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_ERASER: the device is an eraser. Typically, this would be the other end
* of a stylus on a graphics tablet.
2014-02-05 19:50:22 +00:00
* @GDK_SOURCE_CURSOR: the device is a graphics tablet puck or similar device.
2010-05-25 22:38:44 +00:00
* @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. This device type has been added in 3.4.
* @GDK_SOURCE_TOUCHPAD: the device is an indirect touch device, such
* as a touchpad. This device type has been added in 3.4.
* @GDK_SOURCE_TRACKPOINT: the device is a trackpoint. This device type has been
* added in 3.22
* @GDK_SOURCE_TABLET_PAD: the device is a "pad", a collection of buttons,
* rings and strips found in drawing tablets. This device type has been
* added in 3.22.
2010-05-25 22:38:44 +00:00
*
* An enumeration describing the type of an input device in general terms.
*/
typedef enum
{
GDK_SOURCE_MOUSE,
GDK_SOURCE_PEN,
GDK_SOURCE_ERASER,
GDK_SOURCE_CURSOR,
GDK_SOURCE_KEYBOARD,
GDK_SOURCE_TOUCHSCREEN,
GDK_SOURCE_TOUCHPAD,
GDK_SOURCE_TRACKPOINT,
GDK_SOURCE_TABLET_PAD
2010-05-25 22:38:44 +00:00
} GdkInputSource;
/**
* GdkDeviceType:
* @GDK_DEVICE_TYPE_MASTER: Device is a master (or virtual) device. There will
* be an associated focus indicator on the screen.
* @GDK_DEVICE_TYPE_SLAVE: Device is a slave (or physical) device.
* @GDK_DEVICE_TYPE_FLOATING: Device is a physical device, currently not attached to
* any seat.
2010-05-25 22:38:44 +00:00
*
* Indicates the device type.
2010-05-25 22:38:44 +00:00
*/
typedef enum {
GDK_DEVICE_TYPE_MASTER,
GDK_DEVICE_TYPE_SLAVE,
GDK_DEVICE_TYPE_FLOATING
} GdkDeviceType;
/* We don't allocate each coordinate this big, but we use it to
* be ANSI compliant and avoid accessing past the defined limits.
*/
#define GDK_MAX_TIMECOORD_AXES 128
/**
* GdkTimeCoord:
* @time: The timestamp for this event.
* @axes: the values of the devices axes.
2010-05-25 22:38:44 +00:00
*
* A #GdkTimeCoord stores a single event in a motion history.
2010-05-25 22:38:44 +00:00
*/
struct _GdkTimeCoord
{
guint32 time;
gdouble axes[GDK_MAX_TIMECOORD_AXES];
};
GDK_AVAILABLE_IN_ALL
GType gdk_device_get_type (void) G_GNUC_CONST;
2010-05-25 22:38:44 +00:00
GDK_AVAILABLE_IN_ALL
2011-06-06 18:05:18 +00:00
const gchar * gdk_device_get_name (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
gboolean gdk_device_get_has_cursor (GdkDevice *device);
/* Functions to configure a device */
GDK_AVAILABLE_IN_ALL
GdkInputSource gdk_device_get_source (GdkDevice *device);
2010-05-25 22:38:44 +00:00
GDK_AVAILABLE_IN_ALL
gint gdk_device_get_n_keys (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
gboolean gdk_device_get_key (GdkDevice *device,
guint index_,
guint *keyval,
GdkModifierType *modifiers);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
void gdk_device_set_key (GdkDevice *device,
guint index_,
guint keyval,
GdkModifierType modifiers);
2010-05-25 22:38:44 +00:00
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
guint index_);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
void gdk_device_set_axis_use (GdkDevice *device,
guint index_,
GdkAxisUse use);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
void gdk_device_get_state (GdkDevice *device,
GdkSurface *surface,
gdouble *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
2010-05-25 22:38:44 +00:00
gboolean gdk_device_get_history (GdkDevice *device,
GdkSurface *surface,
guint32 start,
guint32 stop,
GdkTimeCoord ***events,
gint *n_events);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
void gdk_device_free_history (GdkTimeCoord **events,
gint n_events);
2010-05-25 22:38:44 +00:00
GDK_AVAILABLE_IN_ALL
gint gdk_device_get_n_axes (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
char ** gdk_device_get_axis_names (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
gboolean gdk_device_get_axis_value (GdkDevice *device,
gdouble *axes,
const char *axis_label,
2010-05-25 22:38:44 +00:00
gdouble *value);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
gboolean gdk_device_get_axis (GdkDevice *device,
gdouble *axes,
GdkAxisUse use,
gdouble *value);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
GdkDisplay * gdk_device_get_display (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
GdkDevice * gdk_device_get_associated_device (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GList * gdk_device_list_slave_devices (GdkDevice *device);
2010-05-25 22:38:44 +00:00
GDK_AVAILABLE_IN_ALL
2010-05-25 22:38:44 +00:00
GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkSurface: Rename various functions and variables This is an automatic rename of various things related to the window->surface rename. Public symbols changed by this is: GDK_MODE_WINDOW gdk_device_get_window_at_position gdk_device_get_window_at_position_double gdk_device_get_last_event_window gdk_display_get_monitor_at_window gdk_drag_context_get_source_window gdk_drag_context_get_dest_window gdk_drag_context_get_drag_window gdk_draw_context_get_window gdk_drawing_context_get_window gdk_gl_context_get_window gdk_synthesize_window_state gdk_surface_get_window_type gdk_x11_display_set_window_scale gsk_renderer_new_for_window gsk_renderer_get_window gtk_text_view_buffer_to_window_coords gtk_tree_view_convert_widget_to_bin_window_coords gtk_tree_view_convert_tree_to_bin_window_coords The commands that generated this are: git sed -f g "GDK window" "GDK surface" git sed -f g window_impl surface_impl (cd gdk; git sed -f g impl_window impl_surface) git sed -f g WINDOW_IMPL SURFACE_IMPL git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface git sed -f g gsk_renderer_get_window gsk_renderer_get_surface git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface (cd gdk; git sed -f g window_type surface_type) git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type git sed -f g window_at_position surface_at_position git sed -f g event_window event_surface git sed -f g window_coord surface_coord git sed -f g window_state surface_state git sed -f g window_cursor surface_cursor git sed -f g window_scale surface_scale git sed -f g window_events surface_events git sed -f g monitor_at_window monitor_at_surface git sed -f g window_under_pointer surface_under_pointer (cd gdk; git sed -f g for_window for_surface) git sed -f g window_anchor surface_anchor git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL git sed -f g native_window native_surface git sed -f g source_window source_surface git sed -f g dest_window dest_surface git sed -f g drag_window drag_surface git sed -f g input_window input_surface git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 11:05:26 +00:00
GdkSurface *gdk_device_get_last_event_surface (GdkDevice *device);
2010-05-25 22:38:44 +00:00
GDK_AVAILABLE_IN_ALL
const gchar *gdk_device_get_vendor_id (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
const gchar *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);
GDK_AVAILABLE_IN_ALL
GdkDeviceTool * gdk_device_get_device_tool (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_caps_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_num_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_get_scroll_lock_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
GdkModifierType gdk_device_get_modifier_state (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
PangoDirection gdk_device_get_direction (GdkDevice *device);
GDK_AVAILABLE_IN_ALL
gboolean gdk_device_has_bidi_layouts (GdkDevice *device);
2010-05-25 22:38:44 +00:00
G_END_DECLS
#endif /* __GDK_DEVICE_H__ */