From b8edf6f0a6edccb5cbedfe429c4dcfb1878fa1bd Mon Sep 17 00:00:00 2001 From: Iurie Nistor Date: Wed, 8 May 2024 10:13:34 +0300 Subject: [PATCH] add changes from redkite (shortcuts) --- src/MainWindow.cpp | 4 ++-- src/redkite/src/RkEventQueueImpl.cpp | 20 +++++--------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index d87acab2..9e98c284 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -3,7 +3,7 @@ * File name: MainWindow.cpp * Project: Geonkick (A kick synthesizer) * - * Copyright (C) 2017 Iurie Nistor + * Copyright (C) 2017 Iurie Nistor * * This file is part of Geonkick. * @@ -184,7 +184,7 @@ bool MainWindow::init(void) envelopeWidget->setY(topBar->y() + topBar->height()); envelopeWidget->setFixedSize(850, 305); envelopeWidget->show(); - + RK_ACT_BIND(this, updateGui, RK_ACT_ARGS(), envelopeWidget, updateGui()); RK_ACT_BIND(envelopeWidget, requestUpdateGui, RK_ACT_ARGS(), this, updateGui()); limiterWidget = new Limiter(geonkickApi, this); diff --git a/src/redkite/src/RkEventQueueImpl.cpp b/src/redkite/src/RkEventQueueImpl.cpp index 92b993e2..2a062bad 100755 --- a/src/redkite/src/RkEventQueueImpl.cpp +++ b/src/redkite/src/RkEventQueueImpl.cpp @@ -187,13 +187,9 @@ void RkEventQueue::RkEventQueueImpl::processEvents() continue; } - static int n = 10; - if (e.second->type() == RkEvent::Type::MouseMove) { - if (dynamic_cast(e.first)->widgetFlags() == Rk::WidgetFlags::Popup) { - RK_LOG_DEV_DEBUG("[" << dynamic_cast(e.first) << "]Popup: RkEvent::Type::MouseMove: " << n++); - } else { - RK_LOG_DEV_DEBUG("[" << dynamic_cast(e.first) << "]" << n++); - } + if (e.second->type() == RkEvent::Type::KeyPressed + || e.second->type() == RkEvent::Type::KeyReleased) { + processShortcuts(dynamic_cast(e.second.get())); } if (!popupList.empty() && dynamic_cast(e.first) @@ -232,11 +228,6 @@ void RkEventQueue::RkEventQueueImpl::processPopups(RkWidget *widget, RkEvent* ev void RkEventQueue::RkEventQueueImpl::processShortcuts(RkKeyEvent *event) { - /* if (!event) { - RK_LOG_ERROR("wrong arguments"); - return; - } - if (static_cast(event)->isShortcut()) return; @@ -252,12 +243,11 @@ void RkEventQueue::RkEventQueueImpl::processShortcuts(RkKeyEvent *event) shurtcutEvent->setKey(event->key()); shurtcutEvent->setModifiers(event->modifiers()); shurtcutEvent->setShortcut(); - auto pair = std::make_pair(obj, std::move(shurtcutEvent)); - eventsQueue.push_back(std::move(pair)); + RK_IMPL_PTR(obj)->event(shurtcutEvent.get()); } } else { RK_LOG_DEBUG("can't find shortcut"); - }*/ + } } void RkEventQueue::RkEventQueueImpl::postAction(std::unique_ptr act)