new API for TrackingText and similar items

This commit is contained in:
Paul Davis 2014-06-26 15:07:12 -04:00
parent ae4c4c8f90
commit 3accf1d2af
2 changed files with 43 additions and 0 deletions

View file

@ -767,6 +767,28 @@ GtkCanvas::on_button_release_event (GdkEventButton* ev)
return deliver_event (reinterpret_cast<GdkEvent*>(&copy));
}
bool
GtkCanvas::get_mouse_position (Duple& winpos) const
{
int x;
int y;
Gdk::ModifierType mask;
Glib::RefPtr<Gdk::Window> self = Glib::RefPtr<Gdk::Window>::cast_const (get_window ());
if (!self) {
std::cerr << " no self window\n";
winpos = Duple (0, 0);
return false;
}
Glib::RefPtr<Gdk::Window> win = self->get_pointer (x, y, mask);
winpos.x = x;
winpos.y = y;
return true;
}
/** Handler for GDK motion events.
* @param ev Event.
* @return true if the event was handled.
@ -788,6 +810,8 @@ GtkCanvas::on_motion_notify_event (GdkEventMotion* ev)
DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("canvas motion @ %1, %2 canvas @ %3, %4\n", ev->x, ev->y, copy.motion.x, copy.motion.y));
MouseMotion (point); /* EMIT SIGNAL */
pick_current_item (point, ev->state);
/* Now deliver the motion event. It may seem a little inefficient