]> Pileus Git - ~andy/gtk/blob - gdk/win32/gdkinput.h
46e6b1f643ca01eb5857dc7383c4caf08f879168
[~andy/gtk] / gdk / win32 / gdkinput.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_H__
28 #define __GDK_INPUT_H__
29
30 #include <wintab.h>
31 #define PACKETDATA (PK_CONTEXT | PK_CURSOR | PK_BUTTONS | PK_X | PK_Y  | PK_NORMAL_PRESSURE | PK_ORIENTATION)
32 #define PACKETMODE (PK_BUTTONS)
33 #include <pktdef.h>
34
35 typedef struct _GdkAxisInfo    GdkAxisInfo;
36 typedef struct _GdkInputVTable GdkInputVTable;
37 typedef struct _GdkDevicePrivate GdkDevicePrivate;
38 typedef struct _GdkInputWindow GdkInputWindow;
39
40 struct _GdkInputVTable {
41   gint (*set_mode) (guint32 deviceid, GdkInputMode mode);
42   void (*set_axes) (guint32 deviceid, GdkAxisUse *axes);
43   void (*set_key)  (guint32 deviceid,
44                     guint   index,
45                     guint   keyval,
46                     GdkModifierType modifiers);
47         
48   GdkTimeCoord* (*motion_events) (GdkWindow *window,
49                                   guint32 deviceid,
50                                   guint32 start,
51                                   guint32 stop,
52                                   gint *nevents_return);
53   void (*get_pointer)   (GdkWindow       *window,
54                          guint32          deviceid,
55                          gdouble         *x,
56                          gdouble         *y,
57                          gdouble         *pressure,
58                          gdouble         *xtilt,
59                          gdouble         *ytilt,
60                          GdkModifierType *mask);
61   gint (*grab_pointer) (GdkWindow *     window,
62                         gint            owner_events,
63                         GdkEventMask    event_mask,
64                         GdkWindow *     confine_to,
65                         guint32         time);
66   void (*ungrab_pointer) (guint32 time);
67
68   void (*configure_event) (GdkEventConfigure *event, GdkWindow *window);
69   void (*enter_event) (GdkEventCrossing *event, GdkWindow *window);
70   gint (*other_event) (GdkEvent *event, MSG *xevent);
71   gint (*enable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
72   gint (*disable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
73 };
74
75 /* information about a device axis */
76 struct _GdkAxisInfo
77 {
78   /* reported x resolution */
79   gint xresolution;
80
81   /* reported x minimum/maximum values */
82   gint xmin_value, xmax_value;
83
84   /* calibrated resolution (for aspect ration) - only relative values
85      between axes used */
86   gint resolution;
87   
88   /* calibrated minimum/maximum values */
89   gint min_value, max_value;
90 };
91
92 #define GDK_INPUT_NUM_EVENTC 6
93
94 struct _GdkDevicePrivate {
95   GdkDeviceInfo  info;
96
97   /* information about the axes */
98   GdkAxisInfo *axes;
99
100   /* reverse lookup on axis use type */
101   gint axis_for_use[GDK_AXIS_LAST];
102   
103   /* true if we need to select a different set of events, but
104    * can't because this is the core pointer
105    */
106   gint needs_update;
107
108   /* State of buttons */
109   gint button_state;
110
111   gint *last_axis_data;
112   gint last_buttons;
113
114   /* WINTAB stuff: */
115   HCTX hctx;
116   /* Cursor number */
117   UINT cursor;
118   /* The cursor's CSR_PKTDATA */
119   WTPKT pktdata;
120   /* CSR_NPBTNMARKS */
121   UINT npbtnmarks[2];
122   /* Azimuth and altitude axis */
123   AXIS orientation_axes[2];
124 };
125
126 struct _GdkInputWindow
127 {
128   /* gdk window */
129   GdkWindow *window;
130
131   /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */
132   GdkExtensionMode mode;
133
134   /* position relative to root window */
135   gint16 root_x;
136   gint16 root_y;
137
138   /* rectangles relative to window of windows obscuring this one */
139   GdkRectangle *obscuring;
140   gint num_obscuring;
141
142   /* Is there a pointer grab for this window ? */
143   gint grabbed;
144 };
145
146 /* Global data */
147
148 extern GdkInputVTable gdk_input_vtable;
149 extern gint             gdk_input_ignore_core;
150 extern gint             gdk_input_ignore_wintab;
151
152 /* Function declarations */
153
154 void gdk_input_window_destroy (GdkWindow *window);
155
156 #endif /* __GDK_INPUT_H__ */