Skip to content

Commit

Permalink
Fixed window minimize when Windows version less then 11.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchapyshev committed Nov 12, 2023
1 parent d29adb4 commit d4e21c0
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions source/client/ui/desktop/qt_desktop_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#include "common/desktop_session_constants.h"
#include "qt_base/application.h"

#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif // defined(OS_WIN)

#include <QApplication>
#include <QBrush>
#include <QClipboard>
Expand Down Expand Up @@ -661,14 +665,26 @@ void QtDesktopWindow::changeEvent(QEvent* event)
}

//--------------------------------------------------------------------------------------------------
void QtDesktopWindow::showEvent(QShowEvent *event)
void QtDesktopWindow::showEvent(QShowEvent* event)
{
if (is_minimized_from_full_screen_)
{
LOG(LS_INFO) << "Restore to full screen";
is_minimized_from_full_screen_ = false;
showFullScreen();

#if defined(OS_WIN)
if (base::win::windowsVersion() >= base::win::VERSION_WIN11)
{
// In Windows 11, when you maximize a minimized window from full screen, the window does
// not return to full screen. We force the window to full screen.
// However, in versions of Windows less than 11, this breaks the window's minimization,
// therefore we use this piece of code only for Windows 11.
showFullScreen();
}
#endif // defined(OS_WIN)
}

QWidget::showEvent(event);
}

//--------------------------------------------------------------------------------------------------
Expand Down

0 comments on commit d4e21c0

Please sign in to comment.