mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-10-30 15:57:37 +08:00
调整支持mingw编译
This commit is contained in:
parent
cfbaf44a05
commit
f099d3c737
@ -2279,6 +2279,11 @@ Some contents...</source>
|
|||||||
<source>window effect</source>
|
<source>window effect</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Theme.qml" line="178"/>
|
||||||
|
<source></source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>T_TimePicker</name>
|
<name>T_TimePicker</name>
|
||||||
|
@ -2461,6 +2461,11 @@ Some contents...</source>
|
|||||||
<source>window effect</source>
|
<source>window effect</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Theme.qml" line="178"/>
|
||||||
|
<source></source>
|
||||||
|
<translation></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>T_TimePicker</name>
|
<name>T_TimePicker</name>
|
||||||
|
@ -107,8 +107,7 @@ static inline void setShadow(HWND hwnd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline bool setWindowDarkMode(HWND hwnd, const BOOL enable) {
|
static inline bool setWindowDarkMode(HWND hwnd, const BOOL enable) {
|
||||||
return bool(DwmSetWindowAttribute(hwnd, DWMWINDOWATTRIBUTE::DWMWA_USE_IMMERSIVE_DARK_MODE,
|
return bool(DwmSetWindowAttribute(hwnd, 20, &enable, sizeof(BOOL)));
|
||||||
&enable, sizeof(BOOL)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &enable) {
|
static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &enable) {
|
||||||
@ -120,8 +119,8 @@ static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &en
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
DwmExtendFrameIntoClientArea(hwnd, &extendedMargins);
|
DwmExtendFrameIntoClientArea(hwnd, &extendedMargins);
|
||||||
if (isWin1122H2OrGreater()) {
|
if (isWin1122H2OrGreater()) {
|
||||||
const DWM_SYSTEMBACKDROP_TYPE backdropType = DWMSBT_MAINWINDOW;
|
const DWORD backdropType = _DWMSBT_MAINWINDOW;
|
||||||
DwmSetWindowAttribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE, &backdropType,
|
DwmSetWindowAttribute(hwnd, 38, &backdropType,
|
||||||
sizeof(backdropType));
|
sizeof(backdropType));
|
||||||
} else {
|
} else {
|
||||||
const BOOL enable = TRUE;
|
const BOOL enable = TRUE;
|
||||||
@ -129,8 +128,8 @@ static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &en
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isWin1122H2OrGreater()) {
|
if (isWin1122H2OrGreater()) {
|
||||||
const DWM_SYSTEMBACKDROP_TYPE backdropType = DWMSBT_AUTO;
|
const DWORD backdropType = _DWMSBT_AUTO;
|
||||||
DwmSetWindowAttribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE, &backdropType,
|
DwmSetWindowAttribute(hwnd, 38, &backdropType,
|
||||||
sizeof(backdropType));
|
sizeof(backdropType));
|
||||||
} else {
|
} else {
|
||||||
const BOOL enable = FALSE;
|
const BOOL enable = FALSE;
|
||||||
@ -148,12 +147,12 @@ static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &en
|
|||||||
}
|
}
|
||||||
if (enable) {
|
if (enable) {
|
||||||
DwmExtendFrameIntoClientArea(hwnd, &extendedMargins);
|
DwmExtendFrameIntoClientArea(hwnd, &extendedMargins);
|
||||||
const DWM_SYSTEMBACKDROP_TYPE backdropType = DWMSBT_TABBEDWINDOW;
|
const DWORD backdropType = _DWMSBT_TABBEDWINDOW;
|
||||||
DwmSetWindowAttribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE, &backdropType,
|
DwmSetWindowAttribute(hwnd, 38, &backdropType,
|
||||||
sizeof(backdropType));
|
sizeof(backdropType));
|
||||||
} else {
|
} else {
|
||||||
const DWM_SYSTEMBACKDROP_TYPE backdropType = DWMSBT_AUTO;
|
const DWORD backdropType = _DWMSBT_AUTO;
|
||||||
DwmSetWindowAttribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE, &backdropType,
|
DwmSetWindowAttribute(hwnd, 38, &backdropType,
|
||||||
sizeof(backdropType));
|
sizeof(backdropType));
|
||||||
}
|
}
|
||||||
BOOL isDark = FluTheme::getInstance()->dark();
|
BOOL isDark = FluTheme::getInstance()->dark();
|
||||||
@ -168,13 +167,13 @@ static inline bool setWindowEffect(HWND hwnd, const QString &key, const bool &en
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
MARGINS margins{-1, -1, -1, -1};
|
MARGINS margins{-1, -1, -1, -1};
|
||||||
DwmExtendFrameIntoClientArea(hwnd, &margins);
|
DwmExtendFrameIntoClientArea(hwnd, &margins);
|
||||||
DWM_SYSTEMBACKDROP_TYPE system_backdrop_type =
|
DWORD system_backdrop_type =
|
||||||
DWM_SYSTEMBACKDROP_TYPE::DWMSBT_TRANSIENTWINDOW;
|
_DWMSBT_TRANSIENTWINDOW;
|
||||||
DwmSetWindowAttribute(hwnd, DWMWINDOWATTRIBUTE::DWMWA_SYSTEMBACKDROP_TYPE,
|
DwmSetWindowAttribute(hwnd, 38,
|
||||||
&system_backdrop_type, sizeof(DWM_SYSTEMBACKDROP_TYPE));
|
&system_backdrop_type, sizeof(DWORD));
|
||||||
} else {
|
} else {
|
||||||
const DWM_SYSTEMBACKDROP_TYPE backdropType = DWMSBT_AUTO;
|
const DWORD backdropType = _DWMSBT_AUTO;
|
||||||
DwmSetWindowAttribute(hwnd, DWMWA_SYSTEMBACKDROP_TYPE, &backdropType,
|
DwmSetWindowAttribute(hwnd, 38, &backdropType,
|
||||||
sizeof(backdropType));
|
sizeof(backdropType));
|
||||||
}
|
}
|
||||||
BOOL isDark = FluTheme::getInstance()->dark();
|
BOOL isDark = FluTheme::getInstance()->dark();
|
||||||
|
@ -14,7 +14,17 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
|
enum _DWM_SYSTEMBACKDROP_TYPE {
|
||||||
|
_DWMSBT_AUTO, // [Default] Let DWM automatically decide the system-drawn backdrop for this
|
||||||
|
// window.
|
||||||
|
_DWMSBT_NONE, // [Disable] Do not draw any system backdrop.
|
||||||
|
_DWMSBT_MAINWINDOW, // [Mica] Draw the backdrop material effect corresponding to a
|
||||||
|
// long-lived window.
|
||||||
|
_DWMSBT_TRANSIENTWINDOW, // [Acrylic] Draw the backdrop material effect corresponding to a
|
||||||
|
// transient window.
|
||||||
|
_DWMSBT_TABBEDWINDOW, // [Mica Alt] Draw the backdrop material effect corresponding to a
|
||||||
|
// window with a tabbed title bar.
|
||||||
|
};
|
||||||
enum WINDOWCOMPOSITIONATTRIB {
|
enum WINDOWCOMPOSITIONATTRIB {
|
||||||
WCA_UNDEFINED = 0,
|
WCA_UNDEFINED = 0,
|
||||||
WCA_NCRENDERING_ENABLED = 1,
|
WCA_NCRENDERING_ENABLED = 1,
|
||||||
|
@ -12,6 +12,11 @@ Window {
|
|||||||
property bool fixSize: false
|
property bool fixSize: false
|
||||||
property Component loadingItem: com_loading
|
property Component loadingItem: com_loading
|
||||||
property bool fitsAppBarWindows: false
|
property bool fitsAppBarWindows: false
|
||||||
|
property var tintOpacity: FluTheme.dark ? 0.80 : 0.75
|
||||||
|
property int blurRadius: 60
|
||||||
|
property alias effect: frameless.effect
|
||||||
|
readonly property alias effective: frameless.effective
|
||||||
|
readonly property var availableEffects: frameless.availableEffects
|
||||||
property Item appBar: FluAppBar {
|
property Item appBar: FluAppBar {
|
||||||
title: window.title
|
title: window.title
|
||||||
height: 30
|
height: 30
|
||||||
@ -23,6 +28,15 @@ Window {
|
|||||||
icon: window.windowIcon
|
icon: window.windowIcon
|
||||||
}
|
}
|
||||||
property color backgroundColor: {
|
property color backgroundColor: {
|
||||||
|
if(frameless.effective && active){
|
||||||
|
var backcolor
|
||||||
|
if(frameless.effect==="dwm-blur"){
|
||||||
|
backcolor = FluTools.withOpacity(FluTheme.windowActiveBackgroundColor, window.tintOpacity)
|
||||||
|
}else{
|
||||||
|
backcolor = "transparent"
|
||||||
|
}
|
||||||
|
return backcolor
|
||||||
|
}
|
||||||
if(active){
|
if(active){
|
||||||
return FluTheme.windowActiveBackgroundColor
|
return FluTheme.windowActiveBackgroundColor
|
||||||
}
|
}
|
||||||
@ -106,6 +120,11 @@ Window {
|
|||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
frameless.onDestruction()
|
frameless.onDestruction()
|
||||||
}
|
}
|
||||||
|
onEffectiveChanged: {
|
||||||
|
if(effective){
|
||||||
|
FluTheme.blurBehindWindowEnabled = false
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_background
|
id:com_background
|
||||||
@ -161,8 +180,8 @@ Window {
|
|||||||
FluAcrylic{
|
FluAcrylic{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
target: img_back
|
target: img_back
|
||||||
tintOpacity: FluTheme.dark ? 0.80 : 0.75
|
tintOpacity: window.tintOpacity
|
||||||
blurRadius: 64
|
blurRadius: window.blurRadius
|
||||||
visible: window.active && FluTheme.blurBehindWindowEnabled
|
visible: window.active && FluTheme.blurBehindWindowEnabled
|
||||||
tintColor: FluTheme.dark ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
|
tintColor: FluTheme.dark ? Qt.rgba(0, 0, 0, 1) : Qt.rgba(1, 1, 1, 1)
|
||||||
targetRect: Qt.rect(window.x-window.screen.virtualX,window.y-window.screen.virtualY,window.width,window.height)
|
targetRect: Qt.rect(window.x-window.screen.virtualX,window.y-window.screen.virtualY,window.width,window.height)
|
||||||
@ -274,7 +293,7 @@ Window {
|
|||||||
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
|
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
|
||||||
}
|
}
|
||||||
Item{
|
Item{
|
||||||
id:layout_content
|
id: layout_content
|
||||||
anchors{
|
anchors{
|
||||||
top: loader_app_bar.bottom
|
top: loader_app_bar.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@ -293,7 +312,6 @@ Window {
|
|||||||
id:info_bar
|
id:info_bar
|
||||||
root: layout_container
|
root: layout_container
|
||||||
}
|
}
|
||||||
|
|
||||||
FluLoader{
|
FluLoader{
|
||||||
id:loader_border
|
id:loader_border
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
Loading…
Reference in New Issue
Block a user