Fixed mouse position processing for use with a touchscreen.
This commit is contained in:
parent
cde7d63bd5
commit
6b8cedfd62
|
@ -159,32 +159,29 @@ static void queue_kbd_event( const KEYBDINPUT *ki )
|
||||||
*/
|
*/
|
||||||
static void queue_mouse_event( const MOUSEINPUT *mi, WORD keystate )
|
static void queue_mouse_event( const MOUSEINPUT *mi, WORD keystate )
|
||||||
{
|
{
|
||||||
if (mi->dwFlags & MOUSEEVENTF_MOVE)
|
if (mi->dwFlags & MOUSEEVENTF_ABSOLUTE)
|
||||||
{
|
{
|
||||||
if (mi->dwFlags & MOUSEEVENTF_ABSOLUTE)
|
PosX = (mi->dx * GetSystemMetrics(SM_CXSCREEN)) >> 16;
|
||||||
{
|
PosY = (mi->dy * GetSystemMetrics(SM_CYSCREEN)) >> 16;
|
||||||
PosX = (mi->dx * GetSystemMetrics(SM_CXSCREEN)) >> 16;
|
}
|
||||||
PosY = (mi->dy * GetSystemMetrics(SM_CYSCREEN)) >> 16;
|
else if (mi->dwFlags & MOUSEEVENTF_MOVE)
|
||||||
}
|
{
|
||||||
else
|
int width = GetSystemMetrics(SM_CXSCREEN);
|
||||||
{
|
int height = GetSystemMetrics(SM_CYSCREEN);
|
||||||
int width = GetSystemMetrics(SM_CXSCREEN);
|
long posX = (long) PosX, posY = (long) PosY;
|
||||||
int height = GetSystemMetrics(SM_CYSCREEN);
|
|
||||||
long posX = (long) PosX, posY = (long) PosY;
|
|
||||||
|
|
||||||
/* dx and dy can be negative numbers for relative movements */
|
/* dx and dy can be negative numbers for relative movements */
|
||||||
posX += (long)mi->dx;
|
posX += (long)mi->dx;
|
||||||
posY += (long)mi->dy;
|
posY += (long)mi->dy;
|
||||||
|
|
||||||
/* Clip to the current screen size */
|
/* Clip to the current screen size */
|
||||||
if (posX < 0) PosX = 0;
|
if (posX < 0) PosX = 0;
|
||||||
else if (posX >= width) PosX = width - 1;
|
else if (posX >= width) PosX = width - 1;
|
||||||
else PosX = posX;
|
else PosX = posX;
|
||||||
|
|
||||||
if (posY < 0) PosY = 0;
|
if (posY < 0) PosY = 0;
|
||||||
else if (posY >= height) PosY = height - 1;
|
else if (posY >= height) PosY = height - 1;
|
||||||
else PosY = posY;
|
else PosY = posY;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mi->dwFlags & MOUSEEVENTF_MOVE)
|
if (mi->dwFlags & MOUSEEVENTF_MOVE)
|
||||||
|
|
|
@ -477,7 +477,7 @@ static void EVENT_ButtonPress( HWND hWnd, XButtonEvent *event )
|
||||||
break;
|
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);
|
keystate, wData, event->time - X11DRV_server_startticks, hWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ static void EVENT_ButtonRelease( HWND hWnd, XButtonEvent *event )
|
||||||
default:
|
default:
|
||||||
return;
|
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);
|
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,
|
void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
|
||||||
WORD keyState, DWORD data, DWORD time, HWND hWnd )
|
WORD keyState, DWORD data, DWORD time, HWND hWnd )
|
||||||
{
|
{
|
||||||
int width = GetSystemMetrics( SM_CXSCREEN );
|
|
||||||
int height = GetSystemMetrics( SM_CYSCREEN );
|
|
||||||
int iWndsLocks;
|
int iWndsLocks;
|
||||||
WINE_MOUSEEVENT wme;
|
WINE_MOUSEEVENT wme;
|
||||||
|
|
||||||
|
@ -301,12 +299,13 @@ void X11DRV_SendEvent( DWORD mouseStatus, DWORD posX, DWORD posY,
|
||||||
|
|
||||||
TRACE("(%04lX,%ld,%ld)\n", mouseStatus, posX, 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 */
|
/* Relative mouse movements seems not to be scaled as absolute ones */
|
||||||
posX = (((long)posX << 16) + width-1) / width;
|
posX = (((long)posX << 16) + width-1) / width;
|
||||||
posY = (((long)posY << 16) + height-1) / height;
|
posY = (((long)posY << 16) + height-1) / height;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wme.magic = WINE_MOUSEEVENT_MAGIC;
|
wme.magic = WINE_MOUSEEVENT_MAGIC;
|
||||||
|
|
Loading…
Reference in New Issue