Thus spoke Kevin Myers
> The other day I sent the following message to both the gimp users and gimp
> developers lists, hoping to determine whether there is any way to obtain
> image coordinates from a mouse click in a gimp plug-in.  So far I haven't
> received a single reply.  Are there really any of you out there??? :-)  Even
> if you don't know or can't answer my question, it might be nice to receive a
> few replies anyway so I can at least confirm that my message actually got
> through ok.

The developers are here.  Probably just busy.  :-)
I saw you're message the other day but didn't have time to look into it.

> If there is presently no way for a gimp plug-in to obtain mouse click image
> coordinates (either at point of menu invocation or later), then I would like
> to submit this as a suggestion to be considered for a future release.

I'm not aware of a way to get the mouse coordinates from a mouse click in a
canvas window over to the plug-in.  Normally, plug-ins will copy the drawable
(layer, selection, or whatever) into their own space to work on it, and
translate their (possibly) scaled version's coordinates into those on the
canvas.  While not optimal, it should work for you.  

The problem, as I see it, is that the communications channel between the GIMP
and plug-ins is not event driven but rather function driven - you must invoke
an API call to communicate with the GIMP.  Actually, I don't think of that as a
problem.  It's just the way things work.  At least from what I know.  

One way around this - which would probably be an ugly hack - would be to have
the GIMP save the click location for a canvas and let the plug-in query for
that location.  It might be similar to a one-pixel selection.  Might be a
problem in knowing when a click is supposed to set that location and when it's
supposed to be applied to the currently active tool.

Anyway, it's just a thought.  For now, you need to copy the drawable into your
space to get coordinates via a preview window.

BTW, if anyone is interested, I've updated Shawn Amundson's preview widget and
put it into a Glade-based template plug-in.  That might be helpful as a start
for you.  Or maybe not.  It's still a work in progress to make it a very useful
template.  Needs documentation, etc.  But you can use Glade to edit the

It's imake based 'cuz I know imake, not autoconf.
Michael J. Hammel           |      Knowledge comes,
The Graphics Muse           |      but wisdom lingers.
[EMAIL PROTECTED]  |            Tennyson, "Locksley Hall" 
Gimp-developer mailing list

Reply via email to