mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-12 17:46:34 +01:00
when delivering canvas events, if an item is grabbed, use it in preference to Canvas::_current_item, but still propagate to its ancestors if left unhandled
This commit is contained in:
parent
50a014acf0
commit
a329a44cc1
1 changed files with 7 additions and 12 deletions
|
|
@ -506,20 +506,24 @@ GtkCanvas::deliver_event (GdkEvent* event)
|
||||||
{
|
{
|
||||||
/* Point in in canvas coordinate space */
|
/* Point in in canvas coordinate space */
|
||||||
|
|
||||||
|
const Item* event_item;
|
||||||
|
|
||||||
if (_grabbed_item) {
|
if (_grabbed_item) {
|
||||||
/* we have a grabbed item, so everything gets sent there */
|
/* we have a grabbed item, so everything gets sent there */
|
||||||
DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("%1 %2 (%3) was grabbed, send event there\n",
|
DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("%1 %2 (%3) was grabbed, send event there\n",
|
||||||
_grabbed_item, _grabbed_item->whatami(), _grabbed_item->name));
|
_grabbed_item, _grabbed_item->whatami(), _grabbed_item->name));
|
||||||
return _grabbed_item->Event (event);
|
event_item = _grabbed_item;
|
||||||
|
} else {
|
||||||
|
event_item = _current_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_current_item) {
|
if (!event_item) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* run through the items from child to parent, until one claims the event */
|
/* run through the items from child to parent, until one claims the event */
|
||||||
|
|
||||||
Item* item = const_cast<Item*> (_current_item);
|
Item* item = const_cast<Item*> (event_item);
|
||||||
|
|
||||||
while (item) {
|
while (item) {
|
||||||
|
|
||||||
|
|
@ -677,15 +681,6 @@ GtkCanvas::on_motion_notify_event (GdkEventMotion* ev)
|
||||||
|
|
||||||
// DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("canvas motion @ %1, %2\n", ev->x, ev->y));
|
// DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("canvas motion @ %1, %2\n", ev->x, ev->y));
|
||||||
|
|
||||||
if (_grabbed_item) {
|
|
||||||
/* if we have a grabbed item, it gets just the motion event,
|
|
||||||
since no enter/leave events can have happened.
|
|
||||||
*/
|
|
||||||
DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("%1 %2 (%3) was grabbed, send MOTION event there\n",
|
|
||||||
_grabbed_item, _grabbed_item->whatami(), _grabbed_item->name));
|
|
||||||
return _grabbed_item->Event (reinterpret_cast<GdkEvent*> (©));
|
|
||||||
}
|
|
||||||
|
|
||||||
pick_current_item (where, ev->state);
|
pick_current_item (where, ev->state);
|
||||||
|
|
||||||
/* Now deliver the motion event. It may seem a little inefficient
|
/* Now deliver the motion event. It may seem a little inefficient
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue