Commit c66b0d4cf4ef84325d3f579c0e3ea5254d7b348a

Authored by bellard
1 parent 8785a8dd

avoid stopping QEMU when switching desktops with Ctrl-Alt-x


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1954 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 11 additions and 3 deletions
... ... @@ -447,10 +447,18 @@ static void sdl_refresh(DisplayState *ds)
447 447 gui_key_modifier_pressed = 0;
448 448 if (gui_keysym == 0) {
449 449 /* exit/enter grab if pressing Ctrl-Alt */
450   - if (!gui_grab)
451   - sdl_grab_start();
452   - else
  450 + if (!gui_grab) {
  451 + /* if the application is not active,
  452 + do not try to enter grab state. It
  453 + prevents
  454 + 'SDL_WM_GrabInput(SDL_GRAB_ON)'
  455 + from blocking all the application
  456 + (SDL bug). */
  457 + if (SDL_GetAppState() & SDL_APPACTIVE)
  458 + sdl_grab_start();
  459 + } else {
453 460 sdl_grab_end();
  461 + }
454 462 /* SDL does not send back all the
455 463 modifiers key, so we must correct it */
456 464 reset_keys();
... ...