Merge pull request #701 from barry-ran/dev

sync dev
This commit is contained in:
Barry 2022-10-18 10:11:34 +08:00 committed by GitHub
commit 0d0a7edf27
7 changed files with 59 additions and 5 deletions

View file

@ -149,6 +149,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(QC_UTIL_SOURCES ${QC_UTIL_SOURCES} set(QC_UTIL_SOURCES ${QC_UTIL_SOURCES}
util/mousetap/winmousetap.h util/mousetap/winmousetap.h
util/mousetap/winmousetap.cpp util/mousetap/winmousetap.cpp
util/winutils.h
util/winutils.cpp
) )
endif() endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CMAKE_SYSTEM_NAME STREQUAL "Linux")

@ -1 +1 @@
Subproject commit 24b496a8be2f487ea0223386e5daf0ac24209aa4 Subproject commit f81d3696cb79964e073415798bc070415337877d

View file

@ -11,6 +11,10 @@
#include "videoform.h" #include "videoform.h"
#include "../groupcontroller/groupcontroller.h" #include "../groupcontroller/groupcontroller.h"
#ifdef Q_OS_WIN32
#include "../util/winutils.h"
#endif
QString s_keyMapPath = ""; QString s_keyMapPath = "";
const QString &getKeyMapPath() const QString &getKeyMapPath()
@ -137,6 +141,10 @@ void Dialog::initUI()
setWindowTitle(Config::getInstance().getTitle()); setWindowTitle(Config::getInstance().getTitle());
#ifdef Q_OS_WIN32
WinUtils::setDarkBorderToWindow((HWND)this->winId(), true);
#endif
ui->bitRateEdit->setValidator(new QIntValidator(1, 99999, this)); ui->bitRateEdit->setValidator(new QIntValidator(1, 99999, this));
ui->maxSizeBox->addItem("640"); ui->maxSizeBox->addItem("640");

View file

@ -0,0 +1,28 @@
#include <QDebug>
#include <Windows.h>
#include <dwmapi.h>
#pragma comment(lib, "dwmapi")
#include "winutils.h"
enum : WORD
{
DwmwaUseImmersiveDarkMode = 20,
DwmwaUseImmersiveDarkModeBefore20h1 = 19
};
WinUtils::WinUtils(){};
WinUtils::~WinUtils(){};
// Set dark border to window
// Reference: qt/qtbase.git/tree/src/plugins/platforms/windows/qwindowswindow.cpp
bool WinUtils::setDarkBorderToWindow(const HWND &hwnd, const bool &d)
{
const BOOL darkBorder = d ? TRUE : FALSE;
const bool ok = SUCCEEDED(DwmSetWindowAttribute(hwnd, DwmwaUseImmersiveDarkMode, &darkBorder, sizeof(darkBorder)))
|| SUCCEEDED(DwmSetWindowAttribute(hwnd, DwmwaUseImmersiveDarkModeBefore20h1, &darkBorder, sizeof(darkBorder)));
if (!ok)
qWarning("%s: Unable to set dark window border.", __FUNCTION__);
return ok;
}

16
QtScrcpy/util/winutils.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef WINUTILS_H
#define WINUTILS_H
#include <QApplication>
#include <Windows.h>
class WinUtils
{
public:
WinUtils();
~WinUtils();
static bool setDarkBorderToWindow(const HWND &hwnd, const bool &d);
};
#endif // WINUTILS_H

View file

@ -248,14 +248,14 @@ All the dependencies are provided and it is easy to compile.
#### Non-Arch Linux Users #### Non-Arch Linux Users
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. 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.
Qt version bigger than 5.12 is required. (use MSVC 2019 on Windows) Qt version bigger than 5.12 is required. (use MSVC 2019 on Windows)
2. Clone the project with `git clone --recurse-submodules https://barry-ran/QtScrcpy.git` 2. Clone the project with `git clone --recurse-submodules git@github.com:barry-ran/QtScrcpy.git`
3. For Windows, open CMakeLists.txt with QtCreator and compile Release 3. For Windows, open CMakeLists.txt with QtCreator and compile Release
4. For Linux, directly run `./ci/linux/build_for_linux.sh "Release"` 4. For Linux, directly run `./ci/linux/build_for_linux.sh "Release"`
Note: compiled artifacts are located at `output/x64/Release` Note: compiled artifacts are located at `output/x64/Release`
#### Arch Linux Users #### Arch Linux Users
1. Install packages: `base-devel cmake qt5-base qt5-multimedia qt5-x11extras` (`qtcreator` is recommended) 1. Install packages: `base-devel cmake qt5-base qt5-multimedia qt5-x11extras` (`qtcreator` is recommended)
2. Clone the project with `git clone --recurse-submodules https://barry-ran/QtScrcpy.git` 2. Clone the project with `git clone --recurse-submodules git@github.com:barry-ran/QtScrcpy.git`
3. Run `./ci/linux/build_for_linux.sh "Release"` 3. Run `./ci/linux/build_for_linux.sh "Release"`
### Scrcpy-Server ### Scrcpy-Server

View file

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