Fixed mouse position processing for use with a touchscreen.
This commit is contained in:
parent
cde7d63bd5
commit
6b8cedfd62
|
@ -158,15 +158,13 @@ static void queue_kbd_event( const KEYBDINPUT *ki )
|
|||
* queue_mouse_event
|
||||
*/
|
||||
static void queue_mouse_event( const MOUSEINPUT *mi, WORD keystate )
|
||||
{
|
||||
if (mi->dwFlags & MOUSEEVENTF_MOVE)
|
||||
{
|
||||
if (mi->dwFlags & MOUSEEVENTF_ABSOLUTE)
|
||||
{
|
||||
PosX = (mi->dx * GetSystemMetrics(SM_CXSCREEN)) >> 16;
|
||||
PosY = (mi->dy * GetSystemMetrics(SM_CYSCREEN)) >> 16;
|
||||
}
|
||||
else
|
||||
else if (mi->dwFlags & MOUSEEVENTF_MOVE)
|
||||
{
|
||||
int width = GetSystemMetrics(SM_CXSCREEN);
|
||||
int height = GetSystemMetrics(SM_CYSCREEN);
|
||||
|
@ -185,7 +183,6 @@ static void queue_mouse_event( const MOUSEINPUT *mi, WORD keystate )
|
|||
else if (posY >= height) PosY = height - 1;
|
||||
else PosY = posY;
|
||||
}
|
||||
}
|
||||
|
||||
if (mi->dwFlags & MOUSEEVENTF_MOVE)
|
||||
{
|
||||
|
|
|
@ -477,7 +477,7 @@ static void EVENT_ButtonPress( HWND hWnd, XButtonEvent *event )
|
|||
break;
|
||||
}
|
||||
|
||||
X11DRV_SendEvent( statusCodes[buttonNum], pt.x, pt.y,
|
||||
X11DRV_SendEvent( statusCodes[buttonNum] | MOUSEEVENTF_ABSOLUTE, pt.x, pt.y,
|
||||
keystate, wData, event->time - X11DRV_server_startticks, hWnd);
|
||||
}
|
||||
|
||||
|
@ -518,7 +518,7 @@ static void EVENT_ButtonRelease( HWND hWnd, XButtonEvent *event )
|
|||
default:
|
||||
return;
|
||||
}
|
||||
X11DRV_SendEvent( statusCodes[buttonNum], pt.x, pt.y,
|
||||
X11DRV_SendEvent( statusCodes[buttonNum] | MOUSEEVENTF_ABSOLUTE, pt.x, pt.y,
|
||||
keystate, 0, event->time - X11DRV_server_startticks, hWnd);
|
||||
}
|
||||
|
||||
|
|
|
@ -292,8 +292,6 @@ void X11DRV_InitMouse( LPMOUSE_EVENT_PROC proc )
|
|||
void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
|
||||
WORD keyState, DWORD data, DWORD time, HWND hWnd )
|
||||
{
|
||||
int width = GetSystemMetrics( SM_CXSCREEN );
|
||||
int height = GetSystemMetrics( SM_CYSCREEN );
|
||||
int iWndsLocks;
|
||||
WINE_MOUSEEVENT wme;
|
||||
|
||||
|
@ -301,13 +299,14 @@ void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
|
|||
|
||||
TRACE("(%04lX,%ld,%ld)\n", mouseStatus, posX, posY );
|
||||
|
||||
if (mouseStatus & MOUSEEVENTF_MOVE) {
|
||||
if (mouseStatus & MOUSEEVENTF_ABSOLUTE) {
|
||||
if (mouseStatus & MOUSEEVENTF_ABSOLUTE)
|
||||
{
|
||||
int width = GetSystemMetrics( SM_CXSCREEN );
|
||||
int height = GetSystemMetrics( SM_CYSCREEN );
|
||||
/* Relative mouse movements seems not to be scaled as absolute ones */
|
||||
posX = (((long)posX << 16) + width-1) / width;
|
||||
posY = (((long)posY << 16) + height-1) / height;
|
||||
}
|
||||
}
|
||||
|
||||
wme.magic = WINE_MOUSEEVENT_MAGIC;
|
||||
wme.time = time;
|
||||
|
|
Loading…
Reference in New Issue