[patch] VBoxSDL --grabimmediate
Warren Block
wblock at wonkity.com
Sat Jan 30 02:39:20 UTC 2010
The attached patch adds a --grabimmediate option to VBoxSDL. This lets
VBoxSDL start with the mouse and keyboard input already grabbed.
Use cases:
For console-only guests, the mouse pointer is useless and only goes away
when the user clicks.
Running full-screen guests, one would usually want the input grabbed
immediately anyway. (It could be argued that the --fullscreen option
should grab input immediately by default.)
To use, copy the patch to /usr/ports/emulators/virtualbox-ose and
rebuild the port.
Feedback welcome.
-Warren Block * Rapid City, South Dakota USA
-------------- next part --------------
--- src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp.orig 2009-12-17 07:27:56.000000000 -0700
+++ src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp 2010-01-28 09:36:27.000000000 -0700
@@ -178,6 +178,7 @@
static const char *gHostKeyDisabledCombinations = "";
static const char *gpszPidFile;
static BOOL gfGrabbed = FALSE;
+static BOOL gfGrabImmediate = FALSE;
static BOOL gfGrabOnMouseClick = TRUE;
static BOOL gfFullscreenResize = FALSE;
static BOOL gfIgnoreNextResize = FALSE;
@@ -663,6 +664,7 @@
" --nohostkey Disable all hostkey combinations\n"
" --nohostkeys ... Disable specific hostkey combinations, see below for valid keys\n"
" --nograbonclick Disable mouse/keyboard grabbing on mouse click w/o additions\n"
+ " --grabimmediate Start with grab active\n"
" --detecthostkey Get the hostkey identifier and modifier state\n"
" --hostkey <key> {<key2>} <mod> Set the host key to the values obtained using --detecthostkey\n"
" --termacpi Send an ACPI power button event when closing the window\n"
@@ -1200,6 +1202,11 @@
{
gfGrabOnMouseClick = FALSE;
}
+ else if ( !strcmp(argv[curArg], "--grabimmediate")
+ || !strcmp(argv[curArg], "-grabimmediate"))
+ {
+ gfGrabImmediate = TRUE;
+ }
else if ( !strcmp(argv[curArg], "--termacpi")
|| !strcmp(argv[curArg], "-termacpi"))
{
@@ -1859,7 +1866,7 @@
// create our SDL framebuffer instance
gpFramebuffer[i] = new VBoxSDLFB(i, fFullscreen, fResizable, fShowSDLConfig, false,
fixedWidth, fixedHeight, fixedBPP);
if (!gpFramebuffer[i])
{
RTPrintf("Error: could not create framebuffer object!\n");
@@ -1996,6 +2003,12 @@
}
#endif
+ /*
+ * WB: --grabimmediate: grab mouse input as soon as possible.
+ */
+ if (gfGrabImmediate)
+ InputGrabStart();
+
rc = E_FAIL;
#ifdef VBOXSDL_ADVANCED_OPTIONS
if (fRawR0 != ~0U)
@@ -2306,7 +2319,7 @@
RTFileWrite(PidFile, pcszLf, strlen(pcszLf), NULL);
RTFileClose(PidFile);
}
/*
* Main event loop
*/
More information about the freebsd-emulation
mailing list