comparison src/events/SDL_mouse_c.h @ 4465:3e69e077cb95

Removed multi-mouse / multi-keyboard support in anticipation of a real multi-mouse and multi-touch API. Plus, this lets me start implementing cursor support.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 09 May 2010 20:47:22 -0700
parents f7b03b6838cb
children 9322f7db8603
comparison
equal deleted inserted replaced
4464:fa77a6429698 4465:3e69e077cb95
22 #include "SDL_config.h" 22 #include "SDL_config.h"
23 23
24 #ifndef _SDL_mouse_c_h 24 #ifndef _SDL_mouse_c_h
25 #define _SDL_mouse_c_h 25 #define _SDL_mouse_c_h
26 26
27 typedef struct SDL_Mouse SDL_Mouse;
28
29 struct SDL_Cursor 27 struct SDL_Cursor
30 { 28 {
31 SDL_Mouse *mouse;
32 SDL_Cursor *next; 29 SDL_Cursor *next;
33 void *driverdata;
34 };
35
36 struct SDL_Mouse
37 {
38 /* Create a cursor from a surface */
39 SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
40
41 /* Show the specified cursor, or hide if cursor is NULL */
42 int (*ShowCursor) (SDL_Cursor * cursor);
43
44 /* This is called when a mouse motion event occurs */
45 void (*MoveCursor) (SDL_Cursor * cursor);
46
47 /* Free a window manager cursor */
48 void (*FreeCursor) (SDL_Cursor * cursor);
49
50 /* Warp the mouse to (x,y) */
51 void (*WarpMouse) (SDL_Mouse * mouse, SDL_Window * window, int x,
52 int y);
53
54 /* Free the mouse when it's time */
55 void (*FreeMouse) (SDL_Mouse * mouse);
56
57 /* data common for tablets */
58 int pressure;
59 int pressure_max;
60 int pressure_min;
61 int tilt; /* for future use */
62 int rotation; /* for future use */
63 int total_ends;
64 int current_end;
65
66 /* Data common to all mice */
67 int id;
68 SDL_Window *focus;
69 int which;
70 int x;
71 int y;
72 int z; /* for future use */
73 int xdelta;
74 int ydelta;
75 int last_x, last_y; /* the last reported x and y coordinates */
76 char *name;
77 Uint8 buttonstate;
78 SDL_bool relative_mode;
79 SDL_bool proximity;
80 SDL_bool flush_motion;
81
82 SDL_Cursor *cursors;
83 SDL_Cursor *def_cursor;
84 SDL_Cursor *cur_cursor;
85 SDL_bool cursor_shown;
86
87 void *driverdata; 30 void *driverdata;
88 }; 31 };
89 32
90 /* Initialize the mouse subsystem */ 33 /* Initialize the mouse subsystem */
91 extern int SDL_MouseInit(void); 34 extern int SDL_MouseInit(void);
92 35
93 /* Get the mouse at an index */ 36 /* Clear the mouse state */
94 extern SDL_Mouse *SDL_GetMouse(int index); 37 extern void SDL_ResetMouse(void);
95
96 /* Add a mouse, possibly reattaching at a particular index (or -1),
97 returning the index of the mouse, or -1 if there was an error.
98 */
99 extern int SDL_AddMouse(const SDL_Mouse * mouse, char *name,
100 int pressure_max, int pressure_min, int ends);
101
102 /* Remove a mouse at an index, clearing the slot for later */
103 extern void SDL_DelMouse(int index);
104
105 /* Clear the button state of a mouse at an index */
106 extern void SDL_ResetMouse(int index);
107 38
108 /* Set the mouse focus window */ 39 /* Set the mouse focus window */
109 extern void SDL_SetMouseFocus(int id, SDL_Window * window); 40 extern void SDL_SetMouseFocus(SDL_Window * window);
110 41
111 /* Send a mouse motion event for a mouse */ 42 /* Send a mouse motion event */
112 extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z); 43 extern int SDL_SendMouseMotion(int relative, int x, int y);
113 44
114 /* Send a mouse button event for a mouse */ 45 /* Send a mouse button event */
115 extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button); 46 extern int SDL_SendMouseButton(Uint8 state, Uint8 button);
116 47
117 /* Send a mouse wheel event for a mouse */ 48 /* Send a mouse wheel event */
118 extern int SDL_SendMouseWheel(int id, int x, int y); 49 extern int SDL_SendMouseWheel(int x, int y);
119
120 /* Send a proximity event for a mouse */
121 extern int SDL_SendProximity(int id, int x, int y, int type);
122 50
123 /* Shutdown the mouse subsystem */ 51 /* Shutdown the mouse subsystem */
124 extern void SDL_MouseQuit(void); 52 extern void SDL_MouseQuit(void);
125 53
126 /* FIXME: Where do these functions go in this header? */
127 extern void SDL_ChangeEnd(int id, int end);
128
129 #endif /* _SDL_mouse_c_h */ 54 #endif /* _SDL_mouse_c_h */
130 55
131 /* vi: set ts=4 sw=4 expandtab: */ 56 /* vi: set ts=4 sw=4 expandtab: */