activateWindow, forceActiveWindow

Frank Osterfeld frank at kdab.net
Tue Mar 4 19:01:02 CET 2008


On Monday 03 March 2008 09:22:06 Kevin Kofler wrote:
> Hi,
>
> I believe the current implementations of activateWindow and
> forceActiveWindow in kwindowsystem_win.cpp don't implement the same
> semantics as their X11 versions. The issue is that SetActiveWindow only
> works within a thread (in particular, only in the same application),
> whereas on X11,
> KWindowSystem::activateWindow works just fine across applications.
> Moreover, forceActiveWindow doesn't really force the active window, i.e.
> bypass focus steal prevention, as it's supposed to.
>
> I believe it would be more compliant to have activateWindow call
> SetForegroundWindow( win ); (is calling SetActiveWindow first really
> necessary?) and forceActiveWindow use some hack like
> http://vb.mvps.org/articles/ap199902.pdf (I've also seen some other hacks,
> like sending a fake user input event to the window to activate, but I can't
> find them now.)

SetForegroundWindow() from an application in the background only works when 
AllowSetForeground() was called by the currently active application.
For Kleopatra, we have the problem that we must force a window to be in the 
foreground while another application is active (The client of kleopatra, 
Outlook or the Explorer in this case). We made the client plugins (which we 
control) call AllowSetForeground() before triggering the operation in 
kleopatra. The SetForegroundWindow() call in kleopatra works then (and only 
then). But that's a special case of course and doesn't help in general.

-- 
Frank Osterfeld -- frank at kdab.net
Klarälvdalens Datakonsult AB, Platform-independent software solutions



More information about the Kde-windows mailing list