RE: Making a cursor (cross hair) track between image displays
- From: "Tilton, James C. (GSFC-6063)" <james c tilton nasa gov>
- To: "jcupitt gmail com" <jcupitt gmail com>
- Cc: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: RE: Making a cursor (cross hair) track between image displays
- Date: Wed, 4 Apr 2012 09:37:19 -0500
Thanks John,
Your response is very helpful. The one key question that remains for me is:
How do I draw a "floating crosshair"?
Thanks.
Jim
________________________________
Dr. James C. Tilton Voice: 301-286-9510
NASA Goddard Space Flight Center FAX: 301-286-1776
Mail Code 606.3 E-Mail: James C Tilton nasa
gov<mailto:James C Tilton nasa gov>
(Computational & Information Sciences and Technology Office)
Greenbelt, MD 20771
URLs: http://ipp.gsfc.nasa.gov/ft_tech_rhseg.shtm and http://science.gsfc.nasa.gov/606.3/TILTON/
-----Original Message-----
From: jcupitt gmail com [mailto:jcupitt gmail com]
Sent: Wednesday, April 04, 2012 4:00 AM
To: Tilton, James C. (GSFC-6063)
Cc: gtk-app-devel-list gnome org
Subject: Re: Making a cursor (cross hair) track between image displays
Hi Jim,
On 2 April 2012 17:00, Tilton, James C. (GSFC-6063)
<james c tilton nasa gov> wrote:
When I place the cursor in one of the display images, I would like to have a cross hair appear at the
cursor location of the window in which the cursor is placed at the location currently pointed to by the
cursor. I would ALSO like to have a similar cross hair appear in each of the other associated display
images.
Add an event handler to the eventbox and listen for GDK_MOTION_NOTIFY.
You need to use gtk_widget_add_events() and turn on motion events with
GDK_POINTER_MOTION_MASK, gtk will not deliver motion events to windows
by default to try to cut down on unnecessary signalling.
(gtk used to support motion event compression, where it would just
report the most recent position rather than all positions since the
last event delivery, but I think this has been deprecated ... perhaps
an expert knows)
Once you have a motion events, use motion.x and motion.y to get the
mouse position, map this to image space, then map out to the
coordinate space for your other image windows. On those other
displays, draw a floating crosshair at the right spot.
My program does something like this, you're welcome to look at the
source if it might help. Though it's a large, hairy thing and perhaps
not a clear example.
http://www.vips.ecs.soton.ac.uk/index.php?title=VIPS
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]