Merge pull request #3177 from Cacodemon345/qt-wacom-serial

qt: Multimonitor and absolute mouse input fixes
This commit is contained in:
Miran Grča
2023-03-07 02:43:59 +01:00
committed by GitHub
3 changed files with 26 additions and 4 deletions

View File

@@ -138,7 +138,11 @@ main_thread_fn()
} }
is_quit = 1; is_quit = 1;
QTimer::singleShot(0, QApplication::instance(), []() { QApplication::instance()->quit(); }); if (gfxcard[1]) {
ui_deinit_monitor(1);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
QTimer::singleShot(0, QApplication::instance(), []() { QApplication::processEvents(); QApplication::instance()->quit(); });
} }
static std::thread *main_thread; static std::thread *main_thread;

View File

@@ -733,7 +733,9 @@ MainWindow::initRendererMonitorSlot(int monitor_index)
secondaryRenderer->showMaximized(); secondaryRenderer->showMaximized();
} }
secondaryRenderer->switchRenderer((RendererStack::Renderer) vid_api); secondaryRenderer->switchRenderer((RendererStack::Renderer) vid_api);
secondaryRenderer->setMouseTracking(true);
} }
connect(this, &MainWindow::pollMouse, secondaryRenderer.get(), &RendererStack::mousePoll, Qt::DirectConnection);
} }
} }

View File

@@ -127,7 +127,7 @@ qt_mouse_capture(int on)
{ {
if (!on) { if (!on) {
mouse_capture = 0; mouse_capture = 0;
QApplication::setOverrideCursor(Qt::ArrowCursor); if (QApplication::overrideCursor()) QApplication::restoreOverrideCursor();
#ifdef __APPLE__ #ifdef __APPLE__
CGAssociateMouseAndMouseCursorPosition(true); CGAssociateMouseAndMouseCursorPosition(true);
#endif #endif
@@ -144,6 +144,20 @@ qt_mouse_capture(int on)
void void
RendererStack::mousePoll() RendererStack::mousePoll()
{ {
if (m_monitor_index >= 1) {
if (mouse_mode >= 1) {
mouse_x_abs = mousedata.x_abs;
mouse_y_abs = mousedata.y_abs;
if (!mouse_tablet_in_proximity) {
mouse_tablet_in_proximity = mousedata.mouse_tablet_in_proximity;
}
if (mousedata.mouse_tablet_in_proximity) {
mouse_buttons = mousedata.mousebuttons;
}
}
return;
}
#ifdef Q_OS_WINDOWS #ifdef Q_OS_WINDOWS
if (mouse_mode == 0) { if (mouse_mode == 0) {
mouse_x_abs = mousedata.x_abs; mouse_x_abs = mousedata.x_abs;
@@ -151,6 +165,7 @@ RendererStack::mousePoll()
return; return;
} }
#endif #endif
#ifndef __APPLE__ #ifndef __APPLE__
mouse_x = mousedata.deltax; mouse_x = mousedata.deltax;
mouse_y = mousedata.deltay; mouse_y = mousedata.deltay;
@@ -270,8 +285,9 @@ void
RendererStack::leaveEvent(QEvent *event) RendererStack::leaveEvent(QEvent *event)
{ {
mousedata.mouse_tablet_in_proximity = 0; mousedata.mouse_tablet_in_proximity = 0;
if (mouse_mode == 1)
QApplication::setOverrideCursor(Qt::ArrowCursor); if (mouse_mode == 1 && QApplication::overrideCursor())
QApplication::restoreOverrideCursor();
if (QApplication::platformName().contains("wayland")) { if (QApplication::platformName().contains("wayland")) {
event->accept(); event->accept();
return; return;