[vbox-dev] How-to bring VirtualBox VM window to focus ?

Michael Thayer michael.thayer at oracle.com
Tue Jun 14 07:30:48 GMT 2011

Hello Aleksey,

The (modern) X11 way of doing this is to send a _NET_ACTIVE_WINDOW
client message to the window, which the window manager will see and act
on.  See src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

I'm afraid thought that I don't have time just now to move the
functionality from the GUI into Main.



On Sun, 2011-06-12 at 02:38 +0300, Alexey Eromenko wrote:
> update: I was able to solve the Linux case (by help of IRC #python channel)
> Just 3 lines of code:
> ======================
> import gtk
> wrapped_window = gtk.gdk.window_foreign_new(int(hwnd))
> wrapped_window.focus()
> ======================
> However, this requires end-users to manually disable "Focus stealing
> prevention" in KDE.
> Any ideas on how-to make it work out-of-the-box ?

ORACLE Deutschland B.V. & Co. KG   Michael Thayer
Werkstrasse 24                     VirtualBox engineering
71384 Weinstadt, Germany           mailto:michael.thayer at oracle.com

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven

More information about the vbox-dev mailing list