13
0

dragging: add possibility of handling key events mid-drag

Currently only called from a canvas automation track event handler.
This commit is contained in:
Paul Davis 2023-07-10 12:21:27 -06:00
parent 6453049c0a
commit a14c534d16
3 changed files with 30 additions and 1 deletions

View File

@ -410,6 +410,18 @@ Editor::canvas_automation_track_event (GdkEvent *event, ArdourCanvas::Item* item
ret = leave_handler (item, event, AutomationTrackItem);
break;
case GDK_KEY_PRESS:
if (_drags->active()) {
return _drags->mid_drag_key_event (&event->key);
}
break;
case GDK_KEY_RELEASE:
if (_drags->active()) {
return _drags->mid_drag_key_event (&event->key);
}
break;
default:
break;
}

View File

@ -157,6 +157,21 @@ DragManager::preview_video () const
return false;
}
bool
DragManager::mid_drag_key_event (GdkEventKey* ev)
{
bool handled = false;
for (auto & drag : _drags) {
if (drag->mid_drag_key_event (ev)) {
handled = true;
break;
}
}
return handled;
}
void
DragManager::start_grab (GdkEvent* e, Gdk::Cursor* c)
{

View File

@ -95,7 +95,7 @@ public:
~DragManager ();
bool motion_handler (GdkEvent *, bool);
bool mid_drag_key_event (GdkEventKey*);
void abort ();
void add (Drag *);
void set (Drag *, GdkEvent *, Gdk::Cursor* c = MouseCursors::invalid_cursor());
@ -238,6 +238,8 @@ public:
return true;
}
virtual bool mid_drag_key_event (GdkEventKey*) { return false; }
bool initially_vertical() const {
return _initially_vertical;
}