From 21c0b85b57c68d591108d5f8efc1c2247c05c74f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 11 Apr 2017 21:42:02 +0200 Subject: Only make window decoration compensation if window has no parent (ie. actually is a window and not just an embbedded widget). --- plugingui/nativewindow_win32.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/plugingui/nativewindow_win32.cc b/plugingui/nativewindow_win32.cc index c166d04..01a2fa8 100644 --- a/plugingui/nativewindow_win32.cc +++ b/plugingui/nativewindow_win32.cc @@ -408,15 +408,21 @@ void NativeWindowWin32::setFixedSize(std::size_t width, std::size_t height) void NativeWindowWin32::resize(std::size_t width, std::size_t height) { auto hwnd = m_hwnd; - if(parent_window) - { - hwnd = parent_window; - } + //if(parent_window) + //{ + // hwnd = parent_window; + //} + + // Set requested size on the window (or parent) SetWindowPos(hwnd, nullptr, -1, -1, (int)width, (int)height, SWP_NOMOVE); + + // Ask the client window what size it actually got RECT rect; - GetClientRect(hwnd, &rect); + GetClientRect(m_hwnd, &rect); int w = width - rect.right; int h = height - rect.bottom; + + // Set the compensated size on the window (or parent) SetWindowPos(hwnd, nullptr, -1, -1, width + w, height + h, SWP_NOMOVE); } -- cgit v1.2.3