Commit d178d3c9 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix shortcuts sometimes broken with fullscreen monitor.

Fixes #1287
parent 70761646
Pipeline #118731 passed with stage
in 6 minutes and 43 seconds
......@@ -3854,7 +3854,6 @@ void MainWindow::triggerKey(QKeyEvent *ev)
// Trigger action
tempAction->trigger();
ev->accept();
activateWindow();
return;
}
}
......
......@@ -759,8 +759,8 @@ void GLWidget::mousePressEvent(QMouseEvent *event)
m_panStart = event->pos();
setCursor(Qt::ClosedHandCursor);
}
event->accept();
QQuickView::mousePressEvent(event);
event->accept();
}
void GLWidget::mouseMoveEvent(QMouseEvent *event)
......
......@@ -167,7 +167,6 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
connect(m_verticalScroll, &QAbstractSlider::valueChanged, this, &Monitor::setOffsetY);
connect(m_glMonitor, &GLWidget::frameDisplayed, this, &Monitor::onFrameDisplayed, Qt::DirectConnection);
connect(m_glMonitor, &GLWidget::mouseSeek, this, &Monitor::slotMouseSeek);
connect(m_glMonitor, &GLWidget::monitorPlay, this, &Monitor::slotPlay);
connect(m_glMonitor, &GLWidget::startDrag, this, &Monitor::slotStartDrag);
connect(m_glMonitor, &GLWidget::switchFullScreen, this, &Monitor::slotSwitchFullScreen);
connect(m_glMonitor, &GLWidget::zoomChanged, this, &Monitor::setZoom);
......@@ -334,6 +333,7 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
m_playAction = new KDualAction(i18n("Play"), i18n("Pause"), this);
m_playAction->setInactiveIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
m_playAction->setActiveIcon(QIcon::fromTheme(QStringLiteral("media-playback-pause")));
connect(m_glMonitor, &GLWidget::monitorPlay, m_playAction, &QAction::trigger);
QString strippedTooltip = m_playAction->toolTip().remove(QRegularExpression(QStringLiteral("\\s\\(.*\\)")));
// append shortcut if it exists for action
......@@ -1010,11 +1010,17 @@ void Monitor::slotSwitchFullScreen(bool minimizeOnly)
}
}
void Monitor::fixFocus()
{
m_videoWidget->setFocus();
}
// virtual
void Monitor::mouseReleaseEvent(QMouseEvent *event)
{
if (m_dragStarted) {
event->ignore();
QWidget::mouseReleaseEvent(event);
return;
}
if (event->button() != Qt::RightButton) {
......@@ -1116,8 +1122,8 @@ void Monitor::wheelEvent(QWheelEvent *event)
void Monitor::mouseDoubleClickEvent(QMouseEvent *event)
{
slotSwitchFullScreen();
event->accept();
slotSwitchFullScreen();
}
void Monitor::keyPressEvent(QKeyEvent *event)
......@@ -2503,7 +2509,8 @@ void Monitor::displayAudioMonitor(bool isActive)
if (isActive && m_glWidget->isFullScreen()) {
// If both monitors are fullscreen, this is necessary to do the switch
m_glWidget->showFullScreen();
m_videoWidget->setFocus();
pCore->window()->activateWindow();
pCore->window()->setFocus();
}
}
......
......@@ -142,8 +142,10 @@ public:
void enableEffectScene(bool enable);
/** @brief Update the document's uuid - used for qml thumb cache*/
void updateDocumentUuid();
/** @brief Focus the timecode to alllow editing*/
/** @brief Focus the timecode to allow editing*/
void focusTimecode();
/** @brief Ensure the video widget has focus to make keyboard shortcuts work */
void fixFocus();
protected:
......
......@@ -174,6 +174,8 @@ bool MonitorManager::activateMonitor(Kdenlive::MonitorId name)
if (name == Kdenlive::ClipMonitor) {
if (!m_clipMonitor->monitorIsFullScreen()) {
m_clipMonitor->parentWidget()->raise();
} else {
m_clipMonitor->fixFocus();
}
if (!m_clipMonitor->isVisible()) {
pCore->displayMessage(i18n("Do you want to <a href=\"#clipmonitor\">show the clip monitor</a> to view timeline?"), MessageType::InformationMessage);
......@@ -186,6 +188,8 @@ bool MonitorManager::activateMonitor(Kdenlive::MonitorId name)
} else if (name == Kdenlive::ProjectMonitor) {
if (!m_projectMonitor->monitorIsFullScreen()) {
m_projectMonitor->parentWidget()->raise();
} else {
m_projectMonitor->fixFocus();
}
if (!m_projectMonitor->isVisible()) {
pCore->displayMessage(i18n("Do you want to <a href=\"#projectmonitor\">show the project monitor</a> to view timeline?"), MessageType::InformationMessage);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment