You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

192 lines
5.7 KiB

  1. /* GDK - The GIMP Drawing Kit
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 02111-1307, USA.
  18. */
  19. /*
  20. * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GTK+ Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
  26. #error "Only <gdk/gdk.h> can be included directly."
  27. #endif
  28. #ifndef __GDK_INPUT_H__
  29. #define __GDK_INPUT_H__
  30. #include <gdk/gdktypes.h>
  31. G_BEGIN_DECLS
  32. #define GDK_TYPE_DEVICE (gdk_device_get_type ())
  33. #define GDK_DEVICE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DEVICE, GdkDevice))
  34. #define GDK_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DEVICE, GdkDeviceClass))
  35. #define GDK_IS_DEVICE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DEVICE))
  36. #define GDK_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DEVICE))
  37. #define GDK_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DEVICE, GdkDeviceClass))
  38. typedef struct _GdkDeviceKey GdkDeviceKey;
  39. typedef struct _GdkDeviceAxis GdkDeviceAxis;
  40. typedef struct _GdkDevice GdkDevice;
  41. typedef struct _GdkDeviceClass GdkDeviceClass;
  42. typedef struct _GdkTimeCoord GdkTimeCoord;
  43. typedef enum
  44. {
  45. GDK_EXTENSION_EVENTS_NONE,
  46. GDK_EXTENSION_EVENTS_ALL,
  47. GDK_EXTENSION_EVENTS_CURSOR
  48. } GdkExtensionMode;
  49. typedef enum
  50. {
  51. GDK_SOURCE_MOUSE,
  52. GDK_SOURCE_PEN,
  53. GDK_SOURCE_ERASER,
  54. GDK_SOURCE_CURSOR
  55. } GdkInputSource;
  56. typedef enum
  57. {
  58. GDK_MODE_DISABLED,
  59. GDK_MODE_SCREEN,
  60. GDK_MODE_WINDOW
  61. } GdkInputMode;
  62. typedef enum
  63. {
  64. GDK_AXIS_IGNORE,
  65. GDK_AXIS_X,
  66. GDK_AXIS_Y,
  67. GDK_AXIS_PRESSURE,
  68. GDK_AXIS_XTILT,
  69. GDK_AXIS_YTILT,
  70. GDK_AXIS_WHEEL,
  71. GDK_AXIS_LAST
  72. } GdkAxisUse;
  73. struct _GdkDeviceKey
  74. {
  75. guint keyval;
  76. GdkModifierType modifiers;
  77. };
  78. struct _GdkDeviceAxis
  79. {
  80. GdkAxisUse use;
  81. gdouble min;
  82. gdouble max;
  83. };
  84. struct _GdkDevice
  85. {
  86. GObject parent_instance;
  87. /* All fields are read-only */
  88. gchar *GSEAL (name);
  89. GdkInputSource GSEAL (source);
  90. GdkInputMode GSEAL (mode);
  91. gboolean GSEAL (has_cursor); /* TRUE if the X pointer follows device motion */
  92. gint GSEAL (num_axes);
  93. GdkDeviceAxis *GSEAL (axes);
  94. gint GSEAL (num_keys);
  95. GdkDeviceKey *GSEAL (keys);
  96. };
  97. /* We don't allocate each coordinate this big, but we use it to
  98. * be ANSI compliant and avoid accessing past the defined limits.
  99. */
  100. #define GDK_MAX_TIMECOORD_AXES 128
  101. struct _GdkTimeCoord
  102. {
  103. guint32 time;
  104. gdouble axes[GDK_MAX_TIMECOORD_AXES];
  105. };
  106. GType gdk_device_get_type (void) G_GNUC_CONST;
  107. #ifndef GDK_MULTIHEAD_SAFE
  108. /* Returns a list of GdkDevice * */
  109. GList * gdk_devices_list (void);
  110. #endif /* GDK_MULTIHEAD_SAFE */
  111. G_CONST_RETURN gchar *gdk_device_get_name (GdkDevice *device);
  112. GdkInputSource gdk_device_get_source (GdkDevice *device);
  113. GdkInputMode gdk_device_get_mode (GdkDevice *device);
  114. gboolean gdk_device_get_has_cursor (GdkDevice *device);
  115. void gdk_device_get_key (GdkDevice *device,
  116. guint index,
  117. guint *keyval,
  118. GdkModifierType *modifiers);
  119. GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
  120. guint index);
  121. gint gdk_device_get_n_axes (GdkDevice *device);
  122. /* Functions to configure a device */
  123. void gdk_device_set_source (GdkDevice *device,
  124. GdkInputSource source);
  125. gboolean gdk_device_set_mode (GdkDevice *device,
  126. GdkInputMode mode);
  127. void gdk_device_set_key (GdkDevice *device,
  128. guint index_,
  129. guint keyval,
  130. GdkModifierType modifiers);
  131. void gdk_device_set_axis_use (GdkDevice *device,
  132. guint index_,
  133. GdkAxisUse use);
  134. void gdk_device_get_state (GdkDevice *device,
  135. GdkWindow *window,
  136. gdouble *axes,
  137. GdkModifierType *mask);
  138. gboolean gdk_device_get_history (GdkDevice *device,
  139. GdkWindow *window,
  140. guint32 start,
  141. guint32 stop,
  142. GdkTimeCoord ***events,
  143. gint *n_events);
  144. void gdk_device_free_history (GdkTimeCoord **events,
  145. gint n_events);
  146. gboolean gdk_device_get_axis (GdkDevice *device,
  147. gdouble *axes,
  148. GdkAxisUse use,
  149. gdouble *value);
  150. void gdk_input_set_extension_events (GdkWindow *window,
  151. gint mask,
  152. GdkExtensionMode mode);
  153. #ifndef GDK_MULTIHEAD_SAFE
  154. GdkDevice *gdk_device_get_core_pointer (void);
  155. #endif
  156. G_END_DECLS
  157. #endif /* __GDK_INPUT_H__ */