Refactor into a function

This commit is contained in:
Alexander Babikov
2025-03-07 00:11:45 +05:00
parent d6fa4d4f98
commit 676087bcae
3 changed files with 28 additions and 19 deletions

View File

@@ -26,6 +26,19 @@
#include <QUuid>
#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" {
#include <86box/86box.h>
#include <86box/config.h>
@@ -48,6 +61,15 @@ screenOfWidget(QWidget *widget)
#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
DlgFilter(std::initializer_list<QString> extensions, bool last)
{