mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-06-06 23:04:25 +00:00
[idd] helper: set config window minimum size
This improves aesthetics and prevents widgets from getting clipped when the window is too small.
This commit is contained in:
@@ -61,6 +61,14 @@ CConfigWindow::CConfigWindow() : m_scale(1)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CConfigWindow::getMinimumSize(LONG &width, LONG &height)
|
||||||
|
{
|
||||||
|
RECT client = { 0, 0, (LONG)(436 * m_scale), (LONG)(300 * m_scale) };
|
||||||
|
AdjustWindowRect(&client, WS_OVERLAPPEDWINDOW, FALSE);
|
||||||
|
width = client.right - client.left;
|
||||||
|
height = client.bottom - client.top;
|
||||||
|
}
|
||||||
|
|
||||||
void CConfigWindow::updateFont()
|
void CConfigWindow::updateFont()
|
||||||
{
|
{
|
||||||
NONCLIENTMETRICS ncmMetrics = { sizeof(NONCLIENTMETRICS) };
|
NONCLIENTMETRICS ncmMetrics = { sizeof(NONCLIENTMETRICS) };
|
||||||
@@ -112,6 +120,12 @@ LRESULT CConfigWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||||||
RedrawWindow(m_hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
RedrawWindow(m_hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
case WM_GETMINMAXINFO:
|
||||||
|
{
|
||||||
|
LPMINMAXINFO lpMmi = (LPMINMAXINFO)lParam;
|
||||||
|
getMinimumSize(lpMmi->ptMinTrackSize.x, lpMmi->ptMinTrackSize.y);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
return onCommand(LOWORD(wParam), HIWORD(wParam), (HWND)lParam);
|
return onCommand(LOWORD(wParam), HIWORD(wParam), (HWND)lParam);
|
||||||
default:
|
default:
|
||||||
@@ -153,9 +167,9 @@ LRESULT CConfigWindow::onCreate()
|
|||||||
else
|
else
|
||||||
m_defRefresh->disable();
|
m_defRefresh->disable();
|
||||||
|
|
||||||
RECT client = { 0, 0, (LONG)(436 * m_scale), (LONG)(300 * m_scale) };
|
LONG width, height;
|
||||||
AdjustWindowRect(&client, WS_OVERLAPPEDWINDOW, FALSE);
|
getMinimumSize(width, height);
|
||||||
SetWindowPos(m_hwnd, NULL, 0, 0, client.right - client.left, client.bottom - client.top, SWP_NOMOVE | SWP_NOZORDER);
|
SetWindowPos(m_hwnd, NULL, 0, 0, width, height, SWP_NOMOVE | SWP_NOZORDER);
|
||||||
|
|
||||||
updateFont();
|
updateFont();
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class CConfigWindow : public CWindow
|
|||||||
std::optional<std::vector<DisplayMode>> m_modes;
|
std::optional<std::vector<DisplayMode>> m_modes;
|
||||||
std::optional<DWORD> m_defaultRefresh;
|
std::optional<DWORD> m_defaultRefresh;
|
||||||
|
|
||||||
|
void getMinimumSize(LONG &width, LONG &height);
|
||||||
void updateFont();
|
void updateFont();
|
||||||
void updateModeList();
|
void updateModeList();
|
||||||
void onModeListSelectChange();
|
void onModeListSelectChange();
|
||||||
|
|||||||
Reference in New Issue
Block a user