From de4a5cc90703f8fdb5dd36e29bdde1d70a037034 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sun, 17 Jul 2022 11:31:33 +0200 Subject: Fix msg window overlapping login, fix browser widget resizing --- CMakeLists.txt | 6 +++++- src/loginform.cpp | 10 ++++++++-- src/mainwindow.cpp | 24 +++++++++++++++++------- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b6b7be..ac09d95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,11 @@ OPTION(USE_INCLUDED_LDMQT "Use included liblightdm-qt" OFF) PROJECT(qt-lightdm-greeter) set(CMAKE_CXX_STANDARD 11) -set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_CONFIGURATION_TYPES Debug Release) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug) + message(STATUS "Build type is not set. Defaulting to ${CMAKE_BUILD_TYPE} build!") +endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) diff --git a/src/loginform.cpp b/src/loginform.cpp index 50bd08e..7c4deaa 100644 --- a/src/loginform.cpp +++ b/src/loginform.cpp @@ -472,7 +472,7 @@ void LoginForm::keyPressEvent(QKeyEvent *event) void LoginForm::resetForm() { - std::cerr << "PageCount: " << pageCount; + std::cerr << "PageCount: " << pageCount << std::endl; if (pageCount > 1) { ui->loginChooser->setCurrentWidget(ui->welcomePage); } @@ -505,7 +505,7 @@ void LoginForm::setBrowserSize() browser->setFixedSize(s); browser->setGeometry(QRect(QPoint(0, 0), s)); } - QTimer::singleShot(10, [=]() { + QTimer::singleShot(10, [this, f]() { int pw = 0, ph = 0; if (this->parentWidget() != nullptr) { this->parentWidget()->pos(); @@ -515,6 +515,12 @@ void LoginForm::setBrowserSize() this->resize(*f); this->setFixedSize(*f); this->setGeometry(pw, ph, f->width(), f->height()); + auto s = ui->shibPage->size(); + std::cerr << "Delayed resize to " << s.width() << " " << s.height() << std::endl; + if (browser != nullptr) { + browser->setFixedSize(s); + browser->setGeometry(QRect(QPoint(0, 0), s)); + } emit resized(); }); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ce117ee..a7bdb58 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -163,12 +163,20 @@ void MainWindow::reLayout() // Log window if (m_messages != nullptr) { QRect lwSize(QPoint(logoSize.width(), m_ScreenRect.height() * 3/4), QPoint(m_ScreenRect.width() - distroSize.width(), m_ScreenRect.height())); + if (m_LoginForm != nullptr && lwSize.top() < m_LoginForm->geometry().bottom()) { + lwSize.setTop(m_LoginForm->geometry().bottom()); + } lwSize.adjust(10, 10, -10, -10); - m_messages->setGeometry(lwSize); - int ps = lwSize.height() / 20; - if (ps > 20) ps = 20; - m_messages->setFontPointSize(ps); - newsBottom = lwSize.top(); + if (lwSize.height() < 10) { + m_messages->hide(); + } else { + m_messages->show(); + m_messages->setGeometry(lwSize); + int ps = lwSize.height() / 20; + if (ps > 20) ps = 20; + m_messages->setFontPointSize(ps); + newsBottom = lwSize.top(); + } } if (m_Clock != nullptr) { m_Clock->setFixedWidth(m_ScreenRect.width()); @@ -185,6 +193,10 @@ void MainWindow::reLayout() m_News->show(); } } + if (m_LoginForm != nullptr) { + // This is most important, so bring to top + m_LoginForm->raise(); + } } void MainWindow::paintEvent(QPaintEvent *event) @@ -239,9 +251,7 @@ QSize MainWindow::createLogo(QRect max) QString filePath = fileInfo.absoluteFilePath(); createNextLogo(max, retval, filePath); } - return retval; } - createNextLogo(max, retval, path); return retval; } -- cgit v1.2.3-55-g7522