From 2527a33351101081fa24d1413165772537240585 Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Sun, 23 Jan 2000 22:31:24 +0000 Subject: [PATCH] Added -dxgrab command line option, which confines cursor motion to the DirectX primary surface. --- graphics/ddraw.c | 5 +++++ include/options.h | 1 + misc/main.c | 1 + windows/x11drv/event.c | 2 +- windows/x11drv/main.c | 3 +++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/graphics/ddraw.c b/graphics/ddraw.c index 804df3f0286..7011efa9389 100644 --- a/graphics/ddraw.c +++ b/graphics/ddraw.c @@ -4094,6 +4094,11 @@ static HRESULT WINAPI Xlib_IDirectDrawImpl_SetDisplayMode( } TRACE("Setting drawable to %ld\n", This->d.drawable); + if (Options.DXGrab) { + /* Confine cursor movement (risky, but the user asked for it) */ + TSXGrabPointer(display, This->d.drawable, True, 0, GrabModeAsync, GrabModeAsync, This->d.drawable, None, CurrentTime); + } + return DD_OK; } diff --git a/include/options.h b/include/options.h index 772425a6759..c6278ec70fd 100644 --- a/include/options.h +++ b/include/options.h @@ -75,6 +75,7 @@ struct options int perfectGraphics; /* Favor correctness over speed for graphics */ int noDGA; /* Disable XFree86 DGA extensions */ int noXSHM; /* Disable use of XSHM extension */ + int DXGrab; /* Enable DirectX mouse grab */ char * configFileName; /* Command line config file */ int screenDepth; }; diff --git a/misc/main.c b/misc/main.c index 9ec3198d89e..d24cc4baf28 100644 --- a/misc/main.c +++ b/misc/main.c @@ -132,6 +132,7 @@ static char szUsage[] = " -name name Set the application name\n" " -nodga Disable XFree86 DGA extensions\n" " -noxshm Disable XSHM extension\n" + " -dxgrab Enable DirectX mouse grab\n" " -perfect Favor correctness over speed for graphical operations\n" " -privatemap Use a private color map\n" " -synchronous Turn on synchronous display mode\n" diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c index a54fb6ac8d1..04fd21caecd 100644 --- a/windows/x11drv/event.c +++ b/windows/x11drv/event.c @@ -2120,7 +2120,7 @@ static void X11DRV_EVENT_WaitReplaceShmCompletionInternal( int *compl, Drawable TRACE("Wait complete (thread %lx) (time %ld)\n", GetCurrentThreadId(), GetTickCount() ); /* clear wait */ - st = InterlockedExchange(&shm_q[n-1].state, 2); + st = InterlockedExchange((LPLONG)&shm_q[n-1].state, 2); if (st != 2) { /* first waiter to return, release all other waiters */ nn = shm_q[n-1].waiter; diff --git a/windows/x11drv/main.c b/windows/x11drv/main.c index 63450a3c03c..45db8faaa1a 100644 --- a/windows/x11drv/main.c +++ b/windows/x11drv/main.c @@ -70,6 +70,7 @@ static XrmOptionDescRec optionsTable[] = { "-config", ".config", XrmoptionSepArg, (caddr_t)NULL }, { "-nodga", ".nodga", XrmoptionNoArg, (caddr_t)"off"}, { "-noxshm", ".noxshm", XrmoptionNoArg, (caddr_t)"off"}, + { "-dxgrab", ".dxgrab", XrmoptionNoArg, (caddr_t)"on" }, { "-console", ".console", XrmoptionSepArg, (caddr_t)NULL }, { "-dosver", ".dosver", XrmoptionSepArg, (caddr_t)NULL } }; @@ -290,6 +291,8 @@ void X11DRV_USER_ParseOptions(int *argc, char *argv[]) Options.noDGA = TRUE; if (X11DRV_USER_GetResource( db, ".noxshm", &value)) Options.noXSHM = TRUE; + if (X11DRV_USER_GetResource( db, ".dxgrab", &value)) + Options.DXGrab = TRUE; if (X11DRV_USER_GetResource( db, ".console", &value)) driver.driver_list = xstrdup((char *)value.addr); else