File fixes_focus_steal.patch of Package virtualbox

Index: a/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
===================================================================
--- a/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp (revision 131843)
+++ b/src/VBox/Frontends/VirtualBox/src/runtime/UIKeyboardHandler.cpp
(working copy)
@@ -269,6 +269,14 @@
          * the keyboard before the target window sees the click. (GNOME Shell's hot corner has
          * the same problem. At present we just let that problem be.) */

+        /* Make sure we really do still have the focus: */
+        xcb_get_input_focus_cookie_t xcbFocusCookie = xcb_get_input_focus(QX11Info::connection());
+        xcb_get_input_focus_reply_t *pFocusReply = xcb_get_input_focus_reply(QX11Info::connection(), xcbFocusCookie, 0);
+        xcb_window_t xcbFocusWindow = pFocusReply->focus;
+        free(pFocusReply);
+        if (xcbFocusWindow != m_windows[m_iKeyboardCaptureViewIndex]->winId())
+            return true;
+
         /* Grab the mouse button.
          * We do not check for failure as we do not currently implement a back-up plan. */
         /* If any previous grab is still in process, release it. */