Compare commits

..

2 Commits

Author SHA1 Message Date
lizzie 0c2801b6d3 2026-09-04 23:59:41
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-04 23:59:41 +00:00
lizzie ba82ca04d8 2026-09-04 23:57:52
Signed-off-by: lizzie <lizzie@eden-emu.dev>
2026-09-04 23:57:52 +00:00
5 changed files with 14 additions and 9 deletions
-1
View File
@@ -11,7 +11,6 @@
#include <limits> #include <limits>
#include <span> #include <span>
#include <array> #include <array>
#include <algorithm>
#include <time.h> #include <time.h>
namespace Tz { namespace Tz {
-1
View File
@@ -5,7 +5,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <string> #include <string>
#include <cstdlib>
#include <string_view> #include <string_view>
#ifdef _WIN32 #ifdef _WIN32
#include <llvm/Demangle/Demangle.h> #include <llvm/Demangle/Demangle.h>
+5 -7
View File
@@ -552,15 +552,13 @@ void GRenderWindow::ConstrainMouse() {
const auto pos = mapFromGlobal(QCursor::pos()); const auto pos = mapFromGlobal(QCursor::pos());
const int new_pos_x = std::clamp(pos.x(), 0, width()); const int new_pos_x = std::clamp(pos.x(), 0, width());
const int new_pos_y = std::clamp(pos.y(), 0, height()); const int new_pos_y = std::clamp(pos.y(), 0, height());
QCursor::setPos(mapToGlobal(QPoint{new_pos_x, new_pos_y})); QCursor::setPos(mapToGlobal(QPoint{new_pos_x, new_pos_y}));
return; } else {
const int center_x = width() / 2;
const int center_y = height() / 2;
QCursor::setPos(mapToGlobal(QPoint{center_x, center_y}));
} }
input_subsystem->GetMouse()->NotifyChanged(); // required to reset mouse once it's no longer moved
const int center_x = width() / 2;
const int center_y = height() / 2;
QCursor::setPos(mapToGlobal(QPoint{center_x, center_y}));
} }
void GRenderWindow::wheelEvent(QWheelEvent* event) { void GRenderWindow::wheelEvent(QWheelEvent* event) {
@@ -37,10 +37,16 @@ EmuWindow_SDL3::EmuWindow_SDL3(InputCommon::InputSubsystem* input_subsystem_, Co
SDL_SetWindowTitle(this_->render_window, title.c_str()); SDL_SetWindowTitle(this_->render_window, title.c_str());
return 2000; return 2000;
}, this); }, this);
mouse_timer = SDL_AddTimer(100, [](void *userdata, SDL_TimerID, Uint32) -> Uint32 {
auto* this_ = (EmuWindow_SDL3*)userdata;
this_->input_subsystem->GetMouse()->NotifyChanged();
return 100;
}, this);
} }
EmuWindow_SDL3::~EmuWindow_SDL3() { EmuWindow_SDL3::~EmuWindow_SDL3() {
SDL_RemoveTimer(titlebar_timer); SDL_RemoveTimer(titlebar_timer);
SDL_RemoveTimer(mouse_timer);
system.HIDCore().UnloadInputDevices(); system.HIDCore().UnloadInputDevices();
input_subsystem->Shutdown(); input_subsystem->Shutdown();
SDL_Quit(); SDL_Quit();
@@ -84,6 +84,9 @@ protected:
/// Periodic changer of titlebar (independent of event loop) /// Periodic changer of titlebar (independent of event loop)
SDL_TimerID titlebar_timer; SDL_TimerID titlebar_timer;
// Mouse resetter once it
SDL_TimerID mouse_timer;
/// Is the window still open? /// Is the window still open?
bool is_open = true; bool is_open = true;