summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2016-03-19 17:19:27 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2016-03-19 17:19:27 +0100
commit67ee3d654e5e70f1209bbd319f921cf4cdbfcd71 (patch)
treeefb82e9761c6423aa33307002baf3a5e4a3a2177
parentfa1bbbac757b14b6cea523c1b66eb17b50248a68 (diff)
Test if handling messages on the parent hwnd has any positive effects.
-rw-r--r--plugingui/nativewindow_win32.cc10
-rw-r--r--plugingui/nativewindow_win32.h1
2 files changed, 7 insertions, 4 deletions
diff --git a/plugingui/nativewindow_win32.cc b/plugingui/nativewindow_win32.cc
index 5acb43b..99c0c3e 100644
--- a/plugingui/nativewindow_win32.cc
+++ b/plugingui/nativewindow_win32.cc
@@ -315,12 +315,14 @@ NativeWindowWin32::NativeWindowWin32(void* native_window, Window& window)
RegisterClassEx(&wcex);
+ parent_window = (HWND)native_window;
+
m_hwnd = CreateWindowEx(0/*ex_style*/, m_className,
"DGBasisWidget",
(native_window?WS_CHILD:WS_OVERLAPPEDWINDOW) | WS_VISIBLE,
window.x(), window.y(),
window.width(), window.height(),
- (HWND)native_window, nullptr,
+ parent_window, nullptr,
GetModuleHandle(nullptr), nullptr);
SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this);
@@ -396,7 +398,7 @@ void NativeWindowWin32::grabMouse(bool grab)
bool NativeWindowWin32::hasEvent()
{
MSG msg;
- return PeekMessage(&msg, m_hwnd, 0, 0, PM_NOREMOVE) != 0;
+ return PeekMessage(&msg, parent_window, 0, 0, PM_NOREMOVE) != 0;
}
Event* NativeWindowWin32::getNextEvent()
@@ -404,7 +406,7 @@ Event* NativeWindowWin32::getNextEvent()
Event* event = nullptr;
MSG msg;
- if(GetMessage(&msg, m_hwnd, 0, 0))
+ if(GetMessage(&msg, parent_window, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
@@ -421,7 +423,7 @@ Event* NativeWindowWin32::peekNextEvent()
Event* event = nullptr;
MSG msg;
- if(PeekMessage(&msg, m_hwnd, 0, 0, PM_NOREMOVE))
+ if(PeekMessage(&msg, parent_window, 0, 0, PM_NOREMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
diff --git a/plugingui/nativewindow_win32.h b/plugingui/nativewindow_win32.h
index 2c8507d..e6db787 100644
--- a/plugingui/nativewindow_win32.h
+++ b/plugingui/nativewindow_win32.h
@@ -59,6 +59,7 @@ public:
private:
static LRESULT CALLBACK dialogProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
+ HWND parent_window;
Window& window;
WNDID m_hwnd = 0;
char* m_className = nullptr;