]> Pileus Git - ~andy/gtk/blob - gdk/win32/gdkinput-win32.h
Renames:
[~andy/gtk] / gdk / win32 / gdkinput-win32.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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library 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-1999.  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_INPUT_WIN32_H__
28 #define __GDK_INPUT_WIN32_H__
29
30 #ifdef HAVE_WINTAB
31 #include <wintab.h>
32 #endif
33
34 typedef struct _GdkAxisInfo    GdkAxisInfo;
35 typedef struct _GdkDevicePrivate GdkDevicePrivate;
36 typedef struct _GdkInputWindow GdkInputWindow;
37
38 /* information about a device axis */
39 struct _GdkAxisInfo
40 {
41   /* reported x resolution */
42   gint xresolution;
43
44   /* reported x minimum/maximum values */
45   gint xmin_value, xmax_value;
46
47   /* calibrated resolution (for aspect ration) - only relative values
48      between axes used */
49   gint resolution;
50   
51   /* calibrated minimum/maximum values */
52   gint min_value, max_value;
53 };
54
55 struct _GdkDeviceClass
56 {
57   GObjectClass parent_class;
58 };
59
60 #define GDK_INPUT_NUM_EVENTC 6
61
62 struct _GdkDevicePrivate
63 {
64   GdkDevice info;
65
66   /* information about the axes */
67   GdkAxisInfo *axes;
68
69   /* minimum key code for device */
70   gint min_keycode;            
71
72   int buttonpress_type, buttonrelease_type, keypress_type,
73       keyrelease_type, motionnotify_type, proximityin_type, 
74       proximityout_type, changenotify_type;
75
76   /* true if we need to select a different set of events, but
77      can't because this is the core pointer */
78   gint needs_update;
79
80   /* Mask of buttons (used for button grabs) */
81   gint button_state;
82
83   /* true if we've claimed the device as active. (used only for XINPUT_GXI) */
84   gint claimed;
85
86   gint *last_axis_data;
87   gint last_buttons;
88 #ifdef HAVE_WINTAB
89   /* WINTAB stuff: */
90   HCTX hctx;
91   /* Cursor number */
92   UINT cursor;
93   /* The cursor's CSR_PKTDATA */
94   WTPKT pktdata;
95   /* CSR_NPBTNMARKS */
96   UINT npbtnmarks[2];
97   /* Azimuth and altitude axis */
98   AXIS orientation_axes[2];
99 #endif
100 };
101
102 struct _GdkInputWindow
103 {
104   /* gdk window */
105   GdkWindow *window;
106
107   /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */
108   GdkExtensionMode mode;
109
110   /* position relative to root window */
111   gint root_x;
112   gint root_y;
113
114   /* rectangles relative to window of windows obscuring this one */
115   GdkRectangle *obscuring;
116   gint num_obscuring;
117
118   /* Is there a pointer grab for this window ? */
119   gint grabbed;
120 };
121
122 /* Global data */
123
124 #define GDK_IS_CORE(d) (((GdkDevice *)(d)) == gdk_display_get_default ()->core_pointer)
125
126 extern GList *_gdk_input_devices;
127 extern GList *_gdk_input_windows;
128
129 extern gint   _gdk_input_ignore_core;
130
131 /* Function declarations */
132 void             _gdk_init_input_core (void);
133
134 void gdk_input_window_destroy (GdkWindow *window);
135 GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
136                                               gint       n_events);
137
138 /* The following functions are provided by each implementation
139  * (just wintab for now)
140  */
141 gint             _gdk_input_window_none_event(GdkEvent         *event,
142                                               MSG              *msg);
143 void             _gdk_input_configure_event  (GdkEventConfigure *event,
144                                               GdkWindow         *window);
145 void             _gdk_input_enter_event      (GdkEventCrossing  *event,
146                                               GdkWindow         *window);
147 gint             _gdk_input_other_event      (GdkEvent         *event,
148                                               MSG              *msg,
149                                               GdkWindow        *window);
150
151 /* These should be in gdkinternals.h */
152
153 GdkInputWindow   *gdk_input_window_find      (GdkWindow        *window);
154
155 void              gdk_input_window_destroy   (GdkWindow *window);
156
157 gint             _gdk_input_enable_window    (GdkWindow        *window,
158                                               GdkDevicePrivate *gdkdev);
159 gint             _gdk_input_disable_window   (GdkWindow        *window,
160                                               GdkDevicePrivate *gdkdev);
161 gint             _gdk_input_grab_pointer     (GdkWindow        *window,
162                                               gint              owner_events,
163                                               GdkEventMask      event_mask,
164                                               GdkWindow        *confine_to,
165                                               guint32           time);
166 void             _gdk_input_ungrab_pointer   (guint32           time);
167 gboolean         _gdk_device_get_history     (GdkDevice         *device,
168                                               GdkWindow         *window,
169                                               guint32            start,
170                                               guint32            stop,
171                                               GdkTimeCoord    ***events,
172                                               gint              *n_events);
173
174
175 #define GDK_MAX_DEVICE_CLASSES 13
176
177 gint             gdk_input_common_init        (gint              include_core);
178 gint             gdk_input_common_other_event (GdkEvent          *event,
179                                                MSG               *msg,
180                                                GdkInputWindow    *input_window,
181                                                GdkWindow         *window);
182
183 #endif /* __GDK_INPUT_WIN32_H__ */