summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32graph/open.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2002-04-16 10:00:33 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2002-04-16 10:00:33 +0000
commit21cb8b301b45f8feadbb050e0b4b107c044f41fd (patch)
treee0ffb39905ac61c9a36cd0a512a612972e27282d /otherlibs/win32graph/open.c
parent756a91f939cc6103a98b98190962ecf08ac5f327 (diff)
Corrige la gestion des evenements
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@4679 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32graph/open.c')
-rw-r--r--otherlibs/win32graph/open.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/otherlibs/win32graph/open.c b/otherlibs/win32graph/open.c
index 2b1b6271b..08f5701f0 100644
--- a/otherlibs/win32graph/open.c
+++ b/otherlibs/win32graph/open.c
@@ -19,6 +19,8 @@
#include <windows.h>
static value gr_reset(void);
int MouseLbuttonDown,MouseMbuttonDown,MouseRbuttonDown;
+int MouseLastX, MouseLastY;
+int LastKey = -1;
static long tid;
static HANDLE threadHandle;
HWND grdisplay = NULL;
@@ -73,6 +75,7 @@ static LRESULT CALLBACK GraphicsWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
{
PAINTSTRUCT ps;
HDC hdc;
+
switch (msg) {
// Create the MDI client invisible window
case WM_CREATE:
@@ -113,7 +116,23 @@ static LRESULT CALLBACK GraphicsWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM
case WM_MBUTTONUP:
MouseMbuttonDown = 0;
break;
- default:
+ case WM_CHAR:
+ LastKey = wParam & 0xFF;
+ break;
+ case WM_KEYUP:
+ LastKey = -1;
+ break;
+ case WM_MOUSEMOVE:
+#if 0
+ pt.x = GET_X_LPARAM(lParam);
+ pt.y = GET_Y_LPARAM(lParam);
+ MapWindowPoints(HWND_DESKTOP,grwindow.hwnd,&pt,1);
+ MouseLastX = pt.x;
+ MouseLastY = grwindow.height - 1 - pt.y;
+#else
+ MouseLastX = GET_X_LPARAM(lParam);
+ MouseLastY = grwindow.height - 1 - GET_Y_LPARAM(lParam);
+#endif
break;
}
return DefWindowProc(hwnd,msg,wParam,lParam);
@@ -201,7 +220,8 @@ static DWORD WINAPI gr_open_graph_internal(value arg)
int screenx,screeny;
int attributes;
static int registered;
-
+ MSG msg;
+
gr_initialized = TRUE;
hInst = GetModuleHandle(NULL);
x = y = w = h = CW_USEDEFAULT;
@@ -255,7 +275,8 @@ static DWORD WINAPI gr_open_graph_internal(value arg)
/* Enter the message handling loop */
while (GetMessage(&msg,NULL,0,0)) {
- if (InspectMessages) {
+ if (InspectMessages != NULL) {
+ *InspectMessages = msg;
SetEvent(EventHandle);
Sleep(10);
}