How to set focus to another application?

Lubos Lunak l.lunak at suse.cz
Tue Sep 30 11:53:16 BST 2003


On Monday 29 of September 2003 20:22, shaheed wrote:
> On Monday 29 Sep 2003 1:06 pm, Lubos Lunak wrote:
> >  So, if this is the common case, you already know the answer. If it's
> > not, then please describe it, as there may be different solutions
> > depending on what exactly you want to do.
>
> I am writing a visual keyboard ("viki")  for KDE[1]. Viki is expected to be
> a complete KDE application. When Viki starts and so has focus, the user
> point's'clicks to select a "target" application window such as KWord. The
> user then gets to click on KPushButtons which mimic the real keyboard keys
> but actually deliver events to the target application using XTest's
> XTestFakeKeyEvent().

 Uhm. This is really not the common case. Technically, if you want to focus 
another window as a result of user action, KWin::setActiveWindow() should be 
usually the right choice. However, are you sure the visual keyboard should 
really work that way? I cannot really check, because I don't know the source 
(was that [1] meant to mention URL later?). Wouldn't it be for example better 
if the visual keyboard was a non-focusable window, that would simply feed the 
faked keypresses to whichever window is active? Which with XTest would just 
mean generating the events, as you don't need to target those, they'll go to 
the focused window. The user would then normally change active windows as 
usually.

>
> >  This seems to be a bug in focus stealing prevention, actually.
>
> FWIW, I am running Mandrake 9.1 with KDE 3.1.3. I note your bugfixes in
> this area announced in this week's KDE CVS digest - might this problem be
> fixed in KDE HEAD?
>
> Might there be a workaround for KDE 3.1.3?

 I don't see any problem with KDE3.1.4 here. CVS HEAD had a bug, but it's 
already fixed.

>
> Thanks, Shaheed

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak at suse.cz , l.lunak at kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/





More information about the kde-core-devel mailing list