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