From a1f6dc456a6961cf77f18641009bb000d1df59df Mon Sep 17 00:00:00 2001 From: Szymon Wilczek Date: Mon, 4 Aug 2008 11:18:10 +0000 Subject: [PATCH] Further x11 code improvments + comments --- src/events/SDL_mouse_c.h | 13 ++-- src/video/x11/SDL_x11video.c | 116 +++++++++++----------------------- src/video/x11/SDL_x11window.c | 5 +- 3 files changed, 47 insertions(+), 87 deletions(-) diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index 9ff7ddf9c..0c4d6b00b 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -56,6 +56,13 @@ struct SDL_Mouse /* Free the mouse when it's time */ void (*FreeMouse) (SDL_Mouse * mouse); + /*data common for tablets*/ + int pressure; + int pressure_max; + int pressure_min; + int tilt;/*for future use*/ + int rotation;/*for future use*/ + /* Data common to all mice */ SDL_WindowID focus; int which; @@ -64,11 +71,7 @@ struct SDL_Mouse int z;/*for future use*/ int xdelta; int ydelta; - int pressure; - int pressure_max; - int pressure_min; - int tilt;/*for future use*/ - int rotation;/*for future use*/ + char* name; Uint8 buttonstate; SDL_bool relative_mode; diff --git a/src/video/x11/SDL_x11video.c b/src/video/x11/SDL_x11video.c index b3dbdc365..4f142f047 100644 --- a/src/video/x11/SDL_x11video.c +++ b/src/video/x11/SDL_x11video.c @@ -220,7 +220,7 @@ VideoBootStrap X11_bootstrap = { int X11_VideoInit(_THIS) { - int i,index=0,c_not_needed; + int i,index=0,event_code; XEventClass xEvent; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; @@ -250,90 +250,46 @@ X11_VideoInit(_THIS) return -1; } X11_InitMouse(_this); + /*we're generating the table of events that should be recognized*/ for(i=0;idisplay, w, SDL_XEvents, SDL_NumOfXEvents); } #else XMapWindow(data->display,w); @@ -500,9 +499,11 @@ X11_CreateWindow(_THIS, SDL_Window * window) PointerMotionMask | KeyPressMask | KeyReleaseMask | PropertyChangeMask | StructureNotifyMask | KeymapStateMask)); - XSelectExtensionEvent(data->display, w, SDL_XEvents, SDL_NumOfXEvents); #endif + /*we're informing the display what extension events we want to receive from it*/ + XSelectExtensionEvent(data->display, w, SDL_XEvents, SDL_NumOfXEvents); + return 0; }