Fixed bug #795
Andrey 2009-09-14 21:16:53 PDT WinCE GetCursorPos fixed I'm using iPAQ HP rx5919, with Windows Mobile 5. And I also use mingw32ce 0.59.1 toolchain. I fixed this, see attachment patch. --HG-- branch : SDL-1.2 extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%403860
This commit is contained in:
parent
73eadb4777
commit
954609b91e
1 changed files with 42 additions and 64 deletions
|
@ -88,74 +88,37 @@ WPARAM rotateKey(WPARAM key,int direction)
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for gapi landscape mode */
|
static void GapiTransform(GapiInfo *gapiInfo, LONG *x, LONG *y) {
|
||||||
static void GapiTransform(SDL_ScreenOrientation rotate, char hires, Sint16 *x, Sint16 *y) {
|
|
||||||
Sint16 rotatedX;
|
Sint16 rotatedX;
|
||||||
Sint16 rotatedY;
|
Sint16 rotatedY;
|
||||||
|
|
||||||
if (hires) {
|
if(gapiInfo->userOrientation == SDL_ORIENTATION_UP &&
|
||||||
*x = *x * 2;
|
gapiInfo->gapiOrientation == SDL_ORIENTATION_RIGHT)
|
||||||
*y = *y * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(rotate) {
|
|
||||||
case SDL_ORIENTATION_UP:
|
|
||||||
{
|
{
|
||||||
/* this code needs testing on a real device!
|
rotatedX = *x;
|
||||||
So it will be enabled later */
|
|
||||||
/*
|
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
#if _WIN32_WCE >= 420
|
|
||||||
// test device orientation
|
|
||||||
// FIXME: do not check every mouse message
|
|
||||||
DEVMODE settings;
|
|
||||||
SDL_memset(&settings, 0, sizeof(DEVMODE));
|
|
||||||
settings.dmSize = sizeof(DEVMODE);
|
|
||||||
settings.dmFields = DM_DISPLAYORIENTATION;
|
|
||||||
ChangeDisplaySettingsEx(NULL, &settings, NULL, CDS_TEST, NULL);
|
|
||||||
if( settings.dmOrientation == DMDO_90 )
|
|
||||||
{
|
|
||||||
rotatedX = SDL_VideoSurface->h - *x;
|
|
||||||
rotatedY = *y;
|
rotatedY = *y;
|
||||||
*x = rotatedX;
|
*x = rotatedX;
|
||||||
*y = rotatedY;
|
*y = rotatedY;
|
||||||
}
|
}
|
||||||
#endif
|
else
|
||||||
#endif */
|
if(gapiInfo->userOrientation == SDL_ORIENTATION_RIGHT &&
|
||||||
}
|
gapiInfo->gapiOrientation == SDL_ORIENTATION_RIGHT)
|
||||||
break;
|
{
|
||||||
// FIXME: Older version used just SDL_VideoSurface->(w, h)
|
|
||||||
// w and h are "clipped" while x and y are "raw", which caused
|
|
||||||
// x in former and y in latter case to be clipped in a wrong direction,
|
|
||||||
// thus offsetting the coordinate on 2 x clip pixels
|
|
||||||
// (like, 128 for 640 -> 512 clipping).
|
|
||||||
// We will now try to extract and use raw values.
|
|
||||||
// The way to do that RIGHT is do (orientation-dependent) clipping before
|
|
||||||
// doing this transform, but it's hardly possible.
|
|
||||||
|
|
||||||
// SEE SDL_mouse.c /ClipOffset to understand these calculations.
|
|
||||||
case SDL_ORIENTATION_RIGHT:
|
|
||||||
if (!SDL_VideoSurface)
|
|
||||||
break;
|
|
||||||
rotatedX = (2 * ((SDL_VideoSurface->offset%SDL_VideoSurface->pitch)/
|
rotatedX = (2 * ((SDL_VideoSurface->offset%SDL_VideoSurface->pitch)/
|
||||||
SDL_VideoSurface->format->BytesPerPixel))
|
SDL_VideoSurface->format->BytesPerPixel))
|
||||||
+ SDL_VideoSurface->w - *y;
|
+ SDL_VideoSurface->w - *y;
|
||||||
rotatedY = *x;
|
rotatedY = *x;
|
||||||
*x = rotatedX;
|
*x = rotatedX;
|
||||||
*y = rotatedY;
|
*y = rotatedY;
|
||||||
break;
|
}
|
||||||
case SDL_ORIENTATION_LEFT:
|
else
|
||||||
if (!SDL_VideoSurface)
|
{
|
||||||
break;
|
rotatedX = SDL_VideoSurface->w - *y;
|
||||||
rotatedX = *y;
|
rotatedY = *x;
|
||||||
rotatedY = (2 * (SDL_VideoSurface->offset/SDL_VideoSurface->pitch))
|
|
||||||
+ SDL_VideoSurface->h - *x;
|
|
||||||
*x = rotatedX;
|
|
||||||
*y = rotatedY;
|
*y = rotatedY;
|
||||||
break;
|
*x = rotatedX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -339,13 +302,28 @@ LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
|
||||||
return(DefWindowProc(hwnd, msg, wParam, lParam));
|
return(DefWindowProc(hwnd, msg, wParam, lParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
static BOOL GetLastStylusPos(POINT* ptLast)
|
||||||
|
{
|
||||||
|
BOOL bResult = FALSE;
|
||||||
|
UINT nRet;
|
||||||
|
GetMouseMovePoints(ptLast, 1, &nRet);
|
||||||
|
if ( nRet == 1 ) {
|
||||||
|
ptLast->x /= 4;
|
||||||
|
ptLast->y /= 4;
|
||||||
|
bResult = TRUE;
|
||||||
|
}
|
||||||
|
return bResult;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void DIB_GenerateMouseMotionEvent(_THIS)
|
static void DIB_GenerateMouseMotionEvent(_THIS)
|
||||||
{
|
{
|
||||||
extern int mouse_relative;
|
extern int mouse_relative;
|
||||||
extern int posted;
|
extern int posted;
|
||||||
|
|
||||||
POINT mouse;
|
POINT mouse;
|
||||||
GetCursorPos( &mouse );
|
if(!GetCursorPos( &mouse ) && !GetLastStylusPos( &mouse )) return;
|
||||||
|
|
||||||
if ( mouse_relative ) {
|
if ( mouse_relative ) {
|
||||||
POINT center;
|
POINT center;
|
||||||
|
@ -363,7 +341,7 @@ static void DIB_GenerateMouseMotionEvent(_THIS)
|
||||||
ScreenToClient(SDL_Window, &mouse);
|
ScreenToClient(SDL_Window, &mouse);
|
||||||
#ifdef SDL_VIDEO_DRIVER_GAPI
|
#ifdef SDL_VIDEO_DRIVER_GAPI
|
||||||
if (SDL_VideoSurface && this->hidden->gapiInfo)
|
if (SDL_VideoSurface && this->hidden->gapiInfo)
|
||||||
GapiTransform(this->hidden->gapiInfo->coordinateTransform, this->hidden->gapiInfo->hiresFix, &mouse.x, &mouse.y);
|
GapiTransform(this->hidden->gapiInfo, &mouse.x, &mouse.y);
|
||||||
#endif
|
#endif
|
||||||
posted = SDL_PrivateMouseMotion(0, 0, mouse.x, mouse.y);
|
posted = SDL_PrivateMouseMotion(0, 0, mouse.x, mouse.y);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue