Re: Making a cursor (cross hair) track between image displays
- From: jcupitt gmail com
- To: "Tilton, James C. (GSFC-6063)" <james c tilton nasa gov>
- 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 08:59:55 +0100
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]