gdkdeviceprivate.h 7.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* 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
Javier Jardon's avatar
Javier Jardon committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 17 18 19 20
 */

#ifndef __GDK_DEVICE_PRIVATE_H__
#define __GDK_DEVICE_PRIVATE_H__

Matthias Clasen's avatar
Matthias Clasen committed
21
#include "gdkdevice.h"
22
#include "gdkdevicetool.h"
23
#include "gdkdevicemanager.h"
Matthias Clasen's avatar
Matthias Clasen committed
24
#include "gdkevents.h"
25
#include "gdkseat.h"
26 27 28 29 30 31 32

G_BEGIN_DECLS

#define GDK_DEVICE_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE, GdkDeviceClass))
#define GDK_IS_DEVICE_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE))
#define GDK_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE, GdkDeviceClass))

33
typedef struct _GdkDeviceClass GdkDeviceClass;
Matthias Clasen's avatar
Matthias Clasen committed
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
typedef struct _GdkDeviceKey GdkDeviceKey;

struct _GdkDeviceKey
{
  guint keyval;
  GdkModifierType modifiers;
};

struct _GdkDevice
{
  GObject parent_instance;

  gchar *name;
  GdkInputSource source;
  GdkInputMode mode;
  gboolean has_cursor;
  gint num_keys;
51
  GdkAxisFlags axis_flags;
Matthias Clasen's avatar
Matthias Clasen committed
52 53 54 55 56 57 58 59 60 61
  GdkDeviceKey *keys;
  GdkDeviceManager *manager;
  GdkDisplay *display;
  /* Paired master for master,
   * associated master for slaves
   */
  GdkDevice *associated;
  GList *slaves;
  GdkDeviceType type;
  GArray *axes;
62
  guint num_touches;
63 64 65

  gchar *vendor_id;
  gchar *product_id;
66 67

  GdkSeat *seat;
68
  GdkDeviceTool *last_tool;
Matthias Clasen's avatar
Matthias Clasen committed
69 70
};

71 72 73 74
struct _GdkDeviceClass
{
  GObjectClass parent_class;

Matthias Clasen's avatar
Matthias Clasen committed
75 76 77 78 79 80 81 82 83 84 85
  gboolean (* get_history)   (GdkDevice      *device,
                              GdkWindow      *window,
                              guint32         start,
                              guint32         stop,
                              GdkTimeCoord ***events,
                              gint           *n_events);

  void (* get_state)         (GdkDevice       *device,
                              GdkWindow       *window,
                              gdouble         *axes,
                              GdkModifierType *mask);
86 87 88 89 90 91 92

  void (* set_window_cursor) (GdkDevice *device,
                              GdkWindow *window,
                              GdkCursor *cursor);

  void (* warp)              (GdkDevice  *device,
                              GdkScreen  *screen,
93 94
                              gdouble     x,
                              gdouble     y);
95
  void (* query_state)       (GdkDevice       *device,
96 97 98
                              GdkWindow       *window,
                              GdkWindow      **root_window,
                              GdkWindow      **child_window,
99 100 101 102
                              gdouble          *root_x,
                              gdouble          *root_y,
                              gdouble          *win_x,
                              gdouble          *win_y,
103 104 105 106 107 108 109 110 111 112 113 114
                              GdkModifierType  *mask);
  GdkGrabStatus (* grab)     (GdkDevice        *device,
                              GdkWindow        *window,
                              gboolean          owner_events,
                              GdkEventMask      event_mask,
                              GdkWindow        *confine_to,
                              GdkCursor        *cursor,
                              guint32           time_);
  void          (*ungrab)    (GdkDevice        *device,
                              guint32           time_);

  GdkWindow * (* window_at_position) (GdkDevice       *device,
115 116
                                      double          *win_x,
                                      double          *win_y,
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
                                      GdkModifierType *mask,
                                      gboolean         get_toplevel);
  void (* select_window_events)      (GdkDevice       *device,
                                      GdkWindow       *window,
                                      GdkEventMask     event_mask);
};

void  _gdk_device_set_associated_device (GdkDevice *device,
                                         GdkDevice *relative);

void  _gdk_device_reset_axes (GdkDevice   *device);
guint _gdk_device_add_axis   (GdkDevice   *device,
                              GdkAtom      label_atom,
                              GdkAxisUse   use,
                              gdouble      min_value,
                              gdouble      max_value,
                              gdouble      resolution);
134 135 136 137 138 139 140
void _gdk_device_get_axis_info (GdkDevice  *device,
				guint       index,
				GdkAtom    *label_atom,
				GdkAxisUse *use,
				gdouble    *min_value,
				gdouble    *max_value,
				gdouble    *resolution);
141 142 143 144 145 146 147 148 149 150 151 152

void _gdk_device_set_keys    (GdkDevice   *device,
                              guint        num_keys);

gboolean   _gdk_device_translate_window_coord (GdkDevice *device,
                                               GdkWindow *window,
                                               guint      index,
                                               gdouble    value,
                                               gdouble   *axis_value);

gboolean   _gdk_device_translate_screen_coord (GdkDevice *device,
                                               GdkWindow *window,
153 154
                                               gdouble    window_root_x,
                                               gdouble    window_root_y,
155 156 157 158 159 160 161 162 163 164
                                               guint      index,
                                               gdouble    value,
                                               gdouble   *axis_value);

gboolean   _gdk_device_translate_axis         (GdkDevice *device,
                                               guint      index,
                                               gdouble    value,
                                               gdouble   *axis_value);

GdkTimeCoord ** _gdk_device_allocate_history  (GdkDevice *device,
165
                                               gint       n_events);
166

167 168 169 170
void _gdk_device_add_slave (GdkDevice *device,
                            GdkDevice *slave);
void _gdk_device_remove_slave (GdkDevice *device,
                               GdkDevice *slave);
171
void _gdk_device_query_state                  (GdkDevice        *device,
172 173 174
                                               GdkWindow        *window,
                                               GdkWindow       **root_window,
                                               GdkWindow       **child_window,
175 176 177 178
                                               gdouble          *root_x,
                                               gdouble          *root_y,
                                               gdouble          *win_x,
                                               gdouble          *win_y,
179 180
                                               GdkModifierType  *mask);
GdkWindow * _gdk_device_window_at_position    (GdkDevice        *device,
181 182
                                               gdouble          *win_x,
                                               gdouble          *win_y,
183 184
                                               GdkModifierType  *mask,
                                               gboolean          get_toplevel);
185

186 187 188
void  gdk_device_set_seat  (GdkDevice *device,
                            GdkSeat   *seat);

189 190
void           gdk_device_update_tool (GdkDevice     *device,
                                       GdkDeviceTool *tool);
191

192 193
GdkInputMode gdk_device_get_input_mode (GdkDevice *device);

194 195 196
G_END_DECLS

#endif /* __GDK_DEVICE_PRIVATE_H__ */