comparison src/video/x11/SDL_x11mouse.c @ 1336:3692456e7b0f

Use SDL_ prefixed versions of C library functions. FIXME: Change #include <stdlib.h> to #include "SDL_stdlib.h" Change #include <string.h> to #include "SDL_string.h" Make sure nothing else broke because of this...
author Sam Lantinga <slouken@libsdl.org>
date Tue, 07 Feb 2006 06:59:48 +0000
parents c9b51268668f
children 604d73db6802
comparison
equal deleted inserted replaced
1335:c39265384763 1336:3692456e7b0f
47 SDL_Lock_EventThread(); 47 SDL_Lock_EventThread();
48 pXFreeCursor(SDL_Display, cursor->x_cursor); 48 pXFreeCursor(SDL_Display, cursor->x_cursor);
49 pXSync(SDL_Display, False); 49 pXSync(SDL_Display, False);
50 SDL_Unlock_EventThread(); 50 SDL_Unlock_EventThread();
51 } 51 }
52 free(cursor); 52 SDL_free(cursor);
53 } 53 }
54 54
55 WMcursor *X11_CreateWMCursor(_THIS, 55 WMcursor *X11_CreateWMCursor(_THIS,
56 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y) 56 Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
57 { 57 {
64 char *x_data, *x_mask; 64 char *x_data, *x_mask;
65 static XColor black = { 0, 0, 0, 0 }; 65 static XColor black = { 0, 0, 0, 0 };
66 static XColor white = { 0xffff, 0xffff, 0xffff, 0xffff }; 66 static XColor white = { 0xffff, 0xffff, 0xffff, 0xffff };
67 67
68 /* Allocate the cursor memory */ 68 /* Allocate the cursor memory */
69 cursor = (WMcursor *)malloc(sizeof(WMcursor)); 69 cursor = (WMcursor *)SDL_malloc(sizeof(WMcursor));
70 if ( cursor == NULL ) { 70 if ( cursor == NULL ) {
71 SDL_OutOfMemory(); 71 SDL_OutOfMemory();
72 return(NULL); 72 return(NULL);
73 } 73 }
74 74
75 /* Mix the mask and the data */ 75 /* Mix the mask and the data */
76 clen = (w/8)*h; 76 clen = (w/8)*h;
77 x_data = (char *)malloc(clen); 77 x_data = (char *)SDL_malloc(clen);
78 if ( x_data == NULL ) { 78 if ( x_data == NULL ) {
79 free(cursor); 79 SDL_free(cursor);
80 SDL_OutOfMemory(); 80 SDL_OutOfMemory();
81 return(NULL); 81 return(NULL);
82 } 82 }
83 x_mask = (char *)malloc(clen); 83 x_mask = (char *)SDL_malloc(clen);
84 if ( x_mask == NULL ) { 84 if ( x_mask == NULL ) {
85 free(cursor); 85 SDL_free(cursor);
86 free(x_data); 86 SDL_free(x_data);
87 SDL_OutOfMemory(); 87 SDL_OutOfMemory();
88 return(NULL); 88 return(NULL);
89 } 89 }
90 for ( i=0; i<clen; ++i ) { 90 for ( i=0; i<clen; ++i ) {
91 /* The mask is OR'd with the data to turn inverted color 91 /* The mask is OR'd with the data to turn inverted color
197 { 197 {
198 int i; 198 int i;
199 int accel_value[3]; 199 int accel_value[3];
200 char *mouse_param, *mouse_param_buf, *pin; 200 char *mouse_param, *mouse_param_buf, *pin;
201 201
202 mouse_param_buf = (char *)malloc(strlen(accel_param)+1); 202 mouse_param_buf = (char *)SDL_malloc(SDL_strlen(accel_param)+1);
203 if ( ! mouse_param_buf ) { 203 if ( ! mouse_param_buf ) {
204 return; 204 return;
205 } 205 }
206 strcpy(mouse_param_buf, accel_param); 206 SDL_strcpy(mouse_param_buf, accel_param);
207 mouse_param = mouse_param_buf; 207 mouse_param = mouse_param_buf;
208 208
209 for ( i=0; (i < 3) && mouse_param; ++i ) { 209 for ( i=0; (i < 3) && mouse_param; ++i ) {
210 pin = strchr(mouse_param, '/'); 210 pin = SDL_strchr(mouse_param, '/');
211 if ( pin ) { 211 if ( pin ) {
212 *pin = '\0'; 212 *pin = '\0';
213 } 213 }
214 accel_value[i] = atoi(mouse_param); 214 accel_value[i] = atoi(mouse_param);
215 if ( pin ) { 215 if ( pin ) {
219 } 219 }
220 } 220 }
221 if ( mouse_param_buf ) { 221 if ( mouse_param_buf ) {
222 pXChangePointerControl(SDL_Display, True, True, 222 pXChangePointerControl(SDL_Display, True, True,
223 accel_value[0], accel_value[1], accel_value[2]); 223 accel_value[0], accel_value[1], accel_value[2]);
224 free(mouse_param_buf); 224 SDL_free(mouse_param_buf);
225 } 225 }
226 } 226 }
227 227
228 /* Check to see if we need to enter or leave mouse relative mode */ 228 /* Check to see if we need to enter or leave mouse relative mode */
229 void X11_CheckMouseModeNoLock(_THIS) 229 void X11_CheckMouseModeNoLock(_THIS)
233 233
234 /* Allow the user to override the relative mouse mode. 234 /* Allow the user to override the relative mouse mode.
235 They almost never want to do this, as it seriously affects 235 They almost never want to do this, as it seriously affects
236 applications that rely on continuous relative mouse motion. 236 applications that rely on continuous relative mouse motion.
237 */ 237 */
238 env_override = getenv("SDL_MOUSE_RELATIVE"); 238 env_override = SDL_getenv("SDL_MOUSE_RELATIVE");
239 if ( env_override ) { 239 if ( env_override ) {
240 enable_relative = atoi(env_override); 240 enable_relative = atoi(env_override);
241 } 241 }
242 242
243 /* If the mouse is hidden and input is grabbed, we use relative mode */ 243 /* If the mouse is hidden and input is grabbed, we use relative mode */
254 /* Use as raw mouse mickeys as possible */ 254 /* Use as raw mouse mickeys as possible */
255 pXGetPointerControl(SDL_Display, 255 pXGetPointerControl(SDL_Display,
256 &mouse_accel.numerator, 256 &mouse_accel.numerator,
257 &mouse_accel.denominator, 257 &mouse_accel.denominator,
258 &mouse_accel.threshold); 258 &mouse_accel.threshold);
259 xmouse_accel=getenv("SDL_VIDEO_X11_MOUSEACCEL"); 259 xmouse_accel=SDL_getenv("SDL_VIDEO_X11_MOUSEACCEL");
260 if ( xmouse_accel ) { 260 if ( xmouse_accel ) {
261 SetMouseAccel(this, xmouse_accel); 261 SetMouseAccel(this, xmouse_accel);
262 } 262 }
263 } 263 }
264 mouse_relative = 1; 264 mouse_relative = 1;