aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pugl/pugl_win.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/pugl/pugl_win.cpp b/pugl/pugl_win.cpp
index 9b7cbcd..8ed19d8 100644
--- a/pugl/pugl_win.cpp
+++ b/pugl/pugl_win.cpp
@@ -106,6 +106,12 @@ puglCreate(PuglNativeWindow parent,
free(view);
return NULL;
}
+
+#ifdef _WIN64
+ SetWindowLongPtr(impl->hwnd, GWLP_USERDATA, (LONG_PTR)view);
+#else
+ SetWindowLongPtr(impl->hwnd, GWL_USERDATA, (LONG)view);
+#endif
SetWindowLongPtr(impl->hwnd, GWL_USERDATA, (LONG)view);
@@ -344,7 +350,12 @@ puglProcessEvents(PuglView* view)
LRESULT CALLBACK
wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
+#ifdef _WIN64
+ PuglView* view = (PuglView*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+#else
PuglView* view = (PuglView*)GetWindowLongPtr(hwnd, GWL_USERDATA);
+#endif
+
switch (message) {
case WM_CREATE:
PostMessage(hwnd, WM_SHOWWINDOW, TRUE, 0);