Skip to content

Commit

Permalink
make sure it doesn't crash if you click the window while nothing is l…
Browse files Browse the repository at this point in the history
…oaded
  • Loading branch information
Arisotura committed Oct 30, 2024
1 parent 4ba8f33 commit 6dc3967
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/frontend/qt_sdl/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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)
Expand All @@ -254,6 +256,7 @@ void ScreenPanel::mouseMoveEvent(QMouseEvent* event)

showCursor();

if (!emuInstance->emuIsActive()) return;
//if (!(event->buttons() & Qt::LeftButton)) return;
if (!touching) return;

Expand All @@ -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())
{
Expand Down Expand Up @@ -313,6 +317,7 @@ void ScreenPanel::touchEvent(QTouchEvent* event)
#endif

event->accept();
if (!emuInstance->emuIsActive()) { touching = false; return; }

switch(event->type())
{
Expand Down

0 comments on commit 6dc3967

Please sign in to comment.