[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: How to get active main window using DCOP
From:       Thomas Kadauke <tkadauke () gmx ! de>
Date:       2006-07-17 10:46:57
Message-ID: 200607171246.57655.tkadauke () gmx ! de
[Download RAW message or body]

Am Monday 17 July 2006 03:06 schrieb Frerich Raabe:
> On Sunday 16 July 2006 22:57, Thomas Kadauke wrote:
> > Hi everyone,
> >
> > I have a simple question: How can I find out which main window is an
> > application's active window using DCOP? I.e. suppose that I have kwrite
> > running with 3 different documents open. How can I find out which window
> > is the one that is active / was active most recently? I need a
> > (hopefully) simple solution that works with every KDE application that
> > uses
> > KMainWindow.
>
> Hmm, you could iterate over the 'foo-mainwindow#n' interfaces of some
> application (my kmail has 'kmail-mainwindow#1' and I just tried it with
> KWrite and the kwrite process had 'kwrite-mainwindow#1'
> and 'kwrite-mainwindow#2'). I'm not sure how standard that is (maybe it
> comes from KMainWindow?), it does not seem to work for Konversation. ;-/
>
> In any case, once you have the interfaces, you could call 'focus' (or
> maybe 'isActiveWindow' but I'd have to look up what that does) to figure
> out which window is 'active' in the sense that it has the focus.

This doesn't seem to be bullet-proof, as I need to call a mainwindow's actions 
from another application via DCOP. For the KWrite example, I need to know 
which mainwindow of which kwrite process was active most recently (among 
other things). The KAppDCOPInterface class doesn't support anything like 
that.

Since the individual applications' interfaces are too different, it looks like 
the best idea to implement the needed functionality on a per-application 
basis (at least until the DCOP/D-BUS interfaces are extended and unified to 
support my needs :) ).

> Hope that helps.

Thanks!

--Thomas
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic