mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 03:13:39 +00:00
Make top resizing grabber larger on Windows (#11023)
This commit is contained in:
@@ -696,3 +696,22 @@ wxAuiToolBarItem* BBLTopbar::FindToolByCurrentPosition()
|
|||||||
wxPoint client_pos = this->ScreenToClient(mouse_pos);
|
wxPoint client_pos = this->ScreenToClient(mouse_pos);
|
||||||
return this->FindToolByPosition(client_pos.x, client_pos.y);
|
return this->FindToolByPosition(client_pos.x, client_pos.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __WIN32__
|
||||||
|
WXLRESULT BBLTopbar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (nMsg) {
|
||||||
|
case WM_NCHITTEST: {
|
||||||
|
const wxAuiToolBarItem* current_item = this->FindToolByCurrentPosition();
|
||||||
|
if (current_item != nullptr && current_item != m_title_item) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pass the event to main window if mouse is on the top bar and not on any of the buttons
|
||||||
|
return HTTRANSPARENT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return wxAuiToolBar::MSWWindowProc(nMsg, wParam, lParam);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ public:
|
|||||||
|
|
||||||
void ShowCalibrationButton(bool show = true);
|
void ShowCalibrationButton(bool show = true);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
#ifdef __WIN32__
|
||||||
|
WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) override;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxFrame* m_frame;
|
wxFrame* m_frame;
|
||||||
wxAuiToolBarItem* m_file_menu_item;
|
wxAuiToolBarItem* m_file_menu_item;
|
||||||
|
|||||||
@@ -739,6 +739,36 @@ WXLRESULT MainFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_NCHITTEST: {
|
||||||
|
if (IsMaximized()) {
|
||||||
|
// When maximized, no resize border
|
||||||
|
return HTCAPTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow resizing from top of the title bar
|
||||||
|
wxPoint mouse_pos = ::wxGetMousePosition();
|
||||||
|
if (m_topbar->GetScreenRect().GetBottom() >= mouse_pos.y) {
|
||||||
|
RECT borderThickness;
|
||||||
|
SetRectEmpty(&borderThickness);
|
||||||
|
AdjustWindowRectEx(&borderThickness, GetWindowLongPtr(hWnd, GWL_STYLE) & ~WS_CAPTION, FALSE, NULL);
|
||||||
|
borderThickness.left *= -1;
|
||||||
|
borderThickness.top *= -1;
|
||||||
|
wxPoint client_pos = this->ScreenToClient(mouse_pos);
|
||||||
|
|
||||||
|
bool on_top_border = client_pos.y <= borderThickness.top;
|
||||||
|
|
||||||
|
// And to allow diagonally resizing, we check if mouse is at window corner
|
||||||
|
if (client_pos.x <= borderThickness.left) {
|
||||||
|
return on_top_border ? HTTOPLEFT : HTLEFT;
|
||||||
|
} else if (client_pos.x >= GetClientSize().x - borderThickness.right) {
|
||||||
|
return on_top_border ? HTTOPRIGHT : HTRIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return on_top_border ? HTTOP : HTCAPTION;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_GETMINMAXINFO: {
|
case WM_GETMINMAXINFO: {
|
||||||
auto mmi = (MINMAXINFO*) lParam;
|
auto mmi = (MINMAXINFO*) lParam;
|
||||||
HandleGetMinMaxInfo(mmi);
|
HandleGetMinMaxInfo(mmi);
|
||||||
|
|||||||
Reference in New Issue
Block a user