VirtualBox

Changeset 10430 in vbox


Ignore:
Timestamp:
Jul 9, 2008 2:20:37 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33090
Message:

VBoxSDL: added -nohostkeys parameter to disable dedicated hostkey combinations (customer demanded feature)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxSDL/VBoxSDL.cpp

    r8834 r10430  
    163163static int gHostKeySym2 = SDLK_UNKNOWN;
    164164#endif
     165static char *gHostKeyDisabledCombinations;
    165166static BOOL gfGrabbed = FALSE;
    166167static BOOL gfGrabOnMouseClick = TRUE;
     
    645646             "  -nofstoggle              Forbid switching to/from fullscreen mode\n"
    646647             "  -noresize                Make the SDL frame non resizable\n"
    647              "  -nohostkey               Disable hostkey\n"
     648             "  -nohostkey               Disable all hostkey combinations\n"
     649             "  -nohostkeys ...          Disable specific hostkey combinations, see below for valid keys\n"
    648650             "  -nograbonclick           Disable mouse/keyboard grabbing on mouse click w/o additions\n"
    649651             "  -detecthostkey           Get the hostkey identifier and modifier state\n"
     
    12911293            gHostKeyMod  = 0;
    12921294            gHostKeySym1 = 0;
     1295        }
     1296        else if (strcmp(argv[curArg], "-nohostkeys") == 0)
     1297        {
     1298            if (++curArg >= argc)
     1299            {
     1300                RTPrintf("Error: missing a string of disabled hostkey combinations\n");
     1301                rc = E_FAIL;
     1302                break;
     1303            }
     1304            gHostKeyDisabledCombinations = argv[curArg];
     1305            unsigned i, cStr = strlen(gHostKeyDisabledCombinations);
     1306            for (i=0; i<cStr; i++)
     1307            {
     1308                if (!strchr("fhnpqrs", gHostKeyDisabledCombinations[i]))
     1309                {
     1310                    RTPrintf("Error: <hostkey> + '%c' is not a valid combination\n",
     1311                            gHostKeyDisabledCombinations[i]);
     1312                    rc = E_FAIL;
     1313                    i = cStr;
     1314                    break;
     1315                }
     1316            }
    12931317        }
    12941318        else if (strcmp(argv[curArg], "-nograbonclick") == 0)
     
    44874511        case SDLK_f:
    44884512        {
    4489             if (gfAllowFullscreenToggle)
    4490             {
    4491                 /*
    4492                  * We have to pause/resume the machine during this
    4493                  * process because there might be a short moment
    4494                  * without a valid framebuffer
    4495                  */
    4496                 MachineState_T machineState;
    4497                 gMachine->COMGETTER(State)(&machineState);
    4498                 if (machineState == MachineState_Running)
    4499                     gConsole->Pause();
    4500                 gpFrameBuffer->setFullscreen(!gpFrameBuffer->getFullscreen());
    4501                 if (machineState == MachineState_Running)
    4502                     gConsole->Resume();
    4503 
    4504                 /*
    4505                  * We have switched from/to fullscreen, so request a full
    4506                  * screen repaint, just to be sure.
    4507                  */
    4508                 gDisplay->InvalidateAndUpdate();
    4509             }
     4513            if (   strchr(gHostKeyDisabledCombinations, 'f')
     4514                || !gfAllowFullscreenToggle)
     4515                return VERR_NOT_SUPPORTED;
     4516
     4517            /*
     4518             * We have to pause/resume the machine during this
     4519             * process because there might be a short moment
     4520             * without a valid framebuffer
     4521             */
     4522            MachineState_T machineState;
     4523            gMachine->COMGETTER(State)(&machineState);
     4524            if (machineState == MachineState_Running)
     4525                gConsole->Pause();
     4526            gpFrameBuffer->setFullscreen(!gpFrameBuffer->getFullscreen());
     4527            if (machineState == MachineState_Running)
     4528                gConsole->Resume();
     4529
     4530            /*
     4531             * We have switched from/to fullscreen, so request a full
     4532             * screen repaint, just to be sure.
     4533             */
     4534            gDisplay->InvalidateAndUpdate();
    45104535            break;
    45114536        }
     
    45164541        case SDLK_p:
    45174542        {
     4543            if (strchr(gHostKeyDisabledCombinations, 'p'))
     4544                return VERR_NOT_SUPPORTED;
     4545
    45184546            MachineState_T machineState;
    45194547            gMachine->COMGETTER(State)(&machineState);
     
    45374565        case SDLK_r:
    45384566        {
     4567            if (strchr(gHostKeyDisabledCombinations, 'r'))
     4568                return VERR_NOT_SUPPORTED;
     4569
    45394570            ResetVM();
    45404571            break;
     
    45464577        case SDLK_q:
    45474578        {
     4579            if (strchr(gHostKeyDisabledCombinations, 'q'))
     4580                return VERR_NOT_SUPPORTED;
     4581
    45484582            return VINF_EM_TERMINATE;
    4549             break;
    45504583        }
    45514584
     
    45554588        case SDLK_s:
    45564589        {
     4590            if (strchr(gHostKeyDisabledCombinations, 's'))
     4591                return VERR_NOT_SUPPORTED;
     4592
    45574593            SaveState();
    45584594            return VINF_EM_TERMINATE;
     
    45614597        case SDLK_h:
    45624598        {
     4599            if (strchr(gHostKeyDisabledCombinations, 'h'))
     4600                return VERR_NOT_SUPPORTED;
     4601
    45634602            if (gConsole)
    45644603                gConsole->PowerButton();
     
    45714610        case SDLK_n:
    45724611        {
     4612            if (strchr(gHostKeyDisabledCombinations, 'n'))
     4613                return VERR_NOT_SUPPORTED;
     4614
    45734615            RTThreadYield();
    45744616            ULONG cSnapshots = 0;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette