diff --git a/VisualC/SDL/SDL.vcproj b/VisualC/SDL/SDL.vcproj index a9d71d732..f71cdc413 100644 --- a/VisualC/SDL/SDL.vcproj +++ b/VisualC/SDL/SDL.vcproj @@ -77,18 +77,21 @@ /> +#include #include "wmmsg.h" #endif +//#include /* Masks for processing the windows KEYDOWN and KEYUP messages */ #define REPEATED_KEYMASK (1<<30) @@ -125,9 +128,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (!data) { return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); } + #ifdef WMMSG_DEBUG - { - FILE *log = fopen("wmmsg.txt", "a"); + { + FILE *log = fopen("wmmsg.txt", "a"); fprintf(log, "Received windows message: %p ", hwnd); if (msg > MAX_WMMSG) { fprintf(log, "%d", msg); @@ -643,7 +647,39 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } returnCode = 0; break; - } + case WM_TOUCH: + { + //printf("Got Touch Event!\n"); + + FILE *log = fopen("wmmsg.txt", "a"); + fprintf(log, "Received Touch Message: %p ", hwnd); + if (msg > MAX_WMMSG) { + fprintf(log, "%d", msg); + } else { + fprintf(log, "%s", wmtab[msg]); + } + fprintf(log, "WM_TOUCH = %d -- 0x%X, 0x%X\n",msg, wParam, lParam); + fclose(log); + + } + break; + case WM_GESTURE: + { + //printf("Got Touch Event!\n"); + + FILE *log = fopen("wmmsg.txt", "a"); + fprintf(log, "Received Gesture Message: %p ", hwnd); + if (msg > MAX_WMMSG) { + fprintf(log, "%d", msg); + } else { + fprintf(log, "%s", wmtab[msg]); + } + fprintf(log, "WM_GESTURE = %d -- 0x%X, 0x%X\n",msg, wParam, lParam); + fclose(log); + + } + break; + } /* If there's a window proc, assume it's going to handle messages */ if (data->wndproc) { diff --git a/src/video/win32/SDL_win32video.h b/src/video/win32/SDL_win32video.h index fb1e96f96..52b74927a 100644 --- a/src/video/win32/SDL_win32video.h +++ b/src/video/win32/SDL_win32video.h @@ -30,7 +30,14 @@ #define STRICT #define UNICODE #undef WINVER -#define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */ +//#define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */ +#define WINVER 0x601 /* Need 0x600 (_WIN32_WINNT_WIN7) for WM_Touch */ +#if (_WIN32_WINNT < 0x601) +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x601 +#endif + + #include #if SDL_VIDEO_RENDER_D3D diff --git a/src/video/win32/SDL_win32window.c b/src/video/win32/SDL_win32window.c index f69d38573..5cd3fde92 100644 --- a/src/video/win32/SDL_win32window.c +++ b/src/video/win32/SDL_win32window.c @@ -256,7 +256,8 @@ WIN_CreateWindow(_THIS, SDL_Window * window) WIN_SetError("Couldn't create window"); return -1; } - + /*Disable Tablet support, replace with multi-touch.*/ +#if 0 /* we're configuring the tablet data. See Wintab reference for more info */ if (videodata->wintabDLL && videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) { @@ -290,6 +291,9 @@ WIN_CreateWindow(_THIS, SDL_Window * window) } g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE); } +#else + //RegisterTouchWindow(hwnd, 0); +#endif #ifndef _WIN32_WCE /* has no RawInput */ /* we're telling the window, we want it to report raw input events from mice */ Rid.usUsagePage = 0x01; diff --git a/src/video/win32/wmmsg.h b/src/video/win32/wmmsg.h index 812e9cdaa..0c36cf82c 100644 --- a/src/video/win32/wmmsg.h +++ b/src/video/win32/wmmsg.h @@ -283,7 +283,7 @@ char *wmtab[] = { "WM_INITMENU", "WM_INITMENUPOPUP", "UNKNOWN (280)", - "UNKNOWN (281)", + "WM_GESTURE", "UNKNOWN (282)", "UNKNOWN (283)", "UNKNOWN (284)", @@ -578,7 +578,7 @@ char *wmtab[] = { "UNKNOWN (573)", "UNKNOWN (574)", "UNKNOWN (575)", - "UNKNOWN (576)", + "WM_TOUCH", "UNKNOWN (577)", "UNKNOWN (578)", "UNKNOWN (579)", diff --git a/touchTest/touchTest.c b/touchTest/touchTest.c index 66646af4f..68e898527 100644 --- a/touchTest/touchTest.c +++ b/touchTest/touchTest.c @@ -55,7 +55,7 @@ void setpix(SDL_Surface *screen, int x, int y, int col) colour = SDL_MapRGB( screen->format, (col>>16)&0xFF, (col>>8)&0xFF, col&0xFF); - pixmem32 = (Uint32*) screen->pixels + y*screen->pitch/BPP + x; + pixmem32 = (Uint32*) screen->pixels + y*screen->pitch/screen->format->BytesPerPixel + x; //TODO : Check this. May cause crash. *pixmem32 = colour; } @@ -219,6 +219,7 @@ int main(int argc, char* argv[]) } //And draw DrawScreen(screen,h); + printf("Things\n"); /* for(i=0;i<512;i++) if(keystat[i]) printf("%i\n",i); diff --git a/touchTest/touchTest2/touchTest2.ncb b/touchTest/touchTest2/touchTest2.ncb index 284832a93..bab3f3f8a 100644 Binary files a/touchTest/touchTest2/touchTest2.ncb and b/touchTest/touchTest2/touchTest2.ncb differ diff --git a/touchTest/touchTest2/touchTest2.suo b/touchTest/touchTest2/touchTest2.suo index 5e9378cc7..d012c7f0f 100644 Binary files a/touchTest/touchTest2/touchTest2.suo and b/touchTest/touchTest2/touchTest2.suo differ diff --git a/touchTest/touchTest2/touchTest2/SDL.dll b/touchTest/touchTest2/touchTest2/SDL.dll index 73ca7fdd1..a27e9dbd5 100644 Binary files a/touchTest/touchTest2/touchTest2/SDL.dll and b/touchTest/touchTest2/touchTest2/SDL.dll differ diff --git a/touchTest/touchTest2/touchTest2/touchTest2.vcproj b/touchTest/touchTest2/touchTest2/touchTest2.vcproj index 8e06459d5..c0b12274e 100644 --- a/touchTest/touchTest2/touchTest2/touchTest2.vcproj +++ b/touchTest/touchTest2/touchTest2/touchTest2.vcproj @@ -57,7 +57,8 @@ /> + + + +