From 6dc396741fde1c921ece2d3ca97795469d35081b Mon Sep 17 00:00:00 2001 From: Arisotura Date: Wed, 30 Oct 2024 23:39:17 +0100 Subject: [PATCH] make sure it doesn't crash if you click the window while nothing is loaded --- src/frontend/qt_sdl/Screen.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/frontend/qt_sdl/Screen.cpp b/src/frontend/qt_sdl/Screen.cpp index 37c35a65..367d679d 100644 --- a/src/frontend/qt_sdl/Screen.cpp +++ b/src/frontend/qt_sdl/Screen.cpp @@ -222,6 +222,7 @@ void ScreenPanel::resizeEvent(QResizeEvent* event) void ScreenPanel::mousePressEvent(QMouseEvent* event) { event->accept(); + if (!emuInstance->emuIsActive()) { touching = false; return; } if (event->button() != Qt::LeftButton) return; int x = event->pos().x(); @@ -238,6 +239,7 @@ void ScreenPanel::mousePressEvent(QMouseEvent* event) void ScreenPanel::mouseReleaseEvent(QMouseEvent* event) { event->accept(); + if (!emuInstance->emuIsActive()) { touching = false; return; } if (event->button() != Qt::LeftButton) return; if (touching) @@ -254,6 +256,7 @@ void ScreenPanel::mouseMoveEvent(QMouseEvent* event) showCursor(); + if (!emuInstance->emuIsActive()) return; //if (!(event->buttons() & Qt::LeftButton)) return; if (!touching) return; @@ -270,6 +273,7 @@ void ScreenPanel::mouseMoveEvent(QMouseEvent* event) void ScreenPanel::tabletEvent(QTabletEvent* event) { event->accept(); + if (!emuInstance->emuIsActive()) { touching = false; return; } switch(event->type()) { @@ -313,6 +317,7 @@ void ScreenPanel::touchEvent(QTouchEvent* event) #endif event->accept(); + if (!emuInstance->emuIsActive()) { touching = false; return; } switch(event->type()) {