]> Pileus Git - ~andy/gtk/blob - gdk/x11/gdkinputprivate.h
Bug #107664 continued:
[~andy/gtk] / gdk / x11 / gdkinputprivate.h
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 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef __GDK_INPUTPRIVATE_H__
28 #define __GDK_INPUTPRIVATE_H__
29
30 #include "config.h"
31 #include "gdkinput.h"
32 #include "gdkevents.h"
33 #include "gdkx.h"
34
35 #include <X11/Xlib.h>
36
37 #ifndef XINPUT_NONE
38 #include <X11/extensions/XInput.h>
39 #endif
40
41
42 typedef struct _GdkAxisInfo    GdkAxisInfo;
43 typedef struct _GdkDevicePrivate GdkDevicePrivate;
44 typedef struct _GdkInputWindow GdkInputWindow;
45
46 /* information about a device axis */
47 struct _GdkAxisInfo
48 {
49   /* reported x resolution */
50   gint xresolution;
51
52   /* reported x minimum/maximum values */
53   gint xmin_value, xmax_value;
54
55   /* calibrated resolution (for aspect ration) - only relative values
56      between axes used */
57   gint resolution;
58   
59   /* calibrated minimum/maximum values */
60   gint min_value, max_value;
61 };
62
63 #define GDK_INPUT_NUM_EVENTC 6
64
65 struct _GdkDevicePrivate
66 {
67   GdkDevice info;
68
69   guint32 deviceid;
70
71   GdkDisplay *display;
72   
73
74 #ifndef XINPUT_NONE
75   /* information about the axes */
76   GdkAxisInfo *axes;
77
78   /* Information about XInput device */
79   XDevice       *xdevice;
80
81   /* minimum key code for device */
82   gint min_keycode;            
83
84   int buttonpress_type, buttonrelease_type, keypress_type,
85       keyrelease_type, motionnotify_type, proximityin_type, 
86       proximityout_type, changenotify_type;
87
88   /* true if we need to select a different set of events, but
89      can't because this is the core pointer */
90   gint needs_update;
91
92   /* Mask of buttons (used for button grabs) */
93   gint button_state;
94
95   /* true if we've claimed the device as active. (used only for XINPUT_GXI) */
96   gint claimed;
97 #endif /* !XINPUT_NONE */
98 };
99
100 struct _GdkDeviceClass
101 {
102   GObjectClass parent_class;
103 };
104
105 struct _GdkInputWindow
106 {
107   /* gdk window */
108   GdkWindow *window;
109
110   /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */
111   GdkExtensionMode mode;
112
113   /* position relative to root window */
114   gint root_x;
115   gint root_y;
116
117   /* rectangles relative to window of windows obscuring this one */
118   GdkRectangle *obscuring;
119   gint num_obscuring;
120
121   /* Is there a pointer grab for this window ? */
122   gint grabbed;
123 };
124
125
126
127 /* Global data */
128
129 #define GDK_IS_CORE(d) (((GdkDevice *)(d)) == ((GdkDevicePrivate *)(d))->display->core_pointer)
130
131 /* Function declarations */
132
133 GdkInputWindow *_gdk_input_window_find       (GdkWindow *window);
134 void            _gdk_input_window_destroy    (GdkWindow *window);
135 GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
136                                               gint       n_events);
137 void            _gdk_init_input_core         (GdkDisplay *display);
138
139 /* The following functions are provided by each implementation
140  * (xfree, gxi, and none)
141  */
142 gint             _gdk_input_enable_window     (GdkWindow        *window,
143                                               GdkDevicePrivate *gdkdev);
144 gint             _gdk_input_disable_window    (GdkWindow        *window,
145                                               GdkDevicePrivate *gdkdev);
146 void             _gdk_input_configure_event  (XConfigureEvent  *xevent,
147                                               GdkWindow        *window);
148 void             _gdk_input_enter_event      (XCrossingEvent   *xevent,
149                                               GdkWindow        *window);
150 gboolean         _gdk_input_other_event      (GdkEvent         *event,
151                                               XEvent           *xevent,
152                                               GdkWindow        *window);
153 gint             _gdk_input_grab_pointer     (GdkWindow        *window,
154                                               gint              owner_events,
155                                               GdkEventMask      event_mask,
156                                               GdkWindow        *confine_to,
157                                               guint32           time);
158 void             _gdk_input_ungrab_pointer   (GdkDisplay       *display,
159                                               guint32           time);
160 gboolean         _gdk_device_get_history     (GdkDevice         *device,
161                                               GdkWindow         *window,
162                                               guint32            start,
163                                               guint32            stop,
164                                               GdkTimeCoord    ***events,
165                                               gint              *n_events);
166
167 #ifndef XINPUT_NONE
168
169 #define GDK_MAX_DEVICE_CLASSES 13
170
171 gint               _gdk_input_common_init               (GdkDisplay       *display,
172                                                          gint              include_core);
173 GdkDevicePrivate * _gdk_input_find_device               (GdkDisplay       *display,
174                                                          guint32           id);
175 void               _gdk_input_get_root_relative_geometry(Display          *display,
176                                                          Window            w,
177                                                          int              *x_ret,
178                                                          int              *y_ret,
179                                                          int              *width_ret,
180                                                          int              *height_ret);
181 void               _gdk_input_common_find_events        (GdkWindow        *window,
182                                                          GdkDevicePrivate *gdkdev,
183                                                          gint              mask,
184                                                          XEventClass      *classes,
185                                                          int              *num_classes);
186 void               _gdk_input_common_select_events      (GdkWindow        *window,
187                                                          GdkDevicePrivate *gdkdev);
188 gint               _gdk_input_common_other_event        (GdkEvent         *event,
189                                                          XEvent           *xevent,
190                                                          GdkInputWindow   *input_window,
191                                                          GdkDevicePrivate *gdkdev);
192
193 #endif /* !XINPUT_NONE */
194
195 #endif /* __GDK_INPUTPRIVATE_H__ */