comparison src/video/x11/SDL_x11video.c @ 3773:3b5691f85c0d gsoc2008_manymouse

Further x11 code improvments + comments
author Szymon Wilczek <kazeuser@gmail.com>
date Mon, 04 Aug 2008 11:18:10 +0000
parents 9087a84cba51
children
comparison
equal deleted inserted replaced
3772:9087a84cba51 3773:3b5691f85c0d
218 218
219 219
220 int 220 int
221 X11_VideoInit(_THIS) 221 X11_VideoInit(_THIS)
222 { 222 {
223 int i,index=0,c_not_needed; 223 int i,index=0,event_code;
224 XEventClass xEvent; 224 XEventClass xEvent;
225 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 225 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
226 226
227 /* Get the window class name, usually the name of the application */ 227 /* Get the window class name, usually the name of the application */
228 data->classname = get_classname(); 228 data->classname = get_classname();
248 248
249 if (X11_InitKeyboard(_this) != 0) { 249 if (X11_InitKeyboard(_this) != 0) {
250 return -1; 250 return -1;
251 } 251 }
252 X11_InitMouse(_this); 252 X11_InitMouse(_this);
253
253 /*we're generating the table of events that should be recognized*/ 254 /*we're generating the table of events that should be recognized*/
254 for(i=0;i<SDL_NumOfXDevices;++i) 255 for(i=0;i<SDL_NumOfXDevices;++i)
255 { 256 {
256 DeviceKeyPress(SDL_XDevices[i],c_not_needed,xEvent); 257 /*button events*/
257 if (xEvent) SDL_XEvents[index++] = xEvent; 258 DeviceButtonPress(SDL_XDevices[i],event_code,xEvent);
258 DeviceKeyRelease(SDL_XDevices[i],c_not_needed,xEvent); 259 if (xEvent)
259 if (xEvent) SDL_XEvents[index++] = xEvent; 260 {
260 261 SDL_XEvents[index++] = xEvent;
261 /*focus events*/ 262 button_pressed=event_code;
262 DeviceFocusIn(SDL_XDevices[i],c_not_needed,xEvent); 263 }
263 if (xEvent) SDL_XEvents[index++] = xEvent; 264 DeviceButtonRelease(SDL_XDevices[i],event_code,xEvent);
264 DeviceFocusOut(SDL_XDevices[i],c_not_needed,xEvent); 265 if (xEvent)
265 if (xEvent) SDL_XEvents[index++] = xEvent; 266 {
266 267 SDL_XEvents[index++] = xEvent;
267 /*button events*/ 268 button_released=event_code;
268 DeviceButtonPress(SDL_XDevices[i],c_not_needed,xEvent); 269 }
269 if (xEvent) 270
270 { 271 /*proximity events*/
271 SDL_XEvents[index++] = xEvent; 272 ProximityIn(SDL_XDevices[i],event_code,xEvent);
272 button_pressed=c_not_needed; 273 if (xEvent)
273 } 274 {
274 DeviceButtonRelease(SDL_XDevices[i],c_not_needed,xEvent); 275 SDL_XEvents[index++] = xEvent;
275 if (xEvent) 276 proximity_in=event_code;
276 { 277 }
277 SDL_XEvents[index++] = xEvent; 278 ProximityOut(SDL_XDevices[i],event_code,xEvent);
278 button_released=c_not_needed; 279 if (xEvent)
279 } 280 {
280 281 SDL_XEvents[index++] = xEvent;
281 /*proximity events*/ 282 proximity_out=event_code;
282 ProximityIn(SDL_XDevices[i],c_not_needed,xEvent); 283 }
283 if (xEvent) 284
284 { 285 /*motion events*/
285 SDL_XEvents[index++] = xEvent; 286 DeviceMotionNotify(SDL_XDevices[i],event_code,xEvent);
286 proximity_in=c_not_needed; 287 if (xEvent)
287 } 288 {
288 ProximityOut(SDL_XDevices[i],c_not_needed,xEvent); 289 SDL_XEvents[index++] = xEvent;
289 if (xEvent) 290 motion=event_code;
290 { 291 }
291 SDL_XEvents[index++] = xEvent; 292
292 proximity_out=c_not_needed;
293 }
294 /*motion events*/
295 DeviceMotionNotify(SDL_XDevices[i],c_not_needed,xEvent);
296 if (xEvent)
297 {
298 SDL_XEvents[index++] = xEvent;
299 motion=c_not_needed;
300 }
301
302 /*device state*/
303 DeviceStateNotify(SDL_XDevices[i],c_not_needed,xEvent);
304 if (xEvent) SDL_XEvents[index++] = xEvent;
305 DeviceMappingNotify(SDL_XDevices[i],
306 c_not_needed,xEvent);
307 if (xEvent) SDL_XEvents[index++] = xEvent;
308 ChangeDeviceNotify(SDL_XDevices[i],c_not_needed,xEvent);
309 if (xEvent) SDL_XEvents[index++] = xEvent;
310
311 #if 0
312 /* this cuts the motion data down - not sure if this is useful */
313 DevicePointerMotionHint(SDL_XDevices[i],
314 c_not_neededINPUTEVENT_DEVICE_POINTER_MOTION_HINT],xEvent);
315 if (xEvent) SDL_XEvents[index++] = xEvent;
316 #endif
317
318 /*button motion*/
319 DeviceButtonMotion(SDL_XDevices[i],
320 c_not_needed,xEvent);
321 if (xEvent) SDL_XEvents[index++] = xEvent;
322 DeviceButton1Motion(SDL_XDevices[i],
323 c_not_needed,xEvent);
324 if (xEvent) SDL_XEvents[index++] = xEvent;
325 DeviceButton2Motion(SDL_XDevices[i],
326 c_not_needed,xEvent);
327 if (xEvent) SDL_XEvents[index++] = xEvent;
328 DeviceButton3Motion(SDL_XDevices[i],
329 c_not_needed,xEvent);
330 if (xEvent) SDL_XEvents[index++] = xEvent;
331 DeviceButton4Motion(SDL_XDevices[i],
332 c_not_needed,xEvent);
333 if (xEvent) SDL_XEvents[index++] = xEvent;
334 DeviceButton5Motion(SDL_XDevices[i],
335 c_not_needed,xEvent);
336 if (xEvent) SDL_XEvents[index++] = xEvent;
337 } 293 }
338 SDL_NumOfXEvents=index; 294 SDL_NumOfXEvents=index;
339 295
340 return 0; 296 return 0;
341 } 297 }