]> Pileus Git - ~andy/gtk/blob - gdk/win32/gdkinput-win32.h
Implement better handling of Wintab tablet context overlap on Win32.
[~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 (GdkDisplay *display);
133
134 GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
135                                               gint       n_events);
136
137 /* The following functions are provided by each implementation
138  * (just wintab for now)
139  */
140 void             _gdk_input_configure_event  (GdkWindow         *window);
141 void             _gdk_input_enter_event      (GdkWindow         *window);
142 gboolean         _gdk_input_other_event      (GdkEvent         *event,
143                                               MSG              *msg,
144                                               GdkWindow        *window);
145
146 /* These should be in gdkinternals.h */
147
148 GdkInputWindow  *_gdk_input_window_find      (GdkWindow        *window);
149
150 void             _gdk_input_window_destroy   (GdkWindow *window);
151
152 gint             _gdk_input_enable_window    (GdkWindow        *window,
153                                               GdkDevicePrivate *gdkdev);
154 gint             _gdk_input_disable_window   (GdkWindow        *window,
155                                               GdkDevicePrivate *gdkdev);
156 gint             _gdk_input_grab_pointer     (GdkWindow        *window,
157                                               gint              owner_events,
158                                               GdkEventMask      event_mask,
159                                               GdkWindow        *confine_to,
160                                               guint32           time);
161 void             _gdk_input_ungrab_pointer   (guint32           time);
162 gboolean         _gdk_device_get_history     (GdkDevice         *device,
163                                               GdkWindow         *window,
164                                               guint32            start,
165                                               guint32            stop,
166                                               GdkTimeCoord    ***events,
167                                               gint              *n_events);
168
169 #ifdef HAVE_WINTAB
170 void            _gdk_input_wintab_init_check (void);
171 void            _gdk_input_set_tablet_active (void);
172 #endif /* HAVE_WINTAB */
173
174 #endif /* __GDK_INPUT_WIN32_H__ */