Refactor into a function
This commit is contained in:
@@ -122,19 +122,6 @@ 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
|
||||||
@@ -195,8 +182,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
ui->stackedWidget->setMouseTracking(true);
|
ui->stackedWidget->setMouseTracking(true);
|
||||||
statusBar()->setVisible(!hide_status_bar);
|
statusBar()->setVisible(!hide_status_bar);
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
auto cornerPreference = (hide_status_bar ? DWMWCP_DONOTROUND : DWMWCP_DEFAULT);
|
util::setWin11RoundedCorners(this->winId(), (hide_status_bar ? false : true));
|
||||||
DwmSetWindowAttribute((HWND) this->winId(), DWMWA_WINDOW_CORNER_PREFERENCE, (LPCVOID) &cornerPreference, sizeof(cornerPreference));
|
|
||||||
#endif
|
#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;");
|
||||||
@@ -817,8 +803,7 @@ MainWindow::initRendererMonitorSlot(int monitor_index)
|
|||||||
secondaryRenderer->setFixedSize(fixed_size_x, fixed_size_y);
|
secondaryRenderer->setFixedSize(fixed_size_x, fixed_size_y);
|
||||||
secondaryRenderer->setWindowIcon(this->windowIcon());
|
secondaryRenderer->setWindowIcon(this->windowIcon());
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
auto cornerPreference = DWMWCP_DONOTROUND;
|
util::setWin11RoundedCorners(secondaryRenderer->winId(), false);
|
||||||
DwmSetWindowAttribute((HWND) secondaryRenderer->winId(), DWMWA_WINDOW_CORNER_PREFERENCE, (LPCVOID) &cornerPreference, sizeof(cornerPreference));
|
|
||||||
#endif
|
#endif
|
||||||
if (show_second_monitors) {
|
if (show_second_monitors) {
|
||||||
secondaryRenderer->show();
|
secondaryRenderer->show();
|
||||||
@@ -1855,8 +1840,7 @@ MainWindow::on_actionHide_status_bar_triggered()
|
|||||||
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
|
#ifdef Q_OS_WINDOWS
|
||||||
auto cornerPreference = (hide_status_bar ? DWMWCP_DONOTROUND : DWMWCP_DEFAULT);
|
util::setWin11RoundedCorners(main_window->winId(), (hide_status_bar ? false : true));
|
||||||
DwmSetWindowAttribute((HWND) main_window->winId(), DWMWA_WINDOW_CORNER_PREFERENCE, (LPCVOID) &cornerPreference, sizeof(cornerPreference));
|
|
||||||
#endif
|
#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()));
|
||||||
|
|||||||
@@ -26,6 +26,19 @@
|
|||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
#include "qt_util.hpp"
|
#include "qt_util.hpp"
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <86box/86box.h>
|
#include <86box/86box.h>
|
||||||
#include <86box/config.h>
|
#include <86box/config.h>
|
||||||
@@ -48,6 +61,15 @@ screenOfWidget(QWidget *widget)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
void
|
||||||
|
setWin11RoundedCorners(WId hwnd, bool enable)
|
||||||
|
{
|
||||||
|
auto cornerPreference = (enable ? DWMWCP_DEFAULT : DWMWCP_DONOTROUND);
|
||||||
|
DwmSetWindowAttribute((HWND) hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, (LPCVOID) &cornerPreference, sizeof(cornerPreference));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QString
|
QString
|
||||||
DlgFilter(std::initializer_list<QString> extensions, bool last)
|
DlgFilter(std::initializer_list<QString> extensions, bool last)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ static constexpr auto UUID_MIN_LENGTH = 36;
|
|||||||
QString DlgFilter(std::initializer_list<QString> extensions, bool last = false);
|
QString DlgFilter(std::initializer_list<QString> extensions, bool last = false);
|
||||||
/* Returns screen the widget is on */
|
/* Returns screen the widget is on */
|
||||||
QScreen *screenOfWidget(QWidget *widget);
|
QScreen *screenOfWidget(QWidget *widget);
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
void setWin11RoundedCorners(WId hwnd, bool enable);
|
||||||
|
#endif
|
||||||
QString currentUuid();
|
QString currentUuid();
|
||||||
void storeCurrentUuid();
|
void storeCurrentUuid();
|
||||||
bool compareUuid();
|
bool compareUuid();
|
||||||
|
|||||||
Reference in New Issue
Block a user