Update to platform function setup

This commit is contained in:
robbin.marcus 2022-09-26 18:07:32 +02:00
parent b21eed2ad4
commit 2f55709f3b
17 changed files with 40 additions and 70 deletions

View File

@ -544,6 +544,8 @@ GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform)
_glfwHideWindowCocoa,
_glfwRequestWindowAttentionCocoa,
_glfwFocusWindowCocoa,
_glfwDragWindowCocoa,
_glfwResizeWindowCocoa,
_glfwSetWindowMonitorCocoa,
_glfwWindowFocusedCocoa,
_glfwWindowIconifiedCocoa,

View File

@ -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);

View File

@ -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)
{
}

View File

@ -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);

View File

@ -89,6 +89,8 @@ GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform)
_glfwHideWindowNull,
_glfwRequestWindowAttentionNull,
_glfwFocusWindowNull,
_glfwDragWindowNull,
_glfwResizeWindowNull,
_glfwSetWindowMonitorNull,
_glfwWindowFocusedNull,
_glfwWindowIconifiedNull,

View File

@ -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);

View File

@ -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;

View File

@ -654,6 +654,8 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform)
_glfwHideWindowWin32,
_glfwRequestWindowAttentionWin32,
_glfwFocusWindowWin32,
_glfwDragWindowWin32,
_glfwResizeWindowWin32,
_glfwSetWindowMonitorWin32,
_glfwWindowFocusedWin32,
_glfwWindowIconifiedWin32,

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -435,6 +435,8 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform)
_glfwHideWindowWayland,
_glfwRequestWindowAttentionWayland,
_glfwFocusWindowWayland,
_glfwDragWindowWayland,
_glfwResizeWindowWayland,
_glfwSetWindowMonitorWayland,
_glfwWindowFocusedWayland,
_glfwWindowIconifiedWayland,

View File

@ -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);

View File

@ -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)

View File

@ -1225,6 +1225,8 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform)
_glfwHideWindowX11,
_glfwRequestWindowAttentionX11,
_glfwFocusWindowX11,
_glfwDragWindowX11,
_glfwResizeWindowX11,
_glfwSetWindowMonitorX11,
_glfwWindowFocusedX11,
_glfwWindowIconifiedX11,

View File

@ -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);

View File

@ -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;