Bug 1140084 - VirtualBox constantly steals focus
Summary: VirtualBox constantly steals focus
Status: IN_PROGRESS
: 1140550 (view as bug list)
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Virtualization:Tools (show other bugs)
Version: Current
Hardware: x86-64 Other
: P5 - None : Major with 5 votes (vote)
Target Milestone: ---
Assignee: Fabian Vogt
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-02 12:57 UTC by Oliver Beiter
Modified: 2022-01-27 10:35 UTC (History)
6 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Beiter 2019-07-02 12:57:36 UTC
Summary: VirtualBox VM immediately steals back focus.

Reproduce: Set up and launch a VBox VM, open a text editor on the host, try to write in it.

Expected behavior: Writing appears in the text editor.

Actual behavior: Focus is on the VM, writing appears there, if a text field was last selected.

See for a possible explanation and workaround: https://bugreports.qt.io/browse/QTBUG-76742
Comment 1 Larry Finger 2019-07-02 15:59:03 UTC
Strange that I had not run into this before. Please give more details. 

What OS is your host, and what OS is your guest?
What version of VirtualBox is on the host?
Are the guest extensions installed? These are not needed for most openSUSE guests.
Comment 2 Larry Finger 2019-07-02 19:09:33 UTC
It seems as if the problem is in Qt. That is what your reference indicates. In addition, running VB and a particular VM fails on Tumbleweed running Qt 5.13.0-1.1. Booting Leap 15.1 running Qt 5.9 works using the same version of VB and the same VM.
Comment 3 Larry Finger 2019-07-03 17:47:22 UTC
I have a workaround until Qt 5.13 is fixed:

wget http://www.lwfinger.com/download/libQt5Gui5-5.13.0-0.x86_64.rpm
sudo zypper install --force libQt5Gui5-5.13.0-0.x86_64.rpm

The zypper install command will tell you that the package is unsigned. Ignore that warning.

This workaround decreases focusInTimer timeout from 400 to 200 as suggested in the QTBUG reference.
Comment 4 Fabian Vogt 2019-07-03 19:04:39 UTC
I had a quick look and VBox source code and left a comment on the linked QTBUG.

(In reply to Larry Finger from comment #3)
> I have a workaround until Qt 5.13 is fixed:
> 
> wget http://www.lwfinger.com/download/libQt5Gui5-5.13.0-0.x86_64.rpm
> sudo zypper install --force libQt5Gui5-5.13.0-0.x86_64.rpm
> 
> The zypper install command will tell you that the package is unsigned.
> Ignore that warning.
> 
> This workaround decreases focusInTimer timeout from 400 to 200 as suggested
> in the QTBUG reference.

I recommend to build that in OBS instead and not just uploading an RPM somewhere. Not only does that save time (now I need to do the same as you did) but it also makes whatever changes you did to Qt visible.
While I assume that you didn't hide a "rm -rf /*" in there, it's theoretically possible...

Qt with the workaround applied is building on OBS now, once it's done you can try

zypper ar obs://home:Vogtinator:boo1140084/openSUSE_Tumbleweed boo1140084
zypper -v dup --from boo1140084

to get the package. Once confirmed to work I'll submit it to TW.
Comment 5 Oliver Beiter 2019-07-04 07:56:44 UTC
Thanks so much for the quick responses guys, the fix is working. And thanks for chiming in at the Qt thread.
Comment 6 Fabian Vogt 2019-07-04 09:19:01 UTC
(In reply to Oliver Beiter from comment #5)
> Thanks so much for the quick responses guys, the fix is working. And thanks
> for chiming in at the Qt thread.

Ok, workaround submitted to TW.
Comment 7 Swamp Workflow Management 2019-07-04 09:50:06 UTC
This is an autogenerated message for OBS integration:
This bug (1140084) was mentioned in
https://build.opensuse.org/request/show/713347 Factory / libqt5-qtbase
Comment 8 Larry Finger 2019-07-04 16:27:16 UTC
(In reply to Oliver Beiter from comment #5)
> Thanks so much for the quick responses guys, the fix is working. And thanks
> for chiming in at the Qt thread.

Your research that found the QTBUG was a critical step in finding the solution. Thanks for that. My only criticism would be that you did not explicitly list the host and guest OS details. If I had not been able to reproduce the problem, finding those details would have taken extra time.
Comment 9 S. B. 2019-07-05 17:58:54 UTC
My workaround:

- In the guest OS window, Ctrl+Home, Input > Keyboard > Keyboard Settings, and disable "Auto Capture Keyboard". 
- So far it is working surprisingly seamlessly without this option, with things like Alt+Tab still getting captured in the host OS. But this took me several hours to diagnose, and "Auto Capture Keyboard" is the default option, so I consider this to be a major bug.
Comment 10 S. B. 2019-07-05 17:59:30 UTC
Dupe
Comment 11 S. B. 2019-07-05 17:59:43 UTC
*** Bug 1140550 has been marked as a duplicate of this bug. ***