KDE

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • How to get active main window using DCOP

    2 answers - 505 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi everyone,
    I have a simple question: How can I find out which main window is an
    application's active window using DCP? 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.
    Thanks,

    >Visit #unsub to unsubscribe <<
  • No.1 | | 1242 bytes | |

    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 DCP? 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.

    Hope that helps.
    - Frerich

    >Visit #unsub to unsubscribe <<
  • No.2 | | 1913 bytes | |

    Am Monday 17 July 2006 03:06 schrieb Frerich Raabe:
    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 DCP? 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 DCP. For the KWrite example, I need to know
    which mainwindow of which kwrite process was active most recently (among
    other things). The KAppDCPInterface 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 DCP/D-BUS interfaces are extended and unified to
    support my needs :) ).

    Hope that helps.

    Thanks!


    >Visit #unsub to unsubscribe <<

Re: How to get active main window using DCOP


max 4000 letters.
Your nickname that display:
In order to stop the spam: 3 + 2 =
QUESTION ON "KDE"

EMSDN.COM