mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 21:28:51 +00:00
DolphinQt: Add function to set a QWidget's window decorations to dark ones on Windows.
This commit is contained in:
parent
1b255c3fd9
commit
0d0f821f96
5 changed files with 41 additions and 0 deletions
25
Source/Core/DolphinQt/QtUtils/SetWindowDecorations.cpp
Normal file
25
Source/Core/DolphinQt/QtUtils/SetWindowDecorations.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2023 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <dwmapi.h>
|
||||
#endif
|
||||
|
||||
void SetQWidgetWindowDecorations(QWidget* widget)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (!Settings::Instance().IsSystemDark())
|
||||
return;
|
||||
|
||||
BOOL use_dark_title_bar = TRUE;
|
||||
DwmSetWindowAttribute(HWND(widget->winId()),
|
||||
20 /* DWMWINDOWATTRIBUTE::DWMWA_USE_IMMERSIVE_DARK_MODE */,
|
||||
&use_dark_title_bar, DWORD(sizeof(use_dark_title_bar)));
|
||||
#endif
|
||||
}
|
9
Source/Core/DolphinQt/QtUtils/SetWindowDecorations.h
Normal file
9
Source/Core/DolphinQt/QtUtils/SetWindowDecorations.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
// Copyright 2023 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
class QWidget;
|
||||
|
||||
// Changes the window decorations (title bar) to dark if the user uses dark mode on Windows.
|
||||
void SetQWidgetWindowDecorations(QWidget* widget);
|
Loading…
Add table
Add a link
Reference in a new issue