Absolute mouse input now works on secondary monitors
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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,17 @@ 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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 +162,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 +282,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;
|
||||||
|
Reference in New Issue
Block a user