Commit 75ffaf1d authored by Bob Pendleton's avatar Bob Pendleton

Mouse events now report the correct window id and window enter/leave events are now reported.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403654
parent fa620100
...@@ -97,6 +97,7 @@ SDL_AddMouse(const SDL_Mouse * mouse, char *name, int pressure_max, ...@@ -97,6 +97,7 @@ SDL_AddMouse(const SDL_Mouse * mouse, char *name, int pressure_max,
/* we're setting the mouse properties */ /* we're setting the mouse properties */
length = 0; length = 0;
length = SDL_strlen(name); length = SDL_strlen(name);
SDL_mice[index]->focus = 0;
SDL_mice[index]->name = SDL_malloc((length + 2) * sizeof(char)); SDL_mice[index]->name = SDL_malloc((length + 2) * sizeof(char));
SDL_strlcpy(SDL_mice[index]->name, name, length + 1); SDL_strlcpy(SDL_mice[index]->name, name, length + 1);
SDL_mice[index]->pressure_max = pressure_max; SDL_mice[index]->pressure_max = pressure_max;
......
...@@ -83,8 +83,10 @@ X11_DispatchEvent(_THIS) ...@@ -83,8 +83,10 @@ X11_DispatchEvent(_THIS)
/* Gaining mouse coverage? */ /* Gaining mouse coverage? */
case EnterNotify:{ case EnterNotify:{
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
printf("EnterNotify! (%d,%d)\n", xevent.xcrossing.x, printf("EnterNotify! (%d,%d,%d)\n",
xevent.xcrossing.y); xevent.xcrossing.x,
xevent.xcrossing.y,
xevent.xcrossing.mode);
if (xevent.xcrossing.mode == NotifyGrab) if (xevent.xcrossing.mode == NotifyGrab)
printf("Mode: NotifyGrab\n"); printf("Mode: NotifyGrab\n");
if (xevent.xcrossing.mode == NotifyUngrab) if (xevent.xcrossing.mode == NotifyUngrab)
...@@ -92,10 +94,12 @@ X11_DispatchEvent(_THIS) ...@@ -92,10 +94,12 @@ X11_DispatchEvent(_THIS)
#endif #endif
if ((xevent.xcrossing.mode != NotifyGrab) && if ((xevent.xcrossing.mode != NotifyGrab) &&
(xevent.xcrossing.mode != NotifyUngrab)) { (xevent.xcrossing.mode != NotifyUngrab)) {
#if 1
/* FIXME: Should we reset data for all mice? */ /* FIXME: Should we reset data for all mice? */
#if 0 for (i = 0; i < SDL_GetNumMice(); ++i) {
SDL_SetMouseFocus(0, data->windowID); SDL_Mouse *mouse = SDL_GetMouse(i);
SDL_SendMouseMotion(0, 0, move->x, move->y, 0); SDL_SetMouseFocus(mouse->id, data->windowID);
}
#endif #endif
} }
} }
...@@ -104,8 +108,10 @@ X11_DispatchEvent(_THIS) ...@@ -104,8 +108,10 @@ X11_DispatchEvent(_THIS)
/* Losing mouse coverage? */ /* Losing mouse coverage? */
case LeaveNotify:{ case LeaveNotify:{
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
printf("LeaveNotify! (%d,%d)\n", xevent.xcrossing.x, printf("LeaveNotify! (%d,%d,%d)\n",
xevent.xcrossing.y); xevent.xcrossing.x,
xevent.xcrossing.y,
xevent.xcrossing.mode);
if (xevent.xcrossing.mode == NotifyGrab) if (xevent.xcrossing.mode == NotifyGrab)
printf("Mode: NotifyGrab\n"); printf("Mode: NotifyGrab\n");
if (xevent.xcrossing.mode == NotifyUngrab) if (xevent.xcrossing.mode == NotifyUngrab)
...@@ -114,9 +120,12 @@ X11_DispatchEvent(_THIS) ...@@ -114,9 +120,12 @@ X11_DispatchEvent(_THIS)
if ((xevent.xcrossing.mode != NotifyGrab) && if ((xevent.xcrossing.mode != NotifyGrab) &&
(xevent.xcrossing.mode != NotifyUngrab) && (xevent.xcrossing.mode != NotifyUngrab) &&
(xevent.xcrossing.detail != NotifyInferior)) { (xevent.xcrossing.detail != NotifyInferior)) {
#if 1
/* FIXME: Should we reset data for all mice? */ /* FIXME: Should we reset data for all mice? */
#if 0 for (i = 0; i < SDL_GetNumMice(); ++i) {
SDL_SetMouseFocus(0, 0); SDL_Mouse *mouse = SDL_GetMouse(i);
SDL_SetMouseFocus(mouse->id, 0);
}
#endif #endif
} }
} }
......
...@@ -52,6 +52,8 @@ X11_InitMouse(_THIS) ...@@ -52,6 +52,8 @@ X11_InitMouse(_THIS)
#endif #endif
int num_mice = 0; int num_mice = 0;
SDL_zero(mouse);
#if SDL_VIDEO_DRIVER_X11_XINPUT #if SDL_VIDEO_DRIVER_X11_XINPUT
/* we're getting the list of input devices */ /* we're getting the list of input devices */
n = 0; n = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment