Windows: Change cursor clipping from cursor warping to ClipCursor(), fixes #5498.

This commit is contained in:
OBattler
2025-05-21 13:32:17 +02:00
parent bf12aeea1f
commit e76a89bcc8
3 changed files with 40 additions and 3 deletions

View File

@@ -23,6 +23,7 @@
#include <QMessageBox>
#include <QStatusBar>
#include <QApplication>
#include "qt_mainwindow.hpp"
#include "qt_machinestatus.hpp"
@@ -122,6 +123,8 @@ plat_resize(int w, int h, int monitor_index)
main_window->resizeContents(w, h);
}
extern HWND rw_hwnd;
void
plat_mouse_capture(int on)
{
@@ -129,6 +132,26 @@ plat_mouse_capture(int on)
return;
main_window->setMouseCapture(on > 0 ? true : false);
#if defined _WIN32
if (on) {
QCursor cursor(Qt::BlankCursor);
QApplication::setOverrideCursor(cursor);
QApplication::changeOverrideCursor(cursor);
RECT rect;
GetWindowRect(rw_hwnd, &rect);
ClipCursor(&rect);
} else {
ClipCursor(NULL);
QApplication::restoreOverrideCursor();
}
#endif
}
int