From e5236f0cdec4f3a29a8748f65ca49fee3fb54c03 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Thu, 23 May 2019 22:50:46 +0200 Subject: add API for getting/setting window size bahahahaaa --- src/libui_sdl/libui/windows/window.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/libui_sdl/libui/windows/window.cpp') diff --git a/src/libui_sdl/libui/windows/window.cpp b/src/libui_sdl/libui/windows/window.cpp index f52e2f6..18d1171 100644 --- a/src/libui_sdl/libui/windows/window.cpp +++ b/src/libui_sdl/libui/windows/window.cpp @@ -363,6 +363,21 @@ static void windowMonitorRect(HWND hwnd, RECT *r) *r = mi.rcMonitor; } +void uiWindowPosition(uiWindow *w, int *x, int *y) +{ + RECT rect; + if (GetWindowRect(w->hwnd, &rect) == 0) + logLastError(L"error getting window position"); + *x = rect.left; + *y = rect.top; +} + +void uiWindowSetPosition(uiWindow *w, int x, int y) +{ + if (SetWindowPos(w->hwnd, NULL, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER) == 0) + logLastError(L"error moving window"); +} + void uiWindowContentSize(uiWindow *w, int *width, int *height) { RECT r; -- cgit v1.2.3