Skip to content

Commit d8f16d4

Browse files
authored
Merge pull request #701 from barry-ran/dev
sync dev
2 parents e218ceb + fcd6832 commit d8f16d4

File tree

7 files changed

+59
-5
lines changed

7 files changed

+59
-5
lines changed

QtScrcpy/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
149149
set(QC_UTIL_SOURCES ${QC_UTIL_SOURCES}
150150
util/mousetap/winmousetap.h
151151
util/mousetap/winmousetap.cpp
152+
util/winutils.h
153+
util/winutils.cpp
152154
)
153155
endif()
154156
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")

QtScrcpy/ui/dialog.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
#include "videoform.h"
1212
#include "../groupcontroller/groupcontroller.h"
1313

14+
#ifdef Q_OS_WIN32
15+
#include "../util/winutils.h"
16+
#endif
17+
1418
QString s_keyMapPath = "";
1519

1620
const QString &getKeyMapPath()
@@ -137,6 +141,10 @@ void Dialog::initUI()
137141

138142
setWindowTitle(Config::getInstance().getTitle());
139143

144+
#ifdef Q_OS_WIN32
145+
WinUtils::setDarkBorderToWindow((HWND)this->winId(), true);
146+
#endif
147+
140148
ui->bitRateEdit->setValidator(new QIntValidator(1, 99999, this));
141149

142150
ui->maxSizeBox->addItem("640");

QtScrcpy/util/winutils.cpp

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <QDebug>
2+
#include <Windows.h>
3+
#include <dwmapi.h>
4+
#pragma comment(lib, "dwmapi")
5+
6+
#include "winutils.h"
7+
8+
enum : WORD
9+
{
10+
DwmwaUseImmersiveDarkMode = 20,
11+
DwmwaUseImmersiveDarkModeBefore20h1 = 19
12+
};
13+
14+
WinUtils::WinUtils(){};
15+
16+
WinUtils::~WinUtils(){};
17+
18+
// Set dark border to window
19+
// Reference: qt/qtbase.git/tree/src/plugins/platforms/windows/qwindowswindow.cpp
20+
bool WinUtils::setDarkBorderToWindow(const HWND &hwnd, const bool &d)
21+
{
22+
const BOOL darkBorder = d ? TRUE : FALSE;
23+
const bool ok = SUCCEEDED(DwmSetWindowAttribute(hwnd, DwmwaUseImmersiveDarkMode, &darkBorder, sizeof(darkBorder)))
24+
|| SUCCEEDED(DwmSetWindowAttribute(hwnd, DwmwaUseImmersiveDarkModeBefore20h1, &darkBorder, sizeof(darkBorder)));
25+
if (!ok)
26+
qWarning("%s: Unable to set dark window border.", __FUNCTION__);
27+
return ok;
28+
}

QtScrcpy/util/winutils.h

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef WINUTILS_H
2+
#define WINUTILS_H
3+
4+
#include <QApplication>
5+
#include <Windows.h>
6+
7+
class WinUtils
8+
{
9+
public:
10+
WinUtils();
11+
~WinUtils();
12+
13+
static bool setDarkBorderToWindow(const HWND &hwnd, const bool &d);
14+
};
15+
16+
#endif // WINUTILS_H

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,14 @@ All the dependencies are provided and it is easy to compile.
248248
#### Non-Arch Linux Users
249249
1. Set up the Qt development environment with the official Qt installer or third-party tools such as [aqt](https://github.com/miurahr/aqtinstall) on the target platform.
250250
Qt version bigger than 5.12 is required. (use MSVC 2019 on Windows)
251-
2. Clone the project with `git clone --recurse-submodules https://barry-ran/QtScrcpy.git`
251+
2. Clone the project with `git clone --recurse-submodules [email protected]:barry-ran/QtScrcpy.git`
252252
3. For Windows, open CMakeLists.txt with QtCreator and compile Release
253253
4. For Linux, directly run `./ci/linux/build_for_linux.sh "Release"`
254254
Note: compiled artifacts are located at `output/x64/Release`
255255

256256
#### Arch Linux Users
257257
1. Install packages: `base-devel cmake qt5-base qt5-multimedia qt5-x11extras` (`qtcreator` is recommended)
258-
2. Clone the project with `git clone --recurse-submodules https://barry-ran/QtScrcpy.git`
258+
2. Clone the project with `git clone --recurse-submodules [email protected]:barry-ran/QtScrcpy.git`
259259
3. Run `./ci/linux/build_for_linux.sh "Release"`
260260

261261
### Scrcpy-Server

README_zh.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,14 @@ Mac OS 平台,你可以直接使用我编译好的可执行程序:
246246
#### 非 Arch Linux
247247
1. 使用官方 Qt Installer 或非官方工具(如 [aqt](https://github.com/miurahr/aqtinstall))在目标平台上搭建Qt开发环境。
248248
需要 5.12 以上版本 Qt(在 Windows 上使用 MSVC 2019)
249-
2. 克隆该项目:`git clone --recurse-submodules https://github.com/barry-ran/QtScrcpy.git`
249+
2. 克隆该项目:`git clone --recurse-submodules git@github.com:barry-ran/QtScrcpy.git`
250250
3. Windows 使用 QtCreator 打开项目下 CMakeLists.txt 并编译 Release
251251
4. Linux 用终端执行 `./ci/linux/build_for_linux.sh "Release"`
252252
注:编译结果位于 `output/x64/Release`
253253

254254
#### Arch Linux
255255
1. 安装以下包:`qt5-base qt5-multimedia qt5-x11extras`(推荐安装 `qtcreator`
256-
2. 克隆该项目:`git clone --recurse-submodules https://github.com/barry-ran/QtScrcpy.git`
256+
2. 克隆该项目:`git clone --recurse-submodules git@github.com:barry-ran/QtScrcpy.git`
257257
3. 用终端执行 `./ci/linux/build_for_linux.sh "Release"`
258258
注:编译结果位于 `output/x64/Release`
259259

0 commit comments

Comments
 (0)