2

I am trying to debug a full-screen application which uses OIS for input. The program grabs control of mouse and keyboard.

When I hit a breakpoint (i'm using gdb), I cannot continue, step, or do anything, because I can't reach the console. CTRL+ALT+F1 gets me to the shell where I can kill gdb, but that doesn't help (since I still want to step/backtrace etc.).

Instead, I'd like to hit CTRL+ALT+F1 and then "disable" the grab which the paused full-screen application has, possibly using some command-line-tool. Is there such a program?

I know there are hacks which I can add to OIS/my Program, but I'd like an external method.

I've tried adding "AllowDeactivateGrabs" to xorg.conf (as suggested here), but that doesn't seem to work any more (?).

Using: Ubuntu 14.04 Gnome

2
  • Welcome to Ask Ubuntu! if you want help with your program consider adding script as code to your question also so the others could see where did you miss a point/symbols etc.
    – JoKeR
    May 21, 2015 at 18:17
  • Thanks, but this has nothing to do with the code itself. If I had a coding problem, I'd probably have asked it on StackOverflow. I'm looking for a (command line) tool to disable the grabbing of the keyboard input. May 21, 2015 at 21:28

1 Answer 1

2

There's an answer one might try on StackOverflow: https://stackoverflow.com/questions/23795010

For a full screen application barteks2x suggestion of running a separate x server and swiching to it via Ctrl-Alt-Fn might be useful.

He makes 5 suggestions. The section I found useful, and is done from the shell, is copied here.This is directly copied from barteks2x answer:

You can add a second mouse pointer using xinput:

  • Run xinput create-master pointer-name. A second mouse pointer should appear on the screen. This creates keyboard/pointer pair, you don't need to do anything with the second added keyboard. It won't be attached to any physical device.

  • Run xinput list to list all your devices

    On my laptop it looks like this:

.

 ⎡ Virtual core pointer                      id=2    [master pointer  (3)]
 ⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]

 ⎜   ↳ ETPS/2 Elantech Touchpad                  id=14   [slave  pointer  (2)]
 ⎜   ↳ A4Tech USB Mouse                          id=11   [slave  pointer  (2)]
 ⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Video Bus                                 id=8    [slave  keyboard (3)]
    ↳ Power Button                              id=9    [slave  keyboard (3)]
    ↳ Lenovo EasyCamera                         id=10   [slave  keyboard (3)]
    ↳ Ideapad extra buttons                     id=12   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=13   [slave  keyboard (3)]
⎡ new-mouse pointer                         id=15   [master pointer  (16)]
⎜   ↳ new-mouse XTEST pointer                   id=17   [slave  pointer  (15)]
⎣ new-mouse keyboard                        id=16   [master keyboard (15)]
    ↳ new-mouse XTEST keyboard                  id=18   [slave  keyboard (16)]
  • The newly added mouse pointer (master device) has id=15. I have a touchpad and an external mouse so I can attach one of them to the new cursor and leave the other attached to the old cursor. If you don't have 2 physical devices - you can leave the old pointer with no physical device attached.

  • Now run xinput reattach slave-device-id master-device-id. For example if I want to attach my touchpad to the new pointer: xinput reattach 14 15

    After this you should be able to control the newly added pointer.

  • When you no longer want the second mouse pointer use xinput remove-master master-device-id, in my case it would be xinput remove-master 15

  • sometimes you may need to reattach the device to the previous master device.

    Note: It's better to add the new pointer before you start debugging. I also noticed that some window managers have some issues with multiple cursors that cause all kinds of unexpected bugs - for example "typing stops working", or typing works but in the wrong window. So leaving multiple cursors enabled normally may not be a good option.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .