mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-11-10 05:34:17 +00:00
parent
a6fccf93d1
commit
245f242fb8
3 changed files with 48 additions and 0 deletions
2
app/qt.conf
Normal file
2
app/qt.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
[Platforms]
|
||||
WindowsArguments = darkmode=1
|
|
@ -22,6 +22,19 @@
|
|||
#define ICON_SIZE 64
|
||||
#endif
|
||||
|
||||
// HACK: Remove once proper Dark Mode support lands in SDL
|
||||
#ifdef Q_OS_WIN32
|
||||
#include <SDL_syswm.h>
|
||||
#include <dwmapi.h>
|
||||
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE_OLD
|
||||
#define DWMWA_USE_IMMERSIVE_DARK_MODE_OLD 19
|
||||
#endif
|
||||
#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
|
||||
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#define SDL_CODE_FLUSH_WINDOW_EVENT_BARRIER 100
|
||||
#define SDL_CODE_GAMECONTROLLER_RUMBLE 101
|
||||
|
||||
|
@ -35,6 +48,7 @@
|
|||
#include <QImage>
|
||||
#include <QGuiApplication>
|
||||
#include <QCursor>
|
||||
#include <QWindow>
|
||||
|
||||
#define CONN_TEST_SERVER "qt.conntest.moonlight-stream.org"
|
||||
|
||||
|
@ -1415,6 +1429,34 @@ void Session::execInternal()
|
|||
}
|
||||
}
|
||||
|
||||
// HACK: Remove once proper Dark Mode support lands in SDL
|
||||
#ifdef Q_OS_WIN32
|
||||
{
|
||||
BOOL darkModeEnabled = FALSE;
|
||||
|
||||
// Query whether dark mode is enabled for our Qt window (which tracks the OS dark mode state)
|
||||
QWindowList windows = QGuiApplication::topLevelWindows();
|
||||
for (const QWindow* window : windows) {
|
||||
if (SUCCEEDED(DwmGetWindowAttribute((HWND)window->winId(), DWMWA_USE_IMMERSIVE_DARK_MODE, &darkModeEnabled, sizeof(darkModeEnabled))) ||
|
||||
SUCCEEDED(DwmGetWindowAttribute((HWND)window->winId(), DWMWA_USE_IMMERSIVE_DARK_MODE_OLD, &darkModeEnabled, sizeof(darkModeEnabled)))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If dark mode is enabled, propagate that to our SDL window
|
||||
if (darkModeEnabled) {
|
||||
SDL_SysWMinfo info;
|
||||
|
||||
SDL_VERSION(&info.version);
|
||||
if (SDL_GetWindowWMInfo(m_Window, &info) && info.subsystem == SDL_SYSWM_WINDOWS) {
|
||||
if (FAILED(DwmSetWindowAttribute(info.info.win.window, DWMWA_USE_IMMERSIVE_DARK_MODE, &darkModeEnabled, sizeof(darkModeEnabled)))) {
|
||||
DwmSetWindowAttribute(info.info.win.window, DWMWA_USE_IMMERSIVE_DARK_MODE_OLD, &darkModeEnabled, sizeof(darkModeEnabled));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
m_InputHandler->setWindow(m_Window);
|
||||
|
||||
QSvgRenderer svgIconRenderer(QString(":/res/moonlight.svg"));
|
||||
|
|
|
@ -144,6 +144,10 @@ echo Copying GC mapping list
|
|||
copy %SOURCE_ROOT%\app\SDL_GameControllerDB\gamecontrollerdb.txt %DEPLOY_FOLDER%
|
||||
if !ERRORLEVEL! NEQ 0 goto Error
|
||||
|
||||
echo Copying qt.conf
|
||||
copy %SOURCE_ROOT%\app\qt.conf %DEPLOY_FOLDER%
|
||||
if !ERRORLEVEL! NEQ 0 goto Error
|
||||
|
||||
echo Deploying Qt dependencies
|
||||
windeployqt.exe --dir %DEPLOY_FOLDER% --%BUILD_CONFIG% --qmldir %SOURCE_ROOT%\app\gui --no-opengl-sw --no-compiler-runtime --no-qmltooling --no-virtualkeyboard --no-sql %BUILD_FOLDER%\app\%BUILD_CONFIG%\Moonlight.exe
|
||||
if !ERRORLEVEL! NEQ 0 goto Error
|
||||
|
|
Loading…
Reference in a new issue