mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-01-23 04:14:35 +08:00
update
This commit is contained in:
parent
8253fb611f
commit
bf5c722058
@ -22,7 +22,7 @@ static inline bool isWindows11OrGreater() {
|
||||
if (dwVersion < 0x80000000)
|
||||
dwBuild = (DWORD)(HIWORD(dwVersion));
|
||||
#pragma warning(pop)
|
||||
return dwBuild < 22000;
|
||||
return dwBuild >= 22000;
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ static inline bool isCompositionEnabled(){
|
||||
|
||||
static inline void showShadow(HWND hwnd){
|
||||
if(isCompositionEnabled()){
|
||||
const MARGINS shadow = { 1, 0, 0, 0 };
|
||||
const MARGINS shadow = { 0, 0, 1, 0 };
|
||||
typedef HRESULT (WINAPI* DwmExtendFrameIntoClientAreaPtr)(HWND hWnd, const MARGINS *pMarInset);
|
||||
HMODULE module = LoadLibraryW(L"dwmapi.dll");
|
||||
if (module)
|
||||
@ -110,20 +110,6 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
||||
}
|
||||
return false;
|
||||
}else if(uMsg == WM_NCCALCSIZE){
|
||||
NCCALCSIZE_PARAMS* sz = reinterpret_cast<NCCALCSIZE_PARAMS*>(lParam);
|
||||
if(IsZoomed(hwnd)){
|
||||
sz->rgrc[0].left += 8;
|
||||
sz->rgrc[0].top += 8;
|
||||
sz->rgrc[0].right -= 8;
|
||||
sz->rgrc[0].bottom -= isTaskbarAutoHide() ? 9 : 8;
|
||||
}else{
|
||||
sz->rgrc[0].top += isWindows11OrGreater() ? 0 : 1;
|
||||
if(isCompositionEnabled()){
|
||||
sz->rgrc[0].right -= 8;
|
||||
sz->rgrc[0].bottom -= 8;
|
||||
sz->rgrc[0].left -= -8;
|
||||
}
|
||||
}
|
||||
*result = WVR_REDRAW;
|
||||
return true;
|
||||
}else if(uMsg == WM_NCPAINT){
|
||||
@ -269,9 +255,7 @@ void FluFramelessHelper::componentComplete(){
|
||||
}
|
||||
if(!window.isNull()){
|
||||
#ifdef Q_OS_WIN
|
||||
if(!isCompositionEnabled()){
|
||||
window->setFlag(Qt::FramelessWindowHint,true);
|
||||
}
|
||||
window->setFlags(window->flags() | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
|
||||
_nativeEvent =new FramelessEventFilter(this);
|
||||
qApp->installNativeEventFilter(_nativeEvent);
|
||||
HWND hwnd = reinterpret_cast<HWND>(window->winId());
|
||||
@ -282,6 +266,7 @@ void FluFramelessHelper::componentComplete(){
|
||||
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION);
|
||||
}
|
||||
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
|
||||
showShadow(hwnd);
|
||||
#else
|
||||
window->setFlags((window->flags() & (~Qt::WindowMinMaxButtonsHint) & (~Qt::Dialog)) | Qt::FramelessWindowHint | Qt::Window);
|
||||
#endif
|
||||
|
@ -208,7 +208,7 @@ bool FluTools::isWindows11OrGreater(){
|
||||
if (dwVersion < 0x80000000)
|
||||
dwBuild = (DWORD)(HIWORD(dwVersion));
|
||||
#pragma warning(pop)
|
||||
return dwBuild < 22000;
|
||||
return dwBuild >= 22000;
|
||||
#endif
|
||||
var = QVariant::fromValue(false);
|
||||
return false;
|
||||
|
@ -53,6 +53,7 @@ Window {
|
||||
signal showSystemMenu
|
||||
signal initArgument(var argument)
|
||||
signal firstVisible()
|
||||
property point _offsetXY : Qt.point(0,0)
|
||||
id:window
|
||||
color:"transparent"
|
||||
Component.onCompleted: {
|
||||
@ -72,6 +73,19 @@ Window {
|
||||
Component.onDestruction: {
|
||||
lifecycle.onDestruction()
|
||||
}
|
||||
onVisibilityChanged: {
|
||||
if(visibility === Window.Maximized || visibility === Window.FullScreen){
|
||||
var dx = window.x-Screen.virtualX
|
||||
var dy = window.y-Screen.virtualY
|
||||
if(dx<0 && dy<0){
|
||||
_offsetXY = Qt.point(Math.abs(dx+1),Math.abs(dy+1))
|
||||
}else{
|
||||
_offsetXY = Qt.point(0,0)
|
||||
}
|
||||
}else{
|
||||
_offsetXY = Qt.point(0,0)
|
||||
}
|
||||
}
|
||||
onShowSystemMenu: {
|
||||
if(loader_frameless_helper.item){
|
||||
loader_frameless_helper.item.showSystemMenu()
|
||||
@ -177,6 +191,10 @@ Window {
|
||||
id:layout_container
|
||||
anchors{
|
||||
fill:parent
|
||||
leftMargin: _offsetXY.x
|
||||
rightMargin: _offsetXY.x
|
||||
topMargin: _offsetXY.y
|
||||
bottomMargin: _offsetXY.y
|
||||
}
|
||||
onWidthChanged: {
|
||||
window.appBar.width = width
|
||||
@ -229,7 +247,7 @@ Window {
|
||||
border.width: window.resizeBorderWidth
|
||||
border.color: window.resizeBorderColor
|
||||
visible: {
|
||||
if(window.useSystemAppBar || FluTools.isWin()){
|
||||
if(window.useSystemAppBar){
|
||||
return false
|
||||
}
|
||||
if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
|
||||
|
@ -52,6 +52,7 @@ Window {
|
||||
signal showSystemMenu
|
||||
signal initArgument(var argument)
|
||||
signal firstVisible()
|
||||
property point _offsetXY : Qt.point(0,0)
|
||||
id:window
|
||||
color:"transparent"
|
||||
Component.onCompleted: {
|
||||
@ -71,6 +72,19 @@ Window {
|
||||
Component.onDestruction: {
|
||||
lifecycle.onDestruction()
|
||||
}
|
||||
onVisibilityChanged: {
|
||||
if(visibility === Window.Maximized || visibility === Window.FullScreen){
|
||||
var dx = window.x-Screen.virtualX
|
||||
var dy = window.y-Screen.virtualY
|
||||
if(dx<0 && dy<0){
|
||||
_offsetXY = Qt.point(Math.abs(dx+1),Math.abs(dy+1))
|
||||
}else{
|
||||
_offsetXY = Qt.point(0,0)
|
||||
}
|
||||
}else{
|
||||
_offsetXY = Qt.point(0,0)
|
||||
}
|
||||
}
|
||||
onShowSystemMenu: {
|
||||
if(loader_frameless_helper.item){
|
||||
loader_frameless_helper.item.showSystemMenu()
|
||||
@ -176,6 +190,10 @@ Window {
|
||||
id:layout_container
|
||||
anchors{
|
||||
fill:parent
|
||||
leftMargin: _offsetXY.x
|
||||
rightMargin: _offsetXY.x
|
||||
topMargin: _offsetXY.y
|
||||
bottomMargin: _offsetXY.y
|
||||
}
|
||||
onWidthChanged: {
|
||||
window.appBar.width = width
|
||||
@ -228,7 +246,7 @@ Window {
|
||||
border.width: window.resizeBorderWidth
|
||||
border.color: window.resizeBorderColor
|
||||
visible: {
|
||||
if(window.useSystemAppBar || FluTools.isWin()){
|
||||
if(window.useSystemAppBar){
|
||||
return false
|
||||
}
|
||||
if(window.visibility == Window.Maximized || window.visibility == Window.FullScreen){
|
||||
|
Loading…
Reference in New Issue
Block a user