commit b3fda30729bf11e7bac00d4e058ccb3188e7b27f
Author: Sérgio M. Basto <sergio(a)serjux.com>
Date: Tue Apr 7 22:37:30 2020 +0100
rfbz #5598 2 patches: Fix VBox crash when started under Wayland, Fix
keyboard-grab under Wayland
VirtualBox-6.1.4-Xwayland-shortcut-inhibit.patch | 45 ++++++++++++++++++++++++
VirtualBox-6.1.4-wayland-crash.patch | 15 ++++++++
VirtualBox.spec | 9 ++++-
3 files changed, 68 insertions(+), 1 deletion(-)
---
diff --git a/VirtualBox-6.1.4-Xwayland-shortcut-inhibit.patch
b/VirtualBox-6.1.4-Xwayland-shortcut-inhibit.patch
new file mode 100644
index 0000000..1284b6b
--- /dev/null
+++ b/VirtualBox-6.1.4-Xwayland-shortcut-inhibit.patch
@@ -0,0 +1,45 @@
+diff -up VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp~
VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp
+--- VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp~ 2020-02-18
18:19:59.000000000 +0100
++++ VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp 2020-04-06
13:30:21.274027340 +0200
+@@ -2203,6 +2204,17 @@ void UICommon::setWMClass(QWidget *pWidg
+ XSetClassHint(QX11Info::display(), pWidget->window()->winId(),
&windowClass);
+ }
+
++/* static */
++void UICommon::setXwaylandMayGrabKeyboardFlag(QWidget *pWidget)
++{
++ /* Tell the WM we are well behaved wrt Xwayland keyboard-grabs. This will
++ * make the WM turn our grab into a Wayland shortcut inhibition request,
++ * so that e.g. alt+tab will get send to the VM instead of moving the
++ * focus away from the VM. */
++ XXSendClientMessage(QX11Info::display(), pWidget->window()->winId(),
++ "_XWAYLAND_MAY_GRAB_KEYBOARD", 1);
++}
++
+ #endif /* VBOX_WS_X11 */
+
+ /* static */
+diff -up VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h~
VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h
+--- VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h~ 2020-02-18
18:19:59.000000000 +0100
++++ VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h 2020-04-06
13:30:20.345012390 +0200
+@@ -416,6 +416,8 @@ public:
+
+ /** Assigns WM_CLASS property for passed @a pWidget. */
+ static void setWMClass(QWidget *pWidget, const QString &strNameString, const
QString &strClassString);
++ /** Tell the WM the passed @a pWidget window is well behaved wrt XWayland
keyboard-grabs. */
++ static void setXwaylandMayGrabKeyboardFlag(QWidget *pWidget);
+ #endif /* VBOX_WS_X11 */
+
+ /** Assigns minimum @a pSpinBox to correspond to @a cCount digits. */
+diff -up VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp~
VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
+---
VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp~ 2020-04-06
13:18:46.000000000 +0200
++++
VirtualBox-6.1.4/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp 2020-04-06
13:25:52.235673962 +0200
+@@ -135,6 +135,8 @@ void UIMachineWindow::prepare()
+ strWindowName = QString("VirtualBox Machine UUID:
%1").arg(uiCommon().managedVMUuid().toString());
+ /* Assign WM_CLASS property: */
+ UICommon::setWMClass(this, strWindowName, strWindowClass);
++ /* Tell the WM we are well behaved wrt Xwayland keyboard-grabs: */
++ UICommon::setXwaylandMayGrabKeyboardFlag(this);
+ #endif
+ }
+
diff --git a/VirtualBox-6.1.4-wayland-crash.patch b/VirtualBox-6.1.4-wayland-crash.patch
new file mode 100644
index 0000000..48461b2
--- /dev/null
+++ b/VirtualBox-6.1.4-wayland-crash.patch
@@ -0,0 +1,15 @@
+diff -up VirtualBox-6.1.4/src/VBox/Installer/linux/VBox.sh~
VirtualBox-6.1.4/src/VBox/Installer/linux/VBox.sh
+--- VirtualBox-6.1.4/src/VBox/Installer/linux/VBox.sh~ 2020-04-02 18:29:07.000000000
+0200
++++ VirtualBox-6.1.4/src/VBox/Installer/linux/VBox.sh 2020-04-06 10:29:16.560823901
+0200
+@@ -88,6 +88,11 @@ if [ "$SHUTDOWN" = "true" ]; then
+ exit 0
+ fi
+
++# The VirtualBox code uses QX11Info::display() to make direct X11 calls in
++# various places, so it is not ready to run as native Wayland client yet
++# Without this "VirtualBox" crashes immediately at startup under Wayland
++export QT_QPA_PLATFORM=xcb
++
+ APP=`basename $0`
+ case "$APP" in
+ VirtualBox|virtualbox)
diff --git a/VirtualBox.spec b/VirtualBox.spec
index 755c488..ba3d4f9 100644
--- a/VirtualBox.spec
+++ b/VirtualBox.spec
@@ -93,6 +93,8 @@ Patch80: VirtualBox-6.1.4-hacks.patch
Patch81: fixes_for_5.6.patch
Patch82: Clipboard.patch
Patch83: VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch
+Patch84: VirtualBox-6.1.4-wayland-crash.patch
+Patch85: VirtualBox-6.1.4-Xwayland-shortcut-inhibit.patch
BuildRequires: kBuild >= 0.1.9998.r3093
@@ -348,6 +350,8 @@ rm -r src/libs/zlib-1.2.*/
%endif
%patch82 -p1 -b .clipboard
%patch83 -p1 -b .vmsvga-x11-crash
+%patch84 -p1 -b .wayland
+%patch85 -p1 -b .wayland2
%build
@@ -886,7 +890,10 @@ getent passwd vboxadd >/dev/null || \
%changelog
* Sat Apr 04 2020 Sérgio Basto <sergio(a)serjux.com> - 6.1.4-4
- Fix rfbz#5581 USB devices are not available
-- VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch, just for epel7 guest-additions.
+- VirtualBox-6.1.4-VBoxClient-vmsvga-x11-crash.patch, just for epel7
+ guest-additions.
+- rfbz #5598 2 patches: Fix VBox crash when started under Wayland, Fix
+ keyboard-grab under Wayland
* Thu Mar 19 2020 Sérgio Basto <sergio(a)serjux.com> - 6.1.4-3
- Fixes for kernel 5.6 from
Show replies by date