Enable the mouse wheel for windows 7

This commit is contained in:
dreamsourcelabTAI 2024-04-28 17:53:43 +08:00
parent a6a0484e01
commit 162efcf2fa
3 changed files with 16 additions and 16 deletions

View File

@ -759,16 +759,7 @@ void MainFrame::AttachNativeWindow()
_titleBar->EnableAbleDrag(false);
setWindowFlags(Qt::FramelessWindowHint);
if (nativeWindow->IsWin7()){
SetWindowLong((HWND)winId(), GWL_STYLE, WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
}
else{
SetWindowLong((HWND)winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
}
SetWindowLong((HWND)winId(), GWL_STYLE, WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
SetWindowLong((HWND)winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
SetParent((HWND)winId(), nativeWindow->Handle());
setVisible(true);

View File

@ -65,11 +65,13 @@ WinNativeWidget::WinNativeWidget(const int x, const int y, const int width,
_hWnd = NULL;
_event_callback = NULL;
_is_lose_foreground = false;
_titleBarWidget = NULL;
_is_native_border = IsWin11OrGreater();
_hCurrentMonitor = NULL;
_shadow = NULL;
_titleBarWidget = NULL;
_is_native_border = IsWin11OrGreater();
_is_win7 = IsWin7();
_border_color = QColor(0x80,0x80,0x80);
int r = backColor.red();
int g = backColor.green();
@ -77,7 +79,6 @@ WinNativeWidget::WinNativeWidget(const int x, const int y, const int width,
HINSTANCE hInstance = GetModuleHandle(nullptr);
WNDCLASSEX wcx;
memset(&wcx, 0, sizeof(WNDCLASSEXW));
wcx.cbSize = sizeof(WNDCLASSEX);
@ -365,6 +366,13 @@ LRESULT CALLBACK WinNativeWidget::WndProc(HWND hWnd, UINT message, WPARAM wParam
}
break;
}
case WM_MOUSEWHEEL:
{
if (self->_is_win7 && self->_childWindow != NULL){
return SendMessage(self->_childWindow, message, wParam, lParam);
}
break;
}
}
return DefWindowProc(hWnd, message, wParam, lParam);

View File

@ -85,8 +85,8 @@ public:
bool isActiveWindow();
void SetBorderColor(QColor color);
bool IsWin11OrGreater();
bool IsWin7();
static bool IsWin11OrGreater();
static bool IsWin7();
inline void SetTitleBarWidget(QWidget *w){
_titleBarWidget = w;
@ -126,6 +126,7 @@ private:
WinShadow *_shadow;
QColor _border_color;
bool _is_lose_foreground;
bool _is_win7;
};
}