Capture Host HotKey as a Guest HotKey under Wayland (#19105)

Discussions related to using VirtualBox on Linux hosts.
danielsender
Posts: 58
Joined: 21. Mar 2012, 21:34
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: centos 7, windows 7
Location: Berkeley, CA

Capture Host HotKey as a Guest HotKey under Wayland (#19105)

Post by danielsender »


ModEdit; related ticket: #19105: Keyboard capture does not work properly under Wayland
I'm running VB 6.0.14 on an Ubuntu 18.04 system as the host, Centos 7 as the guest. I'm using Gnome Classic in the guest system and I would like to configure some properties on the top and bottom panels. In the host I can simply set alt->right_button and a menu will pop up with a few options, I would like to do the same thing in the guest, that is to use the "Properties" option to make those panels "autohide". However if I do alt->right_button I don't get the menu. I wonder if it is because that combination of keys is not catch by the guest or there is something else. Does anybody know how to do that? Thanks.
Last edited by socratis on 23. Nov 2019, 03:17, edited 3 times in total.
Reason: Added ticket related information.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by socratis »

danielsender wrote:I wonder if it is because that combination of keys is not catch by the guest or there is something else
The Host grabs it, doesn't it? If the Host's Gnome intercepts the keystrokes for itself, there's nothing that VirtualBox can do about it; Gnome has it.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
danielsender
Posts: 58
Joined: 21. Mar 2012, 21:34
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: centos 7, windows 7
Location: Berkeley, CA

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by danielsender »

That's what I was afraid of, so perhaps there is a file that I can edit to set those preferences.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by scottgus1 »

There is no Virtualbox list to control what key combinations are used by the host PC's OS. That question would be good for a forum or instruction website that handles the host OS.
danielsender
Posts: 58
Joined: 21. Mar 2012, 21:34
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: centos 7, windows 7
Location: Berkeley, CA

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by danielsender »

My last question was more related to what is the file in which we have the preferences and edit that directly.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by socratis »

Your last question was properly understood by 'scottgus1', who properly replied to you...

What you're looking for is a Gnome property on your Host, and Scott directed you to seek the answer to a forum/website that deals with Gnome issues. This is not a VirtualBox problem, and there's nothing in VirtualBox that can help you doing what you want.

PS. I changed the title of the thread from "Panel properties" to something more appropriate...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
danielsender
Posts: 58
Joined: 21. Mar 2012, 21:34
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: centos 7, windows 7
Location: Berkeley, CA

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by danielsender »

Yes, your new title is more appropriate - but in my opinion it is still a VB kind of issue, that is how to avoid a key combination to be picked up by the host.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by socratis »

Your host has precedence over the HotKey. How on earth do you expect the applications running on the Host, that never get a chance to see the key that's grabbed by Gnome, to be responsible for that? Gnome won't let the HotKey go nowhere, it's actively looking for it and filtering it, no application gets to see it. VirtualBox doesn't even know that the HotKey got activated!

This is 100% a Gnome issue, I suggest you start thinking it like that...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
danielsender
Posts: 58
Joined: 21. Mar 2012, 21:34
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: centos 7, windows 7
Location: Berkeley, CA

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by danielsender »

I made an experiment, I temporarily switched from Gnome-classic on the host to Ubuntu, hoping that alt->right_click wouldn't be a hot key, but somehow it is. So there must be a file in Gnome where the preferences are stored. Thanks guys.
WillW
Posts: 3
Joined: 18. Nov 2019, 18:30

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by WillW »

I'm using VirtualBox in Fedora 30, with (among others) a Windows 10 Guest. When I hit the Cmd (or 'Windows') key, even if the guest has captured the keyboard, the host processes the keypress. This means I get the GNOME overview, rather than the Guest Start Menu. The same is true for Alt+Tab and other key combinations.

This issue has been reported before as a problem with Wayland and how keyboard capture works. There is this thread from 2017 "Support for wayland keyboard grabbing protocol" linking to a related Wayland issue (I'm too new to post links - sorry). That issue has since been resolved (in 2017), but VirtualBox is still not working correctly. Apparently GNOME boxes does work properly (i haven't tested it).

Is there a workaround to ensure full keyboard capture, or any news on VirtualBox fixing the issue?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by mpack »

VirtualBox can't fix the issue since it isn't a VirtualBox problem. It can't pass keystrokes to the VM if the host intercepts them first.

Bear in mind that VirtualBox is a normal host application. The fact that it simulates hardware for the VM doesn't mean that it has any special powers when it comes to using hardware managed by the host OS.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by socratis »

@'WillW'
I merged your thread with a similar one dealing with the same issue. Please read it from the beginning...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
WillW
Posts: 3
Joined: 18. Nov 2019, 18:30

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by WillW »

Thank you for merging these threads, they are related to the same issue.
socratis wrote:Your host has precedence over the HotKey. How on earth do you expect the applications running on the Host, that never get a chance to see the key that's grabbed by Gnome, to be responsible for that? Gnome won't let the HotKey go nowhere, it's actively looking for it and filtering it, no application gets to see it. VirtualBox doesn't even know that the HotKey got activated!
On X11, Virtual Machine applications could grab any keypress before it got to Gnome. That is how VirtualBox has worked on Gnome for years - if you pressed Alt-Tab when the VM had focus, you'd change program in the VM. If you hit the host key and then Alt-Tab, VirtualBox would send the the keypress to Gnome instead and you'd change out of the VM. The way X11 works, this was possible.

This has changed with Wayland. The underlying reasons are good - Wayland has a strong security model that prevent applications seeing all keypresses (among other things). This is the cause of the issue that we're both seeing here. For a while this issue was a Wayland problem. Wayland has now fixed this issue. I still can't link to the relevant issue, but googling "Red Hat Bugzilla – Bug 1285770" will take you to Keys can't be grabbed under Wayland (needed by remote desktop viewers, virtual machine managers), which describes the situation. The fix was a couple of Wayland extensions, one of which allows applications to request that the compositor not process any shortcut keys and past them direct to the application.

Gnome Boxes is using the extension to provide the keyboard behaviour we all want. Gnome Boxes doesn't have special privileges because it's a Gnome app, they're just taking advantage of the Wayland extension. My question was whether there were any plans for VirtualBox to do the same?
Last edited by socratis on 23. Nov 2019, 03:19, edited 2 times in total.
Reason: Added missing URL.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by socratis »

Thanks for posting the information about the RedHat issue (from 2015-11-26, wow), appreciated. 8)

That lead me to the upstream FreeDesktop ticket #97333: Missing feature for remote desktop and virtual machine software: keyboard grabbing, which was fixed by implementing (yet another?) protocol extension.
WillW wrote:My question was whether there were any plans for VirtualBox to do the same?
I (actually we commoners) wouldn't have the slightest idea, the developers never discuss their plans. For good reasons...

What I would do in your case, if you think that this could be resolved by a VirtualBox update/fix, would be head to the bug tracker and either search for an appropriate ticket (couldn't find any), or open a new ticket.

I wouldn't keep my hopes high though, Wayland is not that high in the priorities AFAIK. For example if Wayland is detected, 3D acceleration is disabled...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
WillW
Posts: 3
Joined: 18. Nov 2019, 18:30

Re: Capture Host HotKey as a Guest HotKey under Wayland

Post by WillW »

I've filed an issue (https://www.virtualbox.org/ticket/19105), so we'll see what happens.
Post Reply