Win32: Fixup
diff --git a/src/win32_platform.h b/src/win32_platform.h
index b3535d6..8261269 100644
--- a/src/win32_platform.h
+++ b/src/win32_platform.h
@@ -273,6 +273,7 @@
// Whether to enable framebuffer transparency on DWM
GLFWbool transparent;
GLFWbool external;
+ LONG_PTR externalWindowProc;
// The last received cursor position, regardless of source
int lastCursorPosX, lastCursorPosY;
diff --git a/src/win32_window.c b/src/win32_window.c
index e08c775..25b8a2a 100644
--- a/src/win32_window.c
+++ b/src/win32_window.c
@@ -1261,10 +1261,19 @@
if (_glfw.win32.disabledCursorWindow == window)
_glfw.win32.disabledCursorWindow = NULL;
- if (window->win32.handle && !window->win32.external)
+ if (window->win32.handle)
{
RemovePropW(window->win32.handle, L"GLFW");
- DestroyWindow(window->win32.handle);
+
+ if (window->win32.external)
+ {
+ SetWindowLongPtrW(window->win32.handle,
+ GWLP_WNDPROC,
+ window->win32.externalWindowProc);
+ }
+ else
+ DestroyWindow(window->win32.handle);
+
window->win32.handle = NULL;
}
@@ -2039,10 +2048,12 @@
window->numer = GLFW_DONT_CARE;
window->denom = GLFW_DONT_CARE;
- window->win32.handle = handle;
- window->win32.external = GLFW_TRUE;
-
+ window->win32.handle = handle;
SetPropW(window->win32.handle, L"GLFW", window);
+
+ window->win32.external = GLFW_TRUE;
+ window->win32.externalWindowProc =
+ GetWindowLongPtrW(window->win32.handle, GWLP_WNDPROC);
SetWindowLongPtrW(window->win32.handle, GWLP_WNDPROC, (LONG_PTR) windowProc);
{
diff --git a/tests/native.c b/tests/native.c
index f42c182..f52fc5e 100644
--- a/tests/native.c
+++ b/tests/native.c
@@ -38,11 +38,6 @@
fprintf(stderr, "Error: %s\n", description);
}
-static void framebuffer_size_callback(GLFWwindow* window, int width, int height)
-{
- glViewport(0, 0, width, height);
-}
-
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// This will only be used until glfwAttachWin32Window
@@ -100,8 +95,6 @@
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
glfwSwapInterval(1);
- glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
-
while (!glfwWindowShouldClose(window))
{
glClear(GL_COLOR_BUFFER_BIT);