summaryrefslogtreecommitdiff
path: root/plugingui/nativewindow_win32.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-04-22 18:31:32 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-04-22 18:31:59 +0200
commitf3337eeb5fd222cc55f9cb912b02e516271a8a38 (patch)
treedf4963589c05730448027d4cc39430522521a6f2 /plugingui/nativewindow_win32.cc
parent50569ccd4f6e2294abded1a229814c68c2b1595d (diff)
Fix initial size of native window on windows.
Diffstat (limited to 'plugingui/nativewindow_win32.cc')
-rw-r--r--plugingui/nativewindow_win32.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/plugingui/nativewindow_win32.cc b/plugingui/nativewindow_win32.cc
index 9a51fe1..9cf146d 100644
--- a/plugingui/nativewindow_win32.cc
+++ b/plugingui/nativewindow_win32.cc
@@ -365,17 +365,7 @@ NativeWindowWin32::NativeWindowWin32(void* native_window, Window& window)
parent_window = (HWND)native_window;
- m_hwnd = CreateWindowEx(0/*ex_style*/, m_className,
- "DGBasisWidget",
- (native_window?WS_CHILD:WS_OVERLAPPEDWINDOW) |
- (native_window?WS_VISIBLE:0),
- 0, 0, //window.x(), window.y(),
- 1, 1, //window.width(), window.height(),
- parent_window, nullptr,
- GetModuleHandle(nullptr), nullptr);
-
- SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
-
+ int width = 1, height = 1;
if(parent_window)
{
// Listen in on parent size changes.
@@ -386,10 +376,21 @@ NativeWindowWin32::NativeWindowWin32(void* native_window, Window& window)
GetClientRect(parent_window, &rect);
auto resizeEvent = std::make_shared<ResizeEvent>();
- resizeEvent->width = rect.right - rect.left;
- resizeEvent->height = rect.bottom - rect.top;
+ width = resizeEvent->width = rect.right - rect.left;
+ height = resizeEvent->height = rect.bottom - rect.top;
event_queue.push_back(resizeEvent);
}
+
+ m_hwnd = CreateWindowEx(0/*ex_style*/, m_className,
+ "DGBasisWidget",
+ (native_window?WS_CHILD:WS_OVERLAPPEDWINDOW) |
+ (native_window?WS_VISIBLE:0),
+ 0, 0,
+ width, height,
+ parent_window, nullptr,
+ GetModuleHandle(nullptr), nullptr);
+
+ SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
}
NativeWindowWin32::~NativeWindowWin32()