annotate src/events/SDL_mouse_c.h @ 3776:a9c2a7071874 gsoc2008_manymouse

upgraded functions
author Szymon Wilczek <kazeuser@gmail.com>
date Wed, 06 Aug 2008 08:48:43 +0000
parents 8b5b67000dc0
children
rev   line source
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
1 /*
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
2 SDL - Simple DirectMedia Layer
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
4
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
5 This library is free software; you can redistribute it and/or
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
6 modify it under the terms of the GNU Lesser General Public
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
7 License as published by the Free Software Foundation; either
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
9
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
10 This library is distributed in the hope that it will be useful,
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
13 Lesser General Public License for more details.
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
14
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
15 You should have received a copy of the GNU Lesser General Public
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
16 License along with this library; if not, write to the Free Software
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
18
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
19 Sam Lantinga
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
20 slouken@libsdl.org
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
21 */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
22 #include "SDL_config.h"
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
23
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
24 #ifndef _SDL_mouse_c_h
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
25 #define _SDL_mouse_c_h
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
26
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
27 typedef struct SDL_Mouse SDL_Mouse;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
28
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
29 struct SDL_Cursor
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
30 {
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
31 SDL_Mouse *mouse;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
32
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
33 SDL_Cursor *next;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
34
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
35 void *driverdata;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
36 };
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
37
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
38 struct SDL_Mouse
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
39 {
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
40 /* Create a cursor from a surface */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
41 SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
42
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
43 /* Show the specified cursor, or hide if cursor is NULL */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
44 int (*ShowCursor) (SDL_Cursor * cursor);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
45
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
46 /* This is called when a mouse motion event occurs */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
47 void (*MoveCursor) (SDL_Cursor * cursor);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
48
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
49 /* Free a window manager cursor */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
50 void (*FreeCursor) (SDL_Cursor * cursor);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
51
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
52 /* Warp the mouse to (x,y) */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
53 void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x,
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
54 int y);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
55
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
56 /* Free the mouse when it's time */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
57 void (*FreeMouse) (SDL_Mouse * mouse);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
58
3773
3b5691f85c0d Further x11 code improvments + comments
Szymon Wilczek <kazeuser@gmail.com>
parents: 3769
diff changeset
59 /*data common for tablets*/
3b5691f85c0d Further x11 code improvments + comments
Szymon Wilczek <kazeuser@gmail.com>
parents: 3769
diff changeset
60 int pressure;
3b5691f85c0d Further x11 code improvments + comments
Szymon Wilczek <kazeuser@gmail.com>
parents: 3769
diff changeset
61 int pressure_max;
3b5691f85c0d Further x11 code improvments + comments
Szymon Wilczek <kazeuser@gmail.com>
parents: 3769
diff changeset
62 int pressure_min;
3b5691f85c0d Further x11 code improvments + comments
Szymon Wilczek <kazeuser@gmail.com>
parents: 3769
diff changeset
63 int tilt;/*for future use*/
3b5691f85c0d Further x11 code improvments + comments
Szymon Wilczek <kazeuser@gmail.com>
parents: 3769
diff changeset
64 int rotation;/*for future use*/
3774
8b5b67000dc0 Cursor support added
Szymon Wilczek <kazeuser@gmail.com>
parents: 3773
diff changeset
65 int total_ends;
8b5b67000dc0 Cursor support added
Szymon Wilczek <kazeuser@gmail.com>
parents: 3773
diff changeset
66 int current_end;
3773
3b5691f85c0d Further x11 code improvments + comments
Szymon Wilczek <kazeuser@gmail.com>
parents: 3769
diff changeset
67
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
68 /* Data common to all mice */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
69 SDL_WindowID focus;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
70 int which;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
71 int x;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
72 int y;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
73 int z;/*for future use*/
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
74 int xdelta;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
75 int ydelta;
3773
3b5691f85c0d Further x11 code improvments + comments
Szymon Wilczek <kazeuser@gmail.com>
parents: 3769
diff changeset
76
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
77 char* name;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
78 Uint8 buttonstate;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
79 SDL_bool relative_mode;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
80 SDL_bool proximity;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
81 SDL_bool flush_motion;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
82
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
83 SDL_Cursor *cursors;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
84 SDL_Cursor *def_cursor;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
85 SDL_Cursor *cur_cursor;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
86 SDL_bool cursor_shown;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
87
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
88 void *driverdata;
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
89 };
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
90
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
91
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
92 /* Initialize the mouse subsystem */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
93 extern int SDL_MouseInit(void);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
94
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
95 /* Get the mouse at an index */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
96 extern SDL_Mouse *SDL_GetMouse(int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
97
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
98 /* Add a mouse, possibly reattaching at a particular index (or -1),
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
99 returning the index of the mouse, or -1 if there was an error.
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
100 */
3774
8b5b67000dc0 Cursor support added
Szymon Wilczek <kazeuser@gmail.com>
parents: 3773
diff changeset
101 extern int SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name,\
8b5b67000dc0 Cursor support added
Szymon Wilczek <kazeuser@gmail.com>
parents: 3773
diff changeset
102 int pressure_max, int pressure_min, int ends);
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
103
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
104 /* Remove a mouse at an index, clearing the slot for later */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
105 extern void SDL_DelMouse(int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
106
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
107 /* Clear the button state of a mouse at an index */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
108 extern void SDL_ResetMouse(int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
109
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
110 /* Set the mouse focus window */
3776
a9c2a7071874 upgraded functions
Szymon Wilczek <kazeuser@gmail.com>
parents: 3774
diff changeset
111 extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID);
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
112
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
113 /* Send a mouse motion event for a mouse at an index */
3776
a9c2a7071874 upgraded functions
Szymon Wilczek <kazeuser@gmail.com>
parents: 3774
diff changeset
114 extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
115
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
116 /* Send a mouse button event for a mouse at an index */
3776
a9c2a7071874 upgraded functions
Szymon Wilczek <kazeuser@gmail.com>
parents: 3774
diff changeset
117 extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button);
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
118
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
119 /* Send a mouse wheel event for a mouse at an index */
3776
a9c2a7071874 upgraded functions
Szymon Wilczek <kazeuser@gmail.com>
parents: 3774
diff changeset
120 extern int SDL_SendMouseWheel(int id, int x, int y);
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
121
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
122 /* Shutdown the mouse subsystem */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
123 extern void SDL_MouseQuit(void);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
124
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
125 extern int SDL_GetIndexById(int id);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
126
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
127 extern int SDL_SetIndexId(int id, int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
128
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
129 extern int SDL_GetNumOfMice(void);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
130
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
131 extern char* SDL_GetMouseName(int index);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
132
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
133 extern void SDL_UpdateCoordinates(int x, int y);
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
134
3774
8b5b67000dc0 Cursor support added
Szymon Wilczek <kazeuser@gmail.com>
parents: 3773
diff changeset
135 extern void SDL_ChangeEnd(int id, int end);
8b5b67000dc0 Cursor support added
Szymon Wilczek <kazeuser@gmail.com>
parents: 3773
diff changeset
136
8b5b67000dc0 Cursor support added
Szymon Wilczek <kazeuser@gmail.com>
parents: 3773
diff changeset
137 extern int SDL_GetCursorsNumber(int index);
8b5b67000dc0 Cursor support added
Szymon Wilczek <kazeuser@gmail.com>
parents: 3773
diff changeset
138
3769
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
139 #endif /* _SDL_mouse_c_h */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
140
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
141 /* vi: set ts=4 sw=4 expandtab: */
fe32943f86ec Project part 2
Szymon Wilczek <kazeuser@gmail.com>
parents: 3767
diff changeset
142