summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32graph/open.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>2003-07-07 13:17:41 +0000
committerXavier Leroy <xavier.leroy@inria.fr>2003-07-07 13:17:41 +0000
commitc2f25eba38e238fcd46d4054cf9895c4c78cf94a (patch)
treee961a35f91285b5345a1aaa0dd9fe6a281936495 /otherlibs/win32graph/open.c
parentef110660c174e12431180117c0bdda20aa70f0fe (diff)
Suite nettoyage. Amelioration gestion evenements (PR#1735)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5665 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32graph/open.c')
-rw-r--r--otherlibs/win32graph/open.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/otherlibs/win32graph/open.c b/otherlibs/win32graph/open.c
index 9457129b6..b40086231 100644
--- a/otherlibs/win32graph/open.c
+++ b/otherlibs/win32graph/open.c
@@ -36,7 +36,7 @@ int grcolor;
extern HFONT * grfont;
MSG msg;
-HANDLE EventHandle;
+HANDLE EventHandle, EventProcessedHandle;
static char *szOcamlWindowClass = "OcamlWindowClass";
static BOOL gr_initialized = 0;
CAMLprim value gr_clear_graph(void);
@@ -166,7 +166,6 @@ static value gr_reset(void)
grwindow.width = rc.right;
grwindow.height = rc.bottom;
if (grwindow.gcBitmap == (HDC)0) {
-// grwindow.hBitmap = CreateCompatibleBitmap(grwindow.gc,grwindow.width,grwindow.height);
grwindow.hBitmap = CreateCompatibleBitmap(grwindow.gc,screenx,screeny);
grwindow.gcBitmap = CreateCompatibleDC(grwindow.gc);
grwindow.tempDC = CreateCompatibleDC(grwindow.gc);
@@ -268,6 +267,7 @@ static DWORD WINAPI gr_open_graph_internal(value arg)
grwindow.gry = 0;
EventHandle = CreateEvent(NULL,0,0,NULL);
+ EventProcessedHandle = CreateEvent(NULL,0,0,NULL);
/* The global data structures are now correctly initialized.
Restart the Caml main thread. */
@@ -279,12 +279,14 @@ static DWORD WINAPI gr_open_graph_internal(value arg)
if (InspectMessages != NULL) {
*InspectMessages = msg;
SetEvent(EventHandle);
- Sleep(10);
}
TranslateMessage(&msg); // Translates virtual key codes
DispatchMessage(&msg); // Dispatches message to window
if (!IsWindow(grwindow.hwnd))
break;
+ if (InspectMessages != NULL) {
+ WaitForSingleObject(EventProcessedHandle,INFINITE);
+ }
}
return 0;
}