mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 01:55:09 +00:00
Win32: Fixup
This commit is contained in:
parent
4e96e90f64
commit
1d9406b0b2
@ -273,6 +273,7 @@ typedef struct _GLFWwindowWin32
|
|||||||
// Whether to enable framebuffer transparency on DWM
|
// Whether to enable framebuffer transparency on DWM
|
||||||
GLFWbool transparent;
|
GLFWbool transparent;
|
||||||
GLFWbool external;
|
GLFWbool external;
|
||||||
|
LONG_PTR externalWindowProc;
|
||||||
|
|
||||||
// The last received cursor position, regardless of source
|
// The last received cursor position, regardless of source
|
||||||
int lastCursorPosX, lastCursorPosY;
|
int lastCursorPosX, lastCursorPosY;
|
||||||
|
@ -1261,10 +1261,19 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
|
|||||||
if (_glfw.win32.disabledCursorWindow == window)
|
if (_glfw.win32.disabledCursorWindow == window)
|
||||||
_glfw.win32.disabledCursorWindow = NULL;
|
_glfw.win32.disabledCursorWindow = NULL;
|
||||||
|
|
||||||
if (window->win32.handle && !window->win32.external)
|
if (window->win32.handle)
|
||||||
{
|
{
|
||||||
RemovePropW(window->win32.handle, L"GLFW");
|
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;
|
window->win32.handle = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2039,10 +2048,12 @@ GLFWAPI GLFWwindow* glfwAttachWin32Window(HWND handle, GLFWwindow* share)
|
|||||||
window->numer = GLFW_DONT_CARE;
|
window->numer = GLFW_DONT_CARE;
|
||||||
window->denom = GLFW_DONT_CARE;
|
window->denom = GLFW_DONT_CARE;
|
||||||
|
|
||||||
window->win32.handle = handle;
|
window->win32.handle = handle;
|
||||||
window->win32.external = GLFW_TRUE;
|
|
||||||
|
|
||||||
SetPropW(window->win32.handle, L"GLFW", window);
|
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);
|
SetWindowLongPtrW(window->win32.handle, GWLP_WNDPROC, (LONG_PTR) windowProc);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -38,11 +38,6 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
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)
|
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
// This will only be used until glfwAttachWin32Window
|
// This will only be used until glfwAttachWin32Window
|
||||||
@ -100,8 +95,6 @@ int main(void)
|
|||||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
|
|
||||||
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
|
|
||||||
|
|
||||||
while (!glfwWindowShouldClose(window))
|
while (!glfwWindowShouldClose(window))
|
||||||
{
|
{
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
Loading…
Reference in New Issue
Block a user