Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
朱子楚\zhuzi committed Mar 15, 2024
1 parent 3f7555d commit 2d2f991
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
23 changes: 23 additions & 0 deletions src/FluFramelessHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,26 @@ static inline bool isCompositionEnabled(){
}
return false;
}

static inline void showShadow(HWND hwnd){
if(isCompositionEnabled()){
const MARGINS shadow = { 0, 0, 1, 0 };
typedef HRESULT (WINAPI* DwmExtendFrameIntoClientAreaPtr)(HWND hWnd, const MARGINS *pMarInset);
HMODULE module = LoadLibraryW(L"dwmapi.dll");
if (module)
{
DwmExtendFrameIntoClientAreaPtr dwm_extendframe_into_client_area_;
dwm_extendframe_into_client_area_= reinterpret_cast<DwmExtendFrameIntoClientAreaPtr>(GetProcAddress(module, "DwmExtendFrameIntoClientArea"));
if (dwm_extendframe_into_client_area_)
{
dwm_extendframe_into_client_area_(hwnd, &shadow);
}
}
}else{
ULONG_PTR cNewStyle = GetClassLongPtr(hwnd, GCL_STYLE) | CS_DROPSHADOW;
SetClassLongPtr(hwnd, GCL_STYLE, cNewStyle);
}
}
#endif

FramelessEventFilter::FramelessEventFilter(FluFramelessHelper* helper){
Expand Down Expand Up @@ -322,6 +342,9 @@ void FluFramelessHelper::componentComplete(){
_appBar.value<QObject*>()->setProperty("systemMoveEnable",false);
}
window->setFlags((window->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::FramelessWindowHint);
if(FluTools::getInstance()->isSoftware() && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)){
window->setFlag(Qt::FramelessWindowHint,false);
}
if(resizeable()){
window->setFlag(Qt::WindowMaximizeButtonHint);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Qt5/imports/FluentUI/Controls/FluExpander.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Item {
d.flag = false
}
}
clip: true
Rectangle{
id:layout_header
width: parent.width
Expand Down Expand Up @@ -79,10 +80,10 @@ Item {
topMargin: -1
left: layout_header.left
}
clip: true
visible: contentHeight+container.anchors.topMargin !== 0
height: contentHeight+container.anchors.topMargin
width: parent.width
z:-999
Rectangle{
id:container
anchors.fill: parent
Expand Down
3 changes: 2 additions & 1 deletion src/Qt6/imports/FluentUI/Controls/FluExpander.qml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Item {
d.flag = false
}
}
clip: true
Rectangle{
id:layout_header
width: parent.width
Expand Down Expand Up @@ -79,10 +80,10 @@ Item {
topMargin: -1
left: layout_header.left
}
clip: true
visible: contentHeight+container.anchors.topMargin !== 0
height: contentHeight+container.anchors.topMargin
width: parent.width
z:-999
Rectangle{
id:container
anchors.fill: parent
Expand Down

0 comments on commit 2d2f991

Please sign in to comment.