src/video/windows/SDL_windowsevents.c
changeset 6950 1ddb72193079
parent 6947 18ccf3e4921d
child 6951 7833f01322b3
equal deleted inserted replaced
6949:4de584a3a027 6950:1ddb72193079
   189 void 
   189 void 
   190 WIN_CheckWParamMouseButton( SDL_bool bwParamMousePressed, SDL_bool bSDLMousePressed, SDL_WindowData *data, Uint8 button )
   190 WIN_CheckWParamMouseButton( SDL_bool bwParamMousePressed, SDL_bool bSDLMousePressed, SDL_WindowData *data, Uint8 button )
   191 {
   191 {
   192 	if ( bwParamMousePressed && !bSDLMousePressed )
   192 	if ( bwParamMousePressed && !bSDLMousePressed )
   193 	{
   193 	{
   194 		SDL_SendMouseButton(data->window, SDL_PRESSED, button);
   194 		SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button);
   195 	}
   195 	}
   196 	else if ( !bwParamMousePressed && bSDLMousePressed )
   196 	else if ( !bwParamMousePressed && bSDLMousePressed )
   197 	{
   197 	{
   198 		SDL_SendMouseButton(data->window, SDL_RELEASED, button);
   198 		SDL_SendMouseButton(data->window, 0, SDL_RELEASED, button);
   199 	}
   199 	}
   200 }
   200 }
   201 
   201 
   202 /*
   202 /*
   203 * Some windows systems fail to send a WM_LBUTTONDOWN sometimes, but each mouse move contains the current button state also
   203 * Some windows systems fail to send a WM_LBUTTONDOWN sometimes, but each mouse move contains the current button state also
   374         returnCode = 0;
   374         returnCode = 0;
   375         break;
   375         break;
   376 
   376 
   377 	case WM_MOUSEMOVE:
   377 	case WM_MOUSEMOVE:
   378 		if( !SDL_GetMouse()->relative_mode )
   378 		if( !SDL_GetMouse()->relative_mode )
   379 	        SDL_SendMouseMotion(data->window, 0, LOWORD(lParam), HIWORD(lParam));
   379 	        SDL_SendMouseMotion(data->window, 0, 0, LOWORD(lParam), HIWORD(lParam));
   380 		/* don't break here, fall through to check the wParam like the button presses */
   380 		/* don't break here, fall through to check the wParam like the button presses */
   381 	case WM_LBUTTONUP:
   381 	case WM_LBUTTONUP:
   382 	case WM_RBUTTONUP:
   382 	case WM_RBUTTONUP:
   383 	case WM_MBUTTONUP:
   383 	case WM_MBUTTONUP:
   384 	case WM_XBUTTONUP:
   384 	case WM_XBUTTONUP:
   406 		{
   406 		{
   407 			RAWMOUSE* mouse = &inp.data.mouse;
   407 			RAWMOUSE* mouse = &inp.data.mouse;
   408 
   408 
   409 			if((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE)
   409 			if((mouse->usFlags & 0x01) == MOUSE_MOVE_RELATIVE)
   410 			{
   410 			{
   411 				SDL_SendMouseMotion(data->window, 1, (int)mouse->lLastX, (int)mouse->lLastY);
   411 				SDL_SendMouseMotion(data->window, 0, 1, (int)mouse->lLastX, (int)mouse->lLastY);
   412 			}
   412 			}
   413 			else
   413 			else
   414 			{
   414 			{
   415 				// synthesize relative moves from the abs position
   415 				// synthesize relative moves from the abs position
   416 				static SDL_Point initialMousePoint;
   416 				static SDL_Point initialMousePoint;
   418 				{
   418 				{
   419 					initialMousePoint.x = mouse->lLastX;
   419 					initialMousePoint.x = mouse->lLastX;
   420 					initialMousePoint.y = mouse->lLastY;
   420 					initialMousePoint.y = mouse->lLastY;
   421 				}
   421 				}
   422 
   422 
   423 				SDL_SendMouseMotion(data->window, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
   423 				SDL_SendMouseMotion(data->window, 0, 1, (int)(mouse->lLastX-initialMousePoint.x), (int)(mouse->lLastY-initialMousePoint.y) );
   424 
   424 
   425 				initialMousePoint.x = mouse->lLastX;
   425 				initialMousePoint.x = mouse->lLastX;
   426 				initialMousePoint.y = mouse->lLastY;
   426 				initialMousePoint.y = mouse->lLastY;
   427 			}
   427 			}
   428 			WIN_CheckRawMouseButtons( mouse->usButtonFlags, data ); 
   428 			WIN_CheckRawMouseButtons( mouse->usButtonFlags, data ); 
   433     case WM_MOUSEWHEEL:
   433     case WM_MOUSEWHEEL:
   434         {
   434         {
   435             // FIXME: This may need to accumulate deltas up to WHEEL_DELTA
   435             // FIXME: This may need to accumulate deltas up to WHEEL_DELTA
   436             short motion = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
   436             short motion = GET_WHEEL_DELTA_WPARAM(wParam) / WHEEL_DELTA;
   437 
   437 
   438             SDL_SendMouseWheel(data->window, 0, motion);
   438             SDL_SendMouseWheel(data->window, 0, 0, motion);
   439             break;
   439             break;
   440         }
   440         }
   441 
   441 
   442 #ifdef WM_MOUSELEAVE
   442 #ifdef WM_MOUSELEAVE
   443     /* FIXME: Do we need the SDL 1.2 hack to generate WM_MOUSELEAVE now? */
   443     /* FIXME: Do we need the SDL 1.2 hack to generate WM_MOUSELEAVE now? */