From 07205d12ab39a05274249a0628bb1ec0c2094383 Mon Sep 17 00:00:00 2001
From: Bent Bisballe Nyeng <deva@aasimon.org>
Date: Sun, 2 Apr 2017 20:35:34 +0200
Subject: Fix missing win32 initial size when embedded in prent window - part
 2.

---
 plugingui/nativewindow_win32.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugingui/nativewindow_win32.cc b/plugingui/nativewindow_win32.cc
index 5ee912b..502bfe9 100644
--- a/plugingui/nativewindow_win32.cc
+++ b/plugingui/nativewindow_win32.cc
@@ -377,8 +377,12 @@ NativeWindowWin32::NativeWindowWin32(void* native_window, Window& window)
 		// Resize newly created window to fit into parent.
 		RECT rect;
 		GetClientRect(parent_window, &rect);
-		resize(rect.right - rect.left, rect.bottom - rect.top);
 
+		// Hack to make sure we scale the child and not simply the parent (again).
+		auto tmp = parent_window;
+		parent_window = nullptr;
+		resize(rect.right - rect.left, rect.bottom - rect.top);
+		parent_window = tmp;
 	}
 }
 
-- 
cgit v1.2.3