#121 Release keyboard grab with Ctrl-Alt.


I've been using VMware for a while and wanted to be
able to release the keyboard grab with Ctrl-Alt as
VMware allows me to do, so I hacked together this patch
to do so. Besides allowing me to use Ctrl-Alt I also
added a lazy grabbing, so that rdesktop doesn't grab
the keyboard until I press a mouse button or the

This patch has a few problems that have to be fixed if
you want to integrate this into rdesktop.

I haven't added any command line flags to
enable/disable ctrl-alt or the lazy grab. I have added
variables in rdesktop.c that control these functions,
so this should be easy to do.

The combination ctrl-alt is hardcoded and the code that
checks for these keys is a bit ugly. It'd be a lot
better if the key combination could be configured by
the user, for example, look at how VMware does this.

If I use full screen mode and press ctrl-alt to release
the focus and then switch to another application, the
rdesktop window still stays on top. If I've read the
code correctly, I think this is because the window has
been created with the redirectoverrride flag. For the
function to be useful with full screen, this has to be


  • Christer Weinigel

    Logged In: YES
    Originator: YES

    I have updated my ctrl-alt/lazy grabbing patch to work with rdesktop-1.5.0.

    There is one small change in the logic of the code, instead of grabbing the focus when any key except ctrl or alt is pressed it only grabs the focus if a non-modifier key is pressed. This allows me to press Ctrl-Alt to ungrab the focus and then press Shift-Ctrl-Alt to move the rdesktop window between different virtual desktops in metacity.

    After playing around with the different command line parameters to rdesktop, I figured out the magic incantation to get rdesktop to behave just the way I want it to:

    rdesktop -D -g 1280x1024 host

    If I do this, whenever rdesktop has focus I get a full screen window (on my 1280x1024 screen) and everything looks just as if I was sitting on the console of the Windows machine. If the rdesktop window loses focus the Linux window manager appears and I can switch to a different virtual desktop without any problem.

    File Added: rdesktop-1.5.0-ctrlalt.patch

  • Christer Weinigel

    Logged In: YES
    Originator: YES

    Sorry for the extra noise here. I just decided to add a command line option "-U" to enable ctrl-alt and to remove the separate "lazy" flag since using ctrl-alt without lazy mode or vice versa was rather useless. So, here's yet another variant of the patch.

    File Added: rdesktop-1.5.0-ctrlalt.patch

  • Christer Weinigel

    File Added: rdesktop-1.6.0-ctrlalt.patch

  • Dalius Dobravolskas

    wingel, thank you for the patch - very useful and practical.

  • Chris Bennett (cgb)

    I'd also like to add my thanks for this patch - it does everything I wished rdesktop supported by default.. Now I can flick through my many virtual desktops in fluxbox and not have my input hijacked by rdesktop... :)

  • mseiwald

    mseiwald - 2011-06-07

    I have adjusted the patch for 1.7.0 and uploaded here: http://pastie.org/2031335

    It seems that only the owner of this ticket can upload files though.