Merge pull request #2467 from Cacodemon345/multimonitor-take2-ui
qt: Make renderer widget resizable only once
This commit is contained in:
@@ -229,7 +229,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
});
|
||||
|
||||
connect(this, &MainWindow::resizeContents, this, [this](int w, int h) {
|
||||
ui->stackedWidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
if (shownonce) {
|
||||
if (resizableonce == false) ui->stackedWidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
resizableonce = true;
|
||||
}
|
||||
if (!QApplication::platformName().contains("eglfs") && vid_resize != 1) {
|
||||
w = (w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.));
|
||||
|
||||
@@ -558,7 +561,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
if (renderers[i]) {
|
||||
monitor_settings[i].mon_window_w = renderers[i]->geometry().width();
|
||||
monitor_settings[i].mon_window_h = renderers[i]->geometry().height();
|
||||
if (!QApplication::platformName().contains("wayland")) continue;
|
||||
if (QApplication::platformName().contains("wayland")) continue;
|
||||
monitor_settings[i].mon_window_x = renderers[i]->geometry().x();
|
||||
monitor_settings[i].mon_window_y = renderers[i]->geometry().y();
|
||||
}
|
||||
@@ -582,7 +585,6 @@ void MainWindow::initRendererMonitorSlot(int monitor_index)
|
||||
auto& secondaryRenderer = this->renderers[monitor_index];
|
||||
secondaryRenderer.reset(new RendererStack(nullptr, monitor_index));
|
||||
if (secondaryRenderer) {
|
||||
connect(this, &MainWindow::pollMouse, secondaryRenderer.get(), &RendererStack::mousePoll, Qt::DirectConnection);
|
||||
connect(secondaryRenderer.get(), &RendererStack::rendererChanged, this, [this, monitor_index]
|
||||
{
|
||||
this->renderers[monitor_index]->show();
|
||||
|
@@ -141,6 +141,7 @@ private:
|
||||
/* If main window should send keyboard input */
|
||||
bool send_keyboard_input = true;
|
||||
bool shownonce = false;
|
||||
bool resizableonce = false;
|
||||
|
||||
friend class SpecifyDimensions;
|
||||
friend class ProgSettings;
|
||||
|
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "evdev_mouse.hpp"
|
||||
|
||||
#include <atomic>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <QScreen>
|
||||
@@ -53,8 +54,8 @@ double mouse_sensitivity = 1.0;
|
||||
}
|
||||
|
||||
struct mouseinputdata {
|
||||
int deltax, deltay, deltaz;
|
||||
int mousebuttons;
|
||||
atomic_int deltax, deltay, deltaz;
|
||||
atomic_int mousebuttons;
|
||||
};
|
||||
static mouseinputdata mousedata;
|
||||
|
||||
@@ -145,7 +146,7 @@ int ignoreNextMouseEvent = 1;
|
||||
void
|
||||
RendererStack::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (this->geometry().contains(event->pos()) && event->button() == Qt::LeftButton && !mouse_capture && (isMouseDown & 1)) {
|
||||
if (this->geometry().contains(event->pos()) && event->button() == Qt::LeftButton && !mouse_capture && (isMouseDown & 1) && mouse_get_buttons() != 0) {
|
||||
plat_mouse_capture(1);
|
||||
this->setCursor(Qt::BlankCursor);
|
||||
if (!ignoreNextMouseEvent)
|
||||
@@ -164,6 +165,7 @@ RendererStack::mouseReleaseEvent(QMouseEvent *event)
|
||||
}
|
||||
isMouseDown &= ~1;
|
||||
}
|
||||
|
||||
void
|
||||
RendererStack::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
@@ -173,6 +175,7 @@ RendererStack::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void
|
||||
RendererStack::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
|
Reference in New Issue
Block a user