Re: get process pid from xwindow id with Gnome2::Wnck



Hi zentara,

i am doing exactly what you want to do in my little Project "GScrot -
Screenshot Tool" (https://launchpad.net/gscrot) .

Maybe you want to have a look at the code:
http://bazaar.launchpad.net/~mario-kemper/gscrot/devel/annotate/243?file_id=gscrot-20080901014936-h6hz6il8xlqwo9t5-1
Sub "fct_gscrot_window" is the interesting part - line 4779.

Greetings
Mario


Am Donnerstag, den 06.11.2008, 14:32 -0500 schrieb zentara:
Hi,

I'm trying to work out a scheme, of being able to click on an xwindow,
and get the pid of the process.

My first thoughts were to try and use Gnome2::Wnck.

It has a method  $window->get_pid, but the tricky part is
getting the window identified by clicking it with a mouse.

Before I start banging my head on the table, does anyone
have a clue as to how to do this?

I'm assuming you need to do a Gtk2::Gdk->pointer_grab( ) on the root window, 
and watch the button press event. But how can I tell which window, if any,
the button-press was done in?  
What I'm looking for is a pure perl way to get the X window id, like xwininfo does.
Any clues?

Thanks,
zentara





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]