diff --git a/src/cocoa_init.m b/src/cocoa_init.m index b3831df1..a1fdad78 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -544,6 +544,8 @@ GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform) _glfwHideWindowCocoa, _glfwRequestWindowAttentionCocoa, _glfwFocusWindowCocoa, + _glfwDragWindowCocoa, + _glfwResizeWindowCocoa, _glfwSetWindowMonitorCocoa, _glfwWindowFocusedCocoa, _glfwWindowIconifiedCocoa, diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h index 9f7d191d..2fc05278 100644 --- a/src/cocoa_platform.h +++ b/src/cocoa_platform.h @@ -234,6 +234,8 @@ void _glfwShowWindowCocoa(_GLFWwindow* window); void _glfwHideWindowCocoa(_GLFWwindow* window); void _glfwRequestWindowAttentionCocoa(_GLFWwindow* window); void _glfwFocusWindowCocoa(_GLFWwindow* window); +void _glfwDragWindowCocoa(_GLFWwindow* window); +void _glfwResizeWindowCocoa(_GLFWwindow* window, int border); void _glfwSetWindowMonitorCocoa(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); GLFWbool _glfwWindowFocusedCocoa(_GLFWwindow* window); GLFWbool _glfwWindowIconifiedCocoa(_GLFWwindow* window); diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 64e6a289..56bd0ec9 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -1236,12 +1236,12 @@ void _glfwFocusWindowCocoa(_GLFWwindow* window) } // autoreleasepool } -void _glfwPlatformDragWindow(_GLFWwindow* window) +void _glfwDragWindowCocoa(_GLFWwindow* window) { [window->ns.object performWindowDragWithEvent:[NSApp currentEvent]]; } -void _glfwPlatformResizeWindow(_GLFWwindow* window, int border) +void _glfwResizeWindowCocoa(_GLFWwindow* window, int border) { } diff --git a/src/internal.h b/src/internal.h index 6ad15e48..49c1d1fa 100644 --- a/src/internal.h +++ b/src/internal.h @@ -722,6 +722,8 @@ struct _GLFWplatform void (*hideWindow)(_GLFWwindow*); void (*requestWindowAttention)(_GLFWwindow*); void (*focusWindow)(_GLFWwindow*); + void (*dragWindow)(_GLFWwindow*); + void (*resizeWindow)(_GLFWwindow*,int); void (*setWindowMonitor)(_GLFWwindow*,_GLFWmonitor*,int,int,int,int,int); GLFWbool (*windowFocused)(_GLFWwindow*); GLFWbool (*windowIconified)(_GLFWwindow*); @@ -884,66 +886,6 @@ void _glfwPlatformInitTimer(void); uint64_t _glfwPlatformGetTimerValue(void); uint64_t _glfwPlatformGetTimerFrequency(void); -int _glfwPlatformCreateWindow(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig, - const _GLFWctxconfig* ctxconfig, - const _GLFWfbconfig* fbconfig); -void _glfwPlatformDestroyWindow(_GLFWwindow* window); -void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title); -void _glfwPlatformSetWindowIcon(_GLFWwindow* window, - int count, const GLFWimage* images); -void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos); -void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos); -void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height); -void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height); -void _glfwPlatformSetWindowSizeLimits(_GLFWwindow* window, - int minwidth, int minheight, - int maxwidth, int maxheight); -void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom); -void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height); -void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window, - int* left, int* top, - int* right, int* bottom); -void _glfwPlatformGetWindowContentScale(_GLFWwindow* window, - float* xscale, float* yscale); -void _glfwPlatformIconifyWindow(_GLFWwindow* window); -void _glfwPlatformRestoreWindow(_GLFWwindow* window); -void _glfwPlatformMaximizeWindow(_GLFWwindow* window); -void _glfwPlatformShowWindow(_GLFWwindow* window); -void _glfwPlatformHideWindow(_GLFWwindow* window); -void _glfwPlatformRequestWindowAttention(_GLFWwindow* window); -void _glfwPlatformFocusWindow(_GLFWwindow* window); -void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor, - int xpos, int ypos, int width, int height, - int refreshRate); -void _glfwPlatformDragWindow(_GLFWwindow* window); -void _glfwPlatformResizeWindow(_GLFWwindow* window, int border); -int _glfwPlatformWindowFocused(_GLFWwindow* window); -int _glfwPlatformWindowIconified(_GLFWwindow* window); -int _glfwPlatformWindowVisible(_GLFWwindow* window); -int _glfwPlatformWindowMaximized(_GLFWwindow* window); -int _glfwPlatformWindowHovered(_GLFWwindow* window); -int _glfwPlatformFramebufferTransparent(_GLFWwindow* window); -float _glfwPlatformGetWindowOpacity(_GLFWwindow* window); -void _glfwPlatformSetWindowResizable(_GLFWwindow* window, GLFWbool enabled); -void _glfwPlatformSetWindowDecorated(_GLFWwindow* window, GLFWbool enabled); -void _glfwPlatformSetWindowFloating(_GLFWwindow* window, GLFWbool enabled); -void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity); - -void _glfwPlatformPollEvents(void); -void _glfwPlatformWaitEvents(void); -void _glfwPlatformWaitEventsTimeout(double timeout); -void _glfwPlatformPostEmptyEvent(void); - -void _glfwPlatformGetRequiredInstanceExtensions(char** extensions); -int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance, - VkPhysicalDevice device, - uint32_t queuefamily); -VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, - _GLFWwindow* window, - const VkAllocationCallbacks* allocator, - VkSurfaceKHR* surface); - GLFWbool _glfwPlatformCreateTls(_GLFWtls* tls); void _glfwPlatformDestroyTls(_GLFWtls* tls); void* _glfwPlatformGetTls(_GLFWtls* tls); diff --git a/src/null_init.c b/src/null_init.c index de4b28f3..904f5754 100644 --- a/src/null_init.c +++ b/src/null_init.c @@ -89,6 +89,8 @@ GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform) _glfwHideWindowNull, _glfwRequestWindowAttentionNull, _glfwFocusWindowNull, + _glfwDragWindowNull, + _glfwResizeWindowNull, _glfwSetWindowMonitorNull, _glfwWindowFocusedNull, _glfwWindowIconifiedNull, diff --git a/src/null_platform.h b/src/null_platform.h index b646acb3..20523c55 100644 --- a/src/null_platform.h +++ b/src/null_platform.h @@ -118,6 +118,8 @@ void _glfwRequestWindowAttentionNull(_GLFWwindow* window); void _glfwRequestWindowAttentionNull(_GLFWwindow* window); void _glfwHideWindowNull(_GLFWwindow* window); void _glfwFocusWindowNull(_GLFWwindow* window); +void _glfwDragWindowNull(_GLFWwindow* window); +void _glfwResizeWindowNull(_GLFWwindow* window, int border); GLFWbool _glfwWindowFocusedNull(_GLFWwindow* window); GLFWbool _glfwWindowIconifiedNull(_GLFWwindow* window); GLFWbool _glfwWindowVisibleNull(_GLFWwindow* window); diff --git a/src/null_window.c b/src/null_window.c index 103bf4ee..f0419c86 100644 --- a/src/null_window.c +++ b/src/null_window.c @@ -470,6 +470,14 @@ void _glfwFocusWindowNull(_GLFWwindow* window) _glfwInputWindowFocus(window, GLFW_TRUE); } +void _glfwDragWindowNull(_GLFWwindow* window) +{ +} + +void _glfwResizeWindowNull(_GLFWwindow* window, int border) +{ +} + int _glfwPlatformWindowFocused(_GLFWwindow* window) { return _glfw.null.focusedWindow == window; diff --git a/src/win32_init.c b/src/win32_init.c index 64393e77..1f343f07 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -654,6 +654,8 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform) _glfwHideWindowWin32, _glfwRequestWindowAttentionWin32, _glfwFocusWindowWin32, + _glfwDragWindowWin32, + _glfwResizeWindowWin32, _glfwSetWindowMonitorWin32, _glfwWindowFocusedWin32, _glfwWindowIconifiedWin32, diff --git a/src/win32_platform.h b/src/win32_platform.h index 82b34bb9..dc3fe50d 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -559,6 +559,8 @@ void _glfwShowWindowWin32(_GLFWwindow* window); void _glfwHideWindowWin32(_GLFWwindow* window); void _glfwRequestWindowAttentionWin32(_GLFWwindow* window); void _glfwFocusWindowWin32(_GLFWwindow* window); +void _glfwDragWindowWin32(_GLFWwindow* window); +void _glfwResizeWindowWin32(_GLFWwindow* window, int border); void _glfwSetWindowMonitorWin32(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); GLFWbool _glfwWindowFocusedWin32(_GLFWwindow* window); GLFWbool _glfwWindowIconifiedWin32(_GLFWwindow* window); diff --git a/src/win32_window.c b/src/win32_window.c index ca16f044..f46d0a33 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1775,7 +1775,7 @@ void _glfwFocusWindowWin32(_GLFWwindow* window) SetFocus(window->win32.handle); } -void _glfwPlatformDragWindow(_GLFWwindow* window) +void _glfwDragWindowWin32(_GLFWwindow* window) { ReleaseCapture(); SendMessage(window->win32.handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); @@ -1784,7 +1784,7 @@ void _glfwPlatformDragWindow(_GLFWwindow* window) _glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_1, GLFW_RELEASE, 0); } -void _glfwPlatformResizeWindow(_GLFWwindow* window, int border) +void _glfwResizeWindowWin32(_GLFWwindow* window, int border) { WPARAM wBorder; switch (border) diff --git a/src/window.c b/src/window.c index 64d89eb5..3caa6059 100644 --- a/src/window.c +++ b/src/window.c @@ -852,7 +852,7 @@ GLFWAPI void glfwDragWindow(GLFWwindow* handle) _GLFW_REQUIRE_INIT(); - _glfwPlatformDragWindow(window); + _glfw.platform.dragWindow(window); } GLFWAPI void glfwResizeWindow(GLFWwindow* handle, int border) @@ -865,7 +865,7 @@ GLFWAPI void glfwResizeWindow(GLFWwindow* handle, int border) if (border < GLFW_WINDOW_LEFT || border > GLFW_WINDOW_BOTTOMRIGHT) return; - _glfwPlatformResizeWindow(window, border); + _glfw.platform.resizeWindow(window, border); } GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib) diff --git a/src/wl_init.c b/src/wl_init.c index 4e6b4294..a8969654 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -435,6 +435,8 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform) _glfwHideWindowWayland, _glfwRequestWindowAttentionWayland, _glfwFocusWindowWayland, + _glfwDragWindowWayland, + _glfwResizeWindowWayland, _glfwSetWindowMonitorWayland, _glfwWindowFocusedWayland, _glfwWindowIconifiedWayland, diff --git a/src/wl_platform.h b/src/wl_platform.h index 238e1ed4..4ae3fd00 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -462,6 +462,8 @@ void _glfwShowWindowWayland(_GLFWwindow* window); void _glfwHideWindowWayland(_GLFWwindow* window); void _glfwRequestWindowAttentionWayland(_GLFWwindow* window); void _glfwFocusWindowWayland(_GLFWwindow* window); +void _glfwDragWindowWayland(_GLFWwindow* window); +void _glfwResizeWindowWayland(_GLFWwindow* window, int border); void _glfwSetWindowMonitorWayland(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); GLFWbool _glfwWindowFocusedWayland(_GLFWwindow* window); GLFWbool _glfwWindowIconifiedWayland(_GLFWwindow* window); diff --git a/src/wl_window.c b/src/wl_window.c index c18fc907..01e357eb 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -2098,12 +2098,12 @@ void _glfwFocusWindowWayland(_GLFWwindow* window) "Wayland: The platform does not support setting the input focus"); } -void _glfwPlatformDragWindow(_GLFWwindow* window) +void _glfwDragWindowWayland(_GLFWwindow* window) { xdg_toplevel_move(window->wl.xdg.toplevel, _glfw.wl.seat, _glfw.wl.serial); } -void _glfwPlatformResizeWindow(_GLFWwindow* window, int border) +void _glfwResizeWindowWayland(_GLFWwindow* window, int border) { int wlBorder; switch (border) diff --git a/src/x11_init.c b/src/x11_init.c index 1c69c0f6..3f93574b 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -1225,6 +1225,8 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform) _glfwHideWindowX11, _glfwRequestWindowAttentionX11, _glfwFocusWindowX11, + _glfwDragWindowX11, + _glfwResizeWindowX11, _glfwSetWindowMonitorX11, _glfwWindowFocusedX11, _glfwWindowIconifiedX11, diff --git a/src/x11_platform.h b/src/x11_platform.h index cdea3957..0ca53936 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -921,6 +921,8 @@ void _glfwShowWindowX11(_GLFWwindow* window); void _glfwHideWindowX11(_GLFWwindow* window); void _glfwRequestWindowAttentionX11(_GLFWwindow* window); void _glfwFocusWindowX11(_GLFWwindow* window); +void _glfwDragWindowX11(_GLFWwindow* window); +void _glfwResizeWindowX11(_GLFWwindow* window, int border); void _glfwSetWindowMonitorX11(_GLFWwindow* window, _GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); GLFWbool _glfwWindowFocusedX11(_GLFWwindow* window); GLFWbool _glfwWindowIconifiedX11(_GLFWwindow* window); diff --git a/src/x11_window.c b/src/x11_window.c index 834460ab..bf569af0 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2475,7 +2475,7 @@ void _glfwFocusWindowX11(_GLFWwindow* window) XFlush(_glfw.x11.display); } -void _glfwPlatformDragWindow(_GLFWwindow* window) +void _glfwDragWindowX11(_GLFWwindow* window) { int winXpos, winYpos; double curXpos, curYpos; @@ -2497,7 +2497,7 @@ void _glfwPlatformDragWindow(_GLFWwindow* window) XSendEvent(_glfw.x11.display, _glfw.x11.root, False, SubstructureRedirectMask | SubstructureNotifyMask, (XEvent *)&xclient); } -void _glfwPlatformResizeWindow(_GLFWwindow* window, int border) +void _glfwResizeWindowX11(_GLFWwindow* window, int border) { int winXpos, winYpos; double curXpos, curYpos;