Disable Win11 rounded window corners when the status bar is hidden
This commit is contained in:
@@ -122,6 +122,19 @@ extern int qt_nvr_save(void);
|
|||||||
#include "x11_util.h"
|
#include "x11_util.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
#include <dwmapi.h>
|
||||||
|
#ifndef DWMWA_WINDOW_CORNER_PREFERENCE
|
||||||
|
#define DWMWA_WINDOW_CORNER_PREFERENCE 33
|
||||||
|
#endif
|
||||||
|
#ifndef DWMWCP_DEFAULT
|
||||||
|
#define DWMWCP_DEFAULT 0
|
||||||
|
#endif
|
||||||
|
#ifndef DWMWCP_DONOTROUND
|
||||||
|
#define DWMWCP_DONOTROUND 1
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
# include "cocoa_keyboard.hpp"
|
# include "cocoa_keyboard.hpp"
|
||||||
// The namespace is required to avoid clashing typedefs; we only use this
|
// The namespace is required to avoid clashing typedefs; we only use this
|
||||||
@@ -181,6 +194,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
status->setSoundGainAction(ui->actionSound_gain);
|
status->setSoundGainAction(ui->actionSound_gain);
|
||||||
ui->stackedWidget->setMouseTracking(true);
|
ui->stackedWidget->setMouseTracking(true);
|
||||||
statusBar()->setVisible(!hide_status_bar);
|
statusBar()->setVisible(!hide_status_bar);
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
auto cornerPreference = (hide_status_bar ? DWMWCP_DONOTROUND : DWMWCP_DEFAULT);
|
||||||
|
DwmSetWindowAttribute((HWND) this->winId(), DWMWA_WINDOW_CORNER_PREFERENCE, (LPCVOID) &cornerPreference, sizeof(cornerPreference));
|
||||||
|
#endif
|
||||||
statusBar()->setStyleSheet("QStatusBar::item {border: None; } QStatusBar QLabel { margin-right: 2px; margin-bottom: 1px; }");
|
statusBar()->setStyleSheet("QStatusBar::item {border: None; } QStatusBar QLabel { margin-right: 2px; margin-bottom: 1px; }");
|
||||||
this->centralWidget()->setStyleSheet("background-color: black;");
|
this->centralWidget()->setStyleSheet("background-color: black;");
|
||||||
ui->toolBar->setVisible(!hide_tool_bar);
|
ui->toolBar->setVisible(!hide_tool_bar);
|
||||||
@@ -1833,6 +1850,10 @@ MainWindow::on_actionHide_status_bar_triggered()
|
|||||||
hide_status_bar ^= 1;
|
hide_status_bar ^= 1;
|
||||||
ui->actionHide_status_bar->setChecked(hide_status_bar);
|
ui->actionHide_status_bar->setChecked(hide_status_bar);
|
||||||
statusBar()->setVisible(!hide_status_bar);
|
statusBar()->setVisible(!hide_status_bar);
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
auto cornerPreference = (hide_status_bar ? DWMWCP_DONOTROUND : DWMWCP_DEFAULT);
|
||||||
|
DwmSetWindowAttribute((HWND) main_window->winId(), DWMWA_WINDOW_CORNER_PREFERENCE, (LPCVOID) &cornerPreference, sizeof(cornerPreference));
|
||||||
|
#endif
|
||||||
if (vid_resize >= 2) {
|
if (vid_resize >= 2) {
|
||||||
setFixedSize(fixed_size_x, fixed_size_y + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height()) + (hide_tool_bar ? 0 : ui->toolBar->height()));
|
setFixedSize(fixed_size_x, fixed_size_y + menuBar()->height() + (hide_status_bar ? 0 : statusBar()->height()) + (hide_tool_bar ? 0 : ui->toolBar->height()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user