forked from github_mirror/framelesshelper
Minor tweaks
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
6adbefa814
commit
6bc6ed63cc
|
@ -226,7 +226,7 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (window->windowStates().testFlag(Qt::WindowState::WindowNoState)
|
||||
if ((window->windowState() == Qt::WindowState::WindowNoState)
|
||||
&& !isInSpecificObjects(globalPoint, getIgnoreObjects(window))
|
||||
&& getResizable(window)) {
|
||||
if (!window->startSystemResize(edges)) {
|
||||
|
@ -254,10 +254,10 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event)
|
|||
if (isInTitlebarArea(getMousePos(mouseEvent, true),
|
||||
getMousePos(mouseEvent, false),
|
||||
currentWindow)) {
|
||||
if (currentWindow->windowStates().testFlag(Qt::WindowState::WindowFullScreen)) {
|
||||
if (currentWindow->windowState() == Qt::WindowState::WindowFullScreen) {
|
||||
break;
|
||||
}
|
||||
if (currentWindow->windowStates().testFlag(Qt::WindowState::WindowMaximized)) {
|
||||
if (currentWindow->windowState() == Qt::WindowState::WindowMaximized) {
|
||||
currentWindow->showNormal();
|
||||
} else {
|
||||
currentWindow->showMaximized();
|
||||
|
@ -282,7 +282,7 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event)
|
|||
case QEvent::MouseMove: {
|
||||
const auto mouseEvent = static_cast<QMouseEvent *>(event);
|
||||
if (mouseEvent) {
|
||||
if (currentWindow->windowStates().testFlag(Qt::WindowState::WindowNoState)
|
||||
if ((currentWindow->windowState() == Qt::WindowState::WindowNoState)
|
||||
&& getResizable(currentWindow)) {
|
||||
currentWindow->setCursor(
|
||||
getCursorShape(getWindowEdges(getMousePos(mouseEvent, false),
|
||||
|
|
|
@ -289,7 +289,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
*result = 0;
|
||||
return true;
|
||||
}
|
||||
bool nonclient = false;
|
||||
bool nonClientAreaExists = false;
|
||||
const auto clientRect = &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(msg->lParam)->rgrc[0]);
|
||||
if (shouldHaveWindowFrame()) {
|
||||
// Store the original top before the default window proc
|
||||
|
@ -308,7 +308,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
// We don't need this correction when we're fullscreen. We will
|
||||
// have the WS_POPUP size, so we don't have to worry about
|
||||
// borders, and the default frame will be fine.
|
||||
if (IsMaximized(msg->hwnd) && !(window->windowState() & Qt::WindowFullScreen)) {
|
||||
if (IsMaximized(msg->hwnd) && !(window->windowState() == Qt::WindowFullScreen)) {
|
||||
// Windows automatically adds a standard width border to all
|
||||
// sides when a window is maximized. We have to remove it
|
||||
// otherwise the content of our window will be cut-off from
|
||||
|
@ -324,7 +324,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
clientRect->left += bw;
|
||||
clientRect->right -= bw;
|
||||
}
|
||||
nonclient = true;
|
||||
nonClientAreaExists = true;
|
||||
}
|
||||
// Attempt to detect if there's an autohide taskbar, and if
|
||||
// there is, reduce our size a bit on the side with the taskbar,
|
||||
|
@ -399,16 +399,16 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
if (top) {
|
||||
// Peculiarly, when we're fullscreen,
|
||||
clientRect->top += kAutoHideTaskbarThicknessPy;
|
||||
nonclient = true;
|
||||
nonClientAreaExists = true;
|
||||
} else if (bottom) {
|
||||
clientRect->bottom -= kAutoHideTaskbarThicknessPy;
|
||||
nonclient = true;
|
||||
nonClientAreaExists = true;
|
||||
} else if (left) {
|
||||
clientRect->left += kAutoHideTaskbarThicknessPx;
|
||||
nonclient = true;
|
||||
nonClientAreaExists = true;
|
||||
} else if (right) {
|
||||
clientRect->right -= kAutoHideTaskbarThicknessPx;
|
||||
nonclient = true;
|
||||
nonClientAreaExists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
// Windows exhibits bugs where client pixels and child HWNDs are
|
||||
// mispositioned by the width/height of the upper-left nonclient
|
||||
// area.
|
||||
*result = nonclient ? 0 : WVR_REDRAW;
|
||||
*result = nonClientAreaExists ? 0 : WVR_REDRAW;
|
||||
return true;
|
||||
}
|
||||
// These undocumented messages are sent to draw themed window
|
||||
|
|
|
@ -742,16 +742,18 @@ void Utilities::displaySystemMenu(const QWindow *window, const QPoint &pos)
|
|||
SetMenuItemInfoW(hMenu, SC_MAXIMIZE, FALSE, &mii);
|
||||
SetMenuItemInfoW(hMenu, SC_MINIMIZE, FALSE, &mii);
|
||||
mii.fState = MF_GRAYED;
|
||||
const auto isMin = [window]{
|
||||
const bool isMin = [window]{
|
||||
return (window->windowState() == Qt::WindowMinimized);
|
||||
}();
|
||||
const auto isMax = [window]{
|
||||
const bool isMax = [window]{
|
||||
return (window->windowState() == Qt::WindowMaximized);
|
||||
}();
|
||||
const auto isFull = [window]{
|
||||
const bool isFull = [window]{
|
||||
return (window->windowState() == Qt::WindowFullScreen);
|
||||
}();
|
||||
const bool isNormal = !isMin && !isMax && !isFull;
|
||||
const bool isNormal = [window]{
|
||||
return (window->windowState() == Qt::WindowNoState);
|
||||
}();
|
||||
const bool isFix = isWindowFixedSize(window);
|
||||
if (isFix || isMax || isFull) {
|
||||
SetMenuItemInfoW(hMenu, SC_SIZE, FALSE, &mii);
|
||||
|
|
Loading…
Reference in New Issue