Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Further x11 code improvments + comments

  • Loading branch information
Szymon Wilczek committed Aug 4, 2008
1 parent 27a9875 commit a1f6dc456a6961cf77f18641009bb000d1df59df
Showing with 47 additions and 87 deletions.
  1. +8 −5 src/events/SDL_mouse_c.h
  2. +36 −80 src/video/x11/SDL_x11video.c
  3. +3 −2 src/video/x11/SDL_x11window.c
@@ -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;
@@ -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;i<SDL_NumOfXDevices;++i)
{
DeviceKeyPress(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
DeviceKeyRelease(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;

/*focus events*/
DeviceFocusIn(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
DeviceFocusOut(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;

/*button events*/
DeviceButtonPress(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
button_pressed=c_not_needed;
}
DeviceButtonRelease(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
button_released=c_not_needed;
}
{
/*button events*/
DeviceButtonPress(SDL_XDevices[i],event_code,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
button_pressed=event_code;
}
DeviceButtonRelease(SDL_XDevices[i],event_code,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
button_released=event_code;
}

/*proximity events*/
ProximityIn(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
proximity_in=c_not_needed;
}
ProximityOut(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
proximity_out=c_not_needed;
}
/*motion events*/
DeviceMotionNotify(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
motion=c_not_needed;
}
/*proximity events*/
ProximityIn(SDL_XDevices[i],event_code,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
proximity_in=event_code;
}
ProximityOut(SDL_XDevices[i],event_code,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
proximity_out=event_code;
}

/*device state*/
DeviceStateNotify(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
DeviceMappingNotify(SDL_XDevices[i],
c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
ChangeDeviceNotify(SDL_XDevices[i],c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;

#if 0
/* this cuts the motion data down - not sure if this is useful */
DevicePointerMotionHint(SDL_XDevices[i],
c_not_neededINPUTEVENT_DEVICE_POINTER_MOTION_HINT],xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
#endif
/*motion events*/
DeviceMotionNotify(SDL_XDevices[i],event_code,xEvent);
if (xEvent)
{
SDL_XEvents[index++] = xEvent;
motion=event_code;
}

/*button motion*/
DeviceButtonMotion(SDL_XDevices[i],
c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
DeviceButton1Motion(SDL_XDevices[i],
c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
DeviceButton2Motion(SDL_XDevices[i],
c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
DeviceButton3Motion(SDL_XDevices[i],
c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
DeviceButton4Motion(SDL_XDevices[i],
c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
DeviceButton5Motion(SDL_XDevices[i],
c_not_needed,xEvent);
if (xEvent) SDL_XEvents[index++] = xEvent;
}
SDL_NumOfXEvents=index;

@@ -490,7 +490,6 @@ X11_CreateWindow(_THIS, SDL_Window * window)
PointerMotionMask | KeyPressMask | KeyReleaseMask |
PropertyChangeMask | StructureNotifyMask |
KeymapStateMask | fevent));
XSelectExtensionEvent(data->display, 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;
}

0 comments on commit a1f6dc4

Please sign in to comment.