Fix issue with merge

This commit is contained in:
NarrikSynthfox 2024-04-10 13:39:35 -04:00
parent 39dec1415b
commit a4c3492a03
3 changed files with 960 additions and 1146 deletions

View File

@ -653,93 +653,80 @@ GLFWAPI void glfwSetInputMode(GLFWwindow *handle, int mode, int value)
switch (mode) switch (mode)
{ {
case GLFW_CURSOR: case GLFW_CURSOR:
{
if (value != GLFW_CURSOR_NORMAL &&
value != GLFW_CURSOR_HIDDEN &&
value != GLFW_CURSOR_DISABLED &&
value != GLFW_CURSOR_CAPTURED)
{ {
_glfwInputError(GLFW_INVALID_ENUM, if (value != GLFW_CURSOR_NORMAL &&
"Invalid cursor mode 0x%08X", value != GLFW_CURSOR_HIDDEN &&
value); value != GLFW_CURSOR_DISABLED &&
return; value != GLFW_CURSOR_CAPTURED)
}
if (window->cursorMode == value)
return;
window->cursorMode = value;
_glfw.platform.getCursorPos(window,
&window->virtualCursorPosX,
&window->virtualCursorPosY);
_glfw.platform.setCursorMode(window, value);
return;
}
case GLFW_STICKY_KEYS:
{
value = value ? GLFW_TRUE : GLFW_FALSE;
if (window->stickyKeys == value)
return;
if (!value)
{
int i;
// Release all sticky keys
for (i = 0; i <= GLFW_KEY_LAST; i++)
{ {
if (window->keys[i] == _GLFW_STICK) _glfwInputError(GLFW_INVALID_ENUM,
window->keys[i] = GLFW_RELEASE; "Invalid cursor mode 0x%08X",
value);
return;
} }
if (window->cursorMode == value)
return;
window->cursorMode = value;
_glfw.platform.getCursorPos(window,
&window->virtualCursorPosX,
&window->virtualCursorPosY);
_glfw.platform.setCursorMode(window, value);
return;
} }
window->stickyKeys = value; case GLFW_STICKY_KEYS:
return;
}
case GLFW_STICKY_MOUSE_BUTTONS:
{
value = value ? GLFW_TRUE : GLFW_FALSE;
if (window->stickyMouseButtons == value)
return;
if (!value)
{ {
int i; value = value ? GLFW_TRUE : GLFW_FALSE;
if (window->stickyKeys == value)
return;
// Release all sticky mouse buttons if (!value)
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
{ {
if (window->mouseButtons[i] == _GLFW_STICK) int i;
window->mouseButtons[i] = GLFW_RELEASE;
// Release all sticky keys
for (i = 0; i <= GLFW_KEY_LAST; i++)
{
if (window->keys[i] == _GLFW_STICK)
window->keys[i] = GLFW_RELEASE;
}
} }
window->stickyKeys = value;
return;
} }
window->stickyMouseButtons = value; case GLFW_STICKY_MOUSE_BUTTONS:
return;
}
case GLFW_LOCK_KEY_MODS:
{
window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE;
return;
}
case GLFW_RAW_MOUSE_MOTION:
{
if (!_glfw.platform.rawMouseMotionSupported())
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, value = value ? GLFW_TRUE : GLFW_FALSE;
"Raw mouse motion is not supported on this system"); if (window->stickyMouseButtons == value)
return;
if (!value)
{
int i;
// Release all sticky mouse buttons
for (i = 0; i <= GLFW_MOUSE_BUTTON_LAST; i++)
{
if (window->mouseButtons[i] == _GLFW_STICK)
window->mouseButtons[i] = GLFW_RELEASE;
}
}
window->stickyMouseButtons = value;
return; return;
} }
value = value ? GLFW_TRUE : GLFW_FALSE; case GLFW_LOCK_KEY_MODS:
if (window->rawMouseMotion == value) {
window->lockKeyMods = value ? GLFW_TRUE : GLFW_FALSE;
return; return;
}
case GLFW_RAW_MOUSE_MOTION: case GLFW_RAW_MOUSE_MOTION:
{ {

View File

@ -33,25 +33,26 @@
#include <stdlib.h> #include <stdlib.h>
#include <float.h> #include <float.h>
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
////// GLFW event API ////// ////// GLFW event API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// Notifies shared code that a window has lost or received input focus // Notifies shared code that a window has lost or received input focus
// //
void _glfwInputWindowFocus(_GLFWwindow *window, GLFWbool focused) void _glfwInputWindowFocus(_GLFWwindow* window, GLFWbool focused)
{ {
assert(window != NULL); assert(window != NULL);
assert(focused == GLFW_TRUE || focused == GLFW_FALSE); assert(focused == GLFW_TRUE || focused == GLFW_FALSE);
if (window->callbacks.focus) if (window->callbacks.focus)
window->callbacks.focus((GLFWwindow *)window, focused); window->callbacks.focus((GLFWwindow*) window, focused);
if (!focused) if (!focused)
{ {
int key, button; int key, button;
for (key = 0; key <= GLFW_KEY_LAST; key++) for (key = 0; key <= GLFW_KEY_LAST; key++)
{ {
if (window->keys[key] == GLFW_PRESS) if (window->keys[key] == GLFW_PRESS)
{ {
@ -60,7 +61,7 @@ void _glfwInputWindowFocus(_GLFWwindow *window, GLFWbool focused)
} }
} }
for (button = 0; button <= GLFW_MOUSE_BUTTON_LAST; button++) for (button = 0; button <= GLFW_MOUSE_BUTTON_LAST; button++)
{ {
if (window->mouseButtons[button] == GLFW_PRESS) if (window->mouseButtons[button] == GLFW_PRESS)
_glfwInputMouseClick(window, button, GLFW_RELEASE, 0); _glfwInputMouseClick(window, button, GLFW_RELEASE, 0);
@ -71,66 +72,66 @@ void _glfwInputWindowFocus(_GLFWwindow *window, GLFWbool focused)
// Notifies shared code that a window has moved // Notifies shared code that a window has moved
// The position is specified in content area relative screen coordinates // The position is specified in content area relative screen coordinates
// //
void _glfwInputWindowPos(_GLFWwindow *window, int x, int y) void _glfwInputWindowPos(_GLFWwindow* window, int x, int y)
{ {
assert(window != NULL); assert(window != NULL);
if (window->callbacks.pos) if (window->callbacks.pos)
window->callbacks.pos((GLFWwindow *)window, x, y); window->callbacks.pos((GLFWwindow*) window, x, y);
} }
// Notifies shared code that a window has been resized // Notifies shared code that a window has been resized
// The size is specified in screen coordinates // The size is specified in screen coordinates
// //
void _glfwInputWindowSize(_GLFWwindow *window, int width, int height) void _glfwInputWindowSize(_GLFWwindow* window, int width, int height)
{ {
assert(window != NULL); assert(window != NULL);
assert(width >= 0); assert(width >= 0);
assert(height >= 0); assert(height >= 0);
if (window->callbacks.size) if (window->callbacks.size)
window->callbacks.size((GLFWwindow *)window, width, height); window->callbacks.size((GLFWwindow*) window, width, height);
} }
// Notifies shared code that a window has been iconified or restored // Notifies shared code that a window has been iconified or restored
// //
void _glfwInputWindowIconify(_GLFWwindow *window, GLFWbool iconified) void _glfwInputWindowIconify(_GLFWwindow* window, GLFWbool iconified)
{ {
assert(window != NULL); assert(window != NULL);
assert(iconified == GLFW_TRUE || iconified == GLFW_FALSE); assert(iconified == GLFW_TRUE || iconified == GLFW_FALSE);
if (window->callbacks.iconify) if (window->callbacks.iconify)
window->callbacks.iconify((GLFWwindow *)window, iconified); window->callbacks.iconify((GLFWwindow*) window, iconified);
} }
// Notifies shared code that a window has been maximized or restored // Notifies shared code that a window has been maximized or restored
// //
void _glfwInputWindowMaximize(_GLFWwindow *window, GLFWbool maximized) void _glfwInputWindowMaximize(_GLFWwindow* window, GLFWbool maximized)
{ {
assert(window != NULL); assert(window != NULL);
assert(maximized == GLFW_TRUE || maximized == GLFW_FALSE); assert(maximized == GLFW_TRUE || maximized == GLFW_FALSE);
if (window->callbacks.maximize) if (window->callbacks.maximize)
window->callbacks.maximize((GLFWwindow *)window, maximized); window->callbacks.maximize((GLFWwindow*) window, maximized);
} }
// Notifies shared code that a window framebuffer has been resized // Notifies shared code that a window framebuffer has been resized
// The size is specified in pixels // The size is specified in pixels
// //
void _glfwInputFramebufferSize(_GLFWwindow *window, int width, int height) void _glfwInputFramebufferSize(_GLFWwindow* window, int width, int height)
{ {
assert(window != NULL); assert(window != NULL);
assert(width >= 0); assert(width >= 0);
assert(height >= 0); assert(height >= 0);
if (window->callbacks.fbsize) if (window->callbacks.fbsize)
window->callbacks.fbsize((GLFWwindow *)window, width, height); window->callbacks.fbsize((GLFWwindow*) window, width, height);
} }
// Notifies shared code that a window content scale has changed // Notifies shared code that a window content scale has changed
// The scale is specified as the ratio between the current and default DPI // The scale is specified as the ratio between the current and default DPI
// //
void _glfwInputWindowContentScale(_GLFWwindow *window, float xscale, float yscale) void _glfwInputWindowContentScale(_GLFWwindow* window, float xscale, float yscale)
{ {
assert(window != NULL); assert(window != NULL);
assert(xscale > 0.f); assert(xscale > 0.f);
@ -139,34 +140,34 @@ void _glfwInputWindowContentScale(_GLFWwindow *window, float xscale, float yscal
assert(yscale < FLT_MAX); assert(yscale < FLT_MAX);
if (window->callbacks.scale) if (window->callbacks.scale)
window->callbacks.scale((GLFWwindow *)window, xscale, yscale); window->callbacks.scale((GLFWwindow*) window, xscale, yscale);
} }
// Notifies shared code that the window contents needs updating // Notifies shared code that the window contents needs updating
// //
void _glfwInputWindowDamage(_GLFWwindow *window) void _glfwInputWindowDamage(_GLFWwindow* window)
{ {
assert(window != NULL); assert(window != NULL);
if (window->callbacks.refresh) if (window->callbacks.refresh)
window->callbacks.refresh((GLFWwindow *)window); window->callbacks.refresh((GLFWwindow*) window);
} }
// Notifies shared code that the user wishes to close a window // Notifies shared code that the user wishes to close a window
// //
void _glfwInputWindowCloseRequest(_GLFWwindow *window) void _glfwInputWindowCloseRequest(_GLFWwindow* window)
{ {
assert(window != NULL); assert(window != NULL);
window->shouldClose = GLFW_TRUE; window->shouldClose = GLFW_TRUE;
if (window->callbacks.close) if (window->callbacks.close)
window->callbacks.close((GLFWwindow *)window); window->callbacks.close((GLFWwindow*) window);
} }
// Notifies shared code that a window has changed its desired monitor // Notifies shared code that a window has changed its desired monitor
// //
void _glfwInputWindowMonitor(_GLFWwindow *window, _GLFWmonitor *monitor) void _glfwInputWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor)
{ {
assert(window != NULL); assert(window != NULL);
window->monitor = monitor; window->monitor = monitor;
@ -176,15 +177,15 @@ void _glfwInputWindowMonitor(_GLFWwindow *window, _GLFWmonitor *monitor)
////// GLFW public API ////// ////// GLFW public API //////
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
GLFWAPI GLFWwindow *glfwCreateWindow(int width, int height, GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
const char *title, const char* title,
GLFWmonitor *monitor, GLFWmonitor* monitor,
GLFWwindow *share) GLFWwindow* share)
{ {
_GLFWfbconfig fbconfig; _GLFWfbconfig fbconfig;
_GLFWctxconfig ctxconfig; _GLFWctxconfig ctxconfig;
_GLFWwndconfig wndconfig; _GLFWwndconfig wndconfig;
_GLFWwindow *window; _GLFWwindow* window;
assert(title != NULL); assert(title != NULL);
assert(width >= 0); assert(width >= 0);
@ -201,14 +202,14 @@ GLFWAPI GLFWwindow *glfwCreateWindow(int width, int height,
return NULL; return NULL;
} }
fbconfig = _glfw.hints.framebuffer; fbconfig = _glfw.hints.framebuffer;
ctxconfig = _glfw.hints.context; ctxconfig = _glfw.hints.context;
wndconfig = _glfw.hints.window; wndconfig = _glfw.hints.window;
wndconfig.width = width; wndconfig.width = width;
wndconfig.height = height; wndconfig.height = height;
wndconfig.title = title; wndconfig.title = title;
ctxconfig.share = (_GLFWwindow *)share; ctxconfig.share = (_GLFWwindow*) share;
if (!_glfwIsValidContextConfig(&ctxconfig)) if (!_glfwIsValidContextConfig(&ctxconfig))
return NULL; return NULL;
@ -217,21 +218,21 @@ GLFWAPI GLFWwindow *glfwCreateWindow(int width, int height,
window->next = _glfw.windowListHead; window->next = _glfw.windowListHead;
_glfw.windowListHead = window; _glfw.windowListHead = window;
window->videoMode.width = width; window->videoMode.width = width;
window->videoMode.height = height; window->videoMode.height = height;
window->videoMode.redBits = fbconfig.redBits; window->videoMode.redBits = fbconfig.redBits;
window->videoMode.greenBits = fbconfig.greenBits; window->videoMode.greenBits = fbconfig.greenBits;
window->videoMode.blueBits = fbconfig.blueBits; window->videoMode.blueBits = fbconfig.blueBits;
window->videoMode.refreshRate = _glfw.hints.refreshRate; window->videoMode.refreshRate = _glfw.hints.refreshRate;
window->monitor = (_GLFWmonitor *)monitor; window->monitor = (_GLFWmonitor*) monitor;
window->resizable = wndconfig.resizable; window->resizable = wndconfig.resizable;
window->decorated = wndconfig.decorated; window->decorated = wndconfig.decorated;
window->autoIconify = wndconfig.autoIconify; window->autoIconify = wndconfig.autoIconify;
window->floating = wndconfig.floating; window->floating = wndconfig.floating;
window->focusOnShow = wndconfig.focusOnShow; window->focusOnShow = wndconfig.focusOnShow;
window->mousePassthrough = wndconfig.mousePassthrough; window->mousePassthrough = wndconfig.mousePassthrough;
window->cursorMode = GLFW_CURSOR_NORMAL; window->cursorMode = GLFW_CURSOR_NORMAL;
window->doublebuffer = fbconfig.doublebuffer; window->doublebuffer = fbconfig.doublebuffer;
@ -245,11 +246,11 @@ GLFWAPI GLFWwindow *glfwCreateWindow(int width, int height,
if (!_glfw.platform.createWindow(window, &wndconfig, &ctxconfig, &fbconfig)) if (!_glfw.platform.createWindow(window, &wndconfig, &ctxconfig, &fbconfig))
{ {
glfwDestroyWindow((GLFWwindow *)window); glfwDestroyWindow((GLFWwindow*) window);
return NULL; return NULL;
} }
return (GLFWwindow *)window; return (GLFWwindow*) window;
} }
void glfwDefaultWindowHints(void) void glfwDefaultWindowHints(void)
@ -260,16 +261,16 @@ void glfwDefaultWindowHints(void)
memset(&_glfw.hints.context, 0, sizeof(_glfw.hints.context)); memset(&_glfw.hints.context, 0, sizeof(_glfw.hints.context));
_glfw.hints.context.client = GLFW_OPENGL_API; _glfw.hints.context.client = GLFW_OPENGL_API;
_glfw.hints.context.source = GLFW_NATIVE_CONTEXT_API; _glfw.hints.context.source = GLFW_NATIVE_CONTEXT_API;
_glfw.hints.context.major = 1; _glfw.hints.context.major = 1;
_glfw.hints.context.minor = 0; _glfw.hints.context.minor = 0;
// The default is a focused, visible, resizable window with decorations // The default is a focused, visible, resizable window with decorations
memset(&_glfw.hints.window, 0, sizeof(_glfw.hints.window)); memset(&_glfw.hints.window, 0, sizeof(_glfw.hints.window));
_glfw.hints.window.resizable = GLFW_TRUE; _glfw.hints.window.resizable = GLFW_TRUE;
_glfw.hints.window.visible = GLFW_TRUE; _glfw.hints.window.visible = GLFW_TRUE;
_glfw.hints.window.decorated = GLFW_TRUE; _glfw.hints.window.decorated = GLFW_TRUE;
_glfw.hints.window.focused = GLFW_TRUE; _glfw.hints.window.focused = GLFW_TRUE;
_glfw.hints.window.autoIconify = GLFW_TRUE; _glfw.hints.window.autoIconify = GLFW_TRUE;
_glfw.hints.window.centerCursor = GLFW_TRUE; _glfw.hints.window.centerCursor = GLFW_TRUE;
_glfw.hints.window.focusOnShow = GLFW_TRUE; _glfw.hints.window.focusOnShow = GLFW_TRUE;
_glfw.hints.window.xpos = GLFW_ANY_POSITION; _glfw.hints.window.xpos = GLFW_ANY_POSITION;
@ -279,12 +280,12 @@ void glfwDefaultWindowHints(void)
// The default is 24 bits of color, 24 bits of depth and 8 bits of stencil, // The default is 24 bits of color, 24 bits of depth and 8 bits of stencil,
// double buffered // double buffered
memset(&_glfw.hints.framebuffer, 0, sizeof(_glfw.hints.framebuffer)); memset(&_glfw.hints.framebuffer, 0, sizeof(_glfw.hints.framebuffer));
_glfw.hints.framebuffer.redBits = 8; _glfw.hints.framebuffer.redBits = 8;
_glfw.hints.framebuffer.greenBits = 8; _glfw.hints.framebuffer.greenBits = 8;
_glfw.hints.framebuffer.blueBits = 8; _glfw.hints.framebuffer.blueBits = 8;
_glfw.hints.framebuffer.alphaBits = 8; _glfw.hints.framebuffer.alphaBits = 8;
_glfw.hints.framebuffer.depthBits = 24; _glfw.hints.framebuffer.depthBits = 24;
_glfw.hints.framebuffer.stencilBits = 8; _glfw.hints.framebuffer.stencilBits = 8;
_glfw.hints.framebuffer.doublebuffer = GLFW_TRUE; _glfw.hints.framebuffer.doublebuffer = GLFW_TRUE;
// The default is to select the highest available refresh rate // The default is to select the highest available refresh rate
@ -435,7 +436,7 @@ GLFWAPI void glfwWindowHint(int hint, int value)
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint 0x%08X", hint); _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint 0x%08X", hint);
} }
GLFWAPI void glfwWindowHintString(int hint, const char *value) GLFWAPI void glfwWindowHintString(int hint, const char* value)
{ {
assert(value != NULL); assert(value != NULL);
@ -443,28 +444,28 @@ GLFWAPI void glfwWindowHintString(int hint, const char *value)
switch (hint) switch (hint)
{ {
case GLFW_COCOA_FRAME_NAME: case GLFW_COCOA_FRAME_NAME:
strncpy(_glfw.hints.window.ns.frameName, value, strncpy(_glfw.hints.window.ns.frameName, value,
sizeof(_glfw.hints.window.ns.frameName) - 1); sizeof(_glfw.hints.window.ns.frameName) - 1);
return; return;
case GLFW_X11_CLASS_NAME: case GLFW_X11_CLASS_NAME:
strncpy(_glfw.hints.window.x11.className, value, strncpy(_glfw.hints.window.x11.className, value,
sizeof(_glfw.hints.window.x11.className) - 1); sizeof(_glfw.hints.window.x11.className) - 1);
return; return;
case GLFW_X11_INSTANCE_NAME: case GLFW_X11_INSTANCE_NAME:
strncpy(_glfw.hints.window.x11.instanceName, value, strncpy(_glfw.hints.window.x11.instanceName, value,
sizeof(_glfw.hints.window.x11.instanceName) - 1); sizeof(_glfw.hints.window.x11.instanceName) - 1);
return; return;
case GLFW_WAYLAND_APP_ID: case GLFW_WAYLAND_APP_ID:
strncpy(_glfw.hints.window.wl.appId, value, strncpy(_glfw.hints.window.wl.appId, value,
sizeof(_glfw.hints.window.wl.appId) - 1); sizeof(_glfw.hints.window.wl.appId) - 1);
return; return;
} }
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint); _glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint);
} }
GLFWAPI void glfwDestroyWindow(GLFWwindow *handle) GLFWAPI void glfwDestroyWindow(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -486,7 +487,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow *handle)
// Unlink window from global linked list // Unlink window from global linked list
{ {
_GLFWwindow **prev = &_glfw.windowListHead; _GLFWwindow** prev = &_glfw.windowListHead;
while (*prev != window) while (*prev != window)
prev = &((*prev)->next); prev = &((*prev)->next);
@ -498,7 +499,7 @@ GLFWAPI void glfwDestroyWindow(GLFWwindow *handle)
_glfw_free(window); _glfw_free(window);
} }
GLFWAPI int glfwWindowShouldClose(GLFWwindow *handle) GLFWAPI int glfwWindowShouldClose(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(0); _GLFW_REQUIRE_INIT_OR_RETURN(0);
@ -508,7 +509,7 @@ GLFWAPI int glfwWindowShouldClose(GLFWwindow *handle)
return window->shouldClose; return window->shouldClose;
} }
GLFWAPI void glfwSetWindowShouldClose(GLFWwindow *handle, int value) GLFWAPI void glfwSetWindowShouldClose(GLFWwindow* handle, int value)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -544,8 +545,8 @@ GLFWAPI void glfwSetWindowTitle(GLFWwindow* handle, const char* title)
_glfw_free(prev); _glfw_free(prev);
} }
GLFWAPI void glfwSetWindowIcon(GLFWwindow *handle, GLFWAPI void glfwSetWindowIcon(GLFWwindow* handle,
int count, const GLFWimage *images) int count, const GLFWimage* images)
{ {
int i; int i;
@ -578,7 +579,7 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow *handle,
_glfw.platform.setWindowIcon(window, count, images); _glfw.platform.setWindowIcon(window, count, images);
} }
GLFWAPI void glfwGetWindowPos(GLFWwindow *handle, int *xpos, int *ypos) GLFWAPI void glfwGetWindowPos(GLFWwindow* handle, int* xpos, int* ypos)
{ {
if (xpos) if (xpos)
*xpos = 0; *xpos = 0;
@ -593,7 +594,7 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow *handle, int *xpos, int *ypos)
_glfw.platform.getWindowPos(window, xpos, ypos); _glfw.platform.getWindowPos(window, xpos, ypos);
} }
GLFWAPI void glfwSetWindowPos(GLFWwindow *handle, int xpos, int ypos) GLFWAPI void glfwSetWindowPos(GLFWwindow* handle, int xpos, int ypos)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -606,7 +607,7 @@ GLFWAPI void glfwSetWindowPos(GLFWwindow *handle, int xpos, int ypos)
_glfw.platform.setWindowPos(window, xpos, ypos); _glfw.platform.setWindowPos(window, xpos, ypos);
} }
GLFWAPI void glfwGetWindowSize(GLFWwindow *handle, int *width, int *height) GLFWAPI void glfwGetWindowSize(GLFWwindow* handle, int* width, int* height)
{ {
if (width) if (width)
*width = 0; *width = 0;
@ -621,7 +622,7 @@ GLFWAPI void glfwGetWindowSize(GLFWwindow *handle, int *width, int *height)
_glfw.platform.getWindowSize(window, width, height); _glfw.platform.getWindowSize(window, width, height);
} }
GLFWAPI void glfwSetWindowSize(GLFWwindow *handle, int width, int height) GLFWAPI void glfwSetWindowSize(GLFWwindow* handle, int width, int height)
{ {
assert(width >= 0); assert(width >= 0);
assert(height >= 0); assert(height >= 0);
@ -637,7 +638,7 @@ GLFWAPI void glfwSetWindowSize(GLFWwindow *handle, int width, int height)
_glfw.platform.setWindowSize(window, width, height); _glfw.platform.setWindowSize(window, width, height);
} }
GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow *handle, GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow* handle,
int minwidth, int minheight, int minwidth, int minheight,
int maxwidth, int maxheight) int maxwidth, int maxheight)
{ {
@ -669,9 +670,9 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow *handle,
} }
} }
window->minwidth = minwidth; window->minwidth = minwidth;
window->minheight = minheight; window->minheight = minheight;
window->maxwidth = maxwidth; window->maxwidth = maxwidth;
window->maxheight = maxheight; window->maxheight = maxheight;
if (window->monitor || !window->resizable) if (window->monitor || !window->resizable)
@ -682,7 +683,7 @@ GLFWAPI void glfwSetWindowSizeLimits(GLFWwindow *handle,
maxwidth, maxheight); maxwidth, maxheight);
} }
GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow *handle, int numer, int denom) GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow* handle, int numer, int denom)
{ {
assert(numer != 0); assert(numer != 0);
assert(denom != 0); assert(denom != 0);
@ -712,7 +713,7 @@ GLFWAPI void glfwSetWindowAspectRatio(GLFWwindow *handle, int numer, int denom)
_glfw.platform.setWindowAspectRatio(window, numer, denom); _glfw.platform.setWindowAspectRatio(window, numer, denom);
} }
GLFWAPI void glfwGetFramebufferSize(GLFWwindow *handle, int *width, int *height) GLFWAPI void glfwGetFramebufferSize(GLFWwindow* handle, int* width, int* height)
{ {
if (width) if (width)
*width = 0; *width = 0;
@ -727,9 +728,9 @@ GLFWAPI void glfwGetFramebufferSize(GLFWwindow *handle, int *width, int *height)
_glfw.platform.getFramebufferSize(window, width, height); _glfw.platform.getFramebufferSize(window, width, height);
} }
GLFWAPI void glfwGetWindowFrameSize(GLFWwindow *handle, GLFWAPI void glfwGetWindowFrameSize(GLFWwindow* handle,
int *left, int *top, int* left, int* top,
int *right, int *bottom) int* right, int* bottom)
{ {
if (left) if (left)
*left = 0; *left = 0;
@ -748,8 +749,8 @@ GLFWAPI void glfwGetWindowFrameSize(GLFWwindow *handle,
_glfw.platform.getWindowFrameSize(window, left, top, right, bottom); _glfw.platform.getWindowFrameSize(window, left, top, right, bottom);
} }
GLFWAPI void glfwGetWindowContentScale(GLFWwindow *handle, GLFWAPI void glfwGetWindowContentScale(GLFWwindow* handle,
float *xscale, float *yscale) float* xscale, float* yscale)
{ {
if (xscale) if (xscale)
*xscale = 0.f; *xscale = 0.f;
@ -764,7 +765,7 @@ GLFWAPI void glfwGetWindowContentScale(GLFWwindow *handle,
_glfw.platform.getWindowContentScale(window, xscale, yscale); _glfw.platform.getWindowContentScale(window, xscale, yscale);
} }
GLFWAPI float glfwGetWindowOpacity(GLFWwindow *handle) GLFWAPI float glfwGetWindowOpacity(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(0.f); _GLFW_REQUIRE_INIT_OR_RETURN(0.f);
@ -774,7 +775,7 @@ GLFWAPI float glfwGetWindowOpacity(GLFWwindow *handle)
return _glfw.platform.getWindowOpacity(window); return _glfw.platform.getWindowOpacity(window);
} }
GLFWAPI void glfwSetWindowOpacity(GLFWwindow *handle, float opacity) GLFWAPI void glfwSetWindowOpacity(GLFWwindow* handle, float opacity)
{ {
assert(opacity == opacity); assert(opacity == opacity);
assert(opacity >= 0.f); assert(opacity >= 0.f);
@ -794,7 +795,7 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow *handle, float opacity)
_glfw.platform.setWindowOpacity(window, opacity); _glfw.platform.setWindowOpacity(window, opacity);
} }
GLFWAPI void glfwIconifyWindow(GLFWwindow *handle) GLFWAPI void glfwIconifyWindow(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -804,7 +805,7 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow *handle)
_glfw.platform.iconifyWindow(window); _glfw.platform.iconifyWindow(window);
} }
GLFWAPI void glfwRestoreWindow(GLFWwindow *handle) GLFWAPI void glfwRestoreWindow(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -814,7 +815,7 @@ GLFWAPI void glfwRestoreWindow(GLFWwindow *handle)
_glfw.platform.restoreWindow(window); _glfw.platform.restoreWindow(window);
} }
GLFWAPI void glfwMaximizeWindow(GLFWwindow *handle) GLFWAPI void glfwMaximizeWindow(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -827,7 +828,7 @@ GLFWAPI void glfwMaximizeWindow(GLFWwindow *handle)
_glfw.platform.maximizeWindow(window); _glfw.platform.maximizeWindow(window);
} }
GLFWAPI void glfwShowWindow(GLFWwindow *handle) GLFWAPI void glfwShowWindow(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -843,7 +844,7 @@ GLFWAPI void glfwShowWindow(GLFWwindow *handle)
_glfw.platform.focusWindow(window); _glfw.platform.focusWindow(window);
} }
GLFWAPI void glfwRequestWindowAttention(GLFWwindow *handle) GLFWAPI void glfwRequestWindowAttention(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -853,7 +854,7 @@ GLFWAPI void glfwRequestWindowAttention(GLFWwindow *handle)
_glfw.platform.requestWindowAttention(window); _glfw.platform.requestWindowAttention(window);
} }
GLFWAPI void glfwHideWindow(GLFWwindow *handle) GLFWAPI void glfwHideWindow(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -866,7 +867,7 @@ GLFWAPI void glfwHideWindow(GLFWwindow *handle)
_glfw.platform.hideWindow(window); _glfw.platform.hideWindow(window);
} }
GLFWAPI void glfwFocusWindow(GLFWwindow *handle) GLFWAPI void glfwFocusWindow(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -876,7 +877,7 @@ GLFWAPI void glfwFocusWindow(GLFWwindow *handle)
_glfw.platform.focusWindow(window); _glfw.platform.focusWindow(window);
} }
GLFWAPI int glfwGetWindowAttrib(GLFWwindow *handle, int attrib) GLFWAPI int glfwGetWindowAttrib(GLFWwindow* handle, int attrib)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(0); _GLFW_REQUIRE_INIT_OR_RETURN(0);
@ -885,61 +886,61 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow *handle, int attrib)
switch (attrib) switch (attrib)
{ {
case GLFW_FOCUSED: case GLFW_FOCUSED:
return _glfw.platform.windowFocused(window); return _glfw.platform.windowFocused(window);
case GLFW_ICONIFIED: case GLFW_ICONIFIED:
return _glfw.platform.windowIconified(window); return _glfw.platform.windowIconified(window);
case GLFW_VISIBLE: case GLFW_VISIBLE:
return _glfw.platform.windowVisible(window); return _glfw.platform.windowVisible(window);
case GLFW_MAXIMIZED: case GLFW_MAXIMIZED:
return _glfw.platform.windowMaximized(window); return _glfw.platform.windowMaximized(window);
case GLFW_HOVERED: case GLFW_HOVERED:
return _glfw.platform.windowHovered(window); return _glfw.platform.windowHovered(window);
case GLFW_FOCUS_ON_SHOW: case GLFW_FOCUS_ON_SHOW:
return window->focusOnShow; return window->focusOnShow;
case GLFW_MOUSE_PASSTHROUGH: case GLFW_MOUSE_PASSTHROUGH:
return window->mousePassthrough; return window->mousePassthrough;
case GLFW_TRANSPARENT_FRAMEBUFFER: case GLFW_TRANSPARENT_FRAMEBUFFER:
return _glfw.platform.framebufferTransparent(window); return _glfw.platform.framebufferTransparent(window);
case GLFW_RESIZABLE: case GLFW_RESIZABLE:
return window->resizable; return window->resizable;
case GLFW_DECORATED: case GLFW_DECORATED:
return window->decorated; return window->decorated;
case GLFW_FLOATING: case GLFW_FLOATING:
return window->floating; return window->floating;
case GLFW_AUTO_ICONIFY: case GLFW_AUTO_ICONIFY:
return window->autoIconify; return window->autoIconify;
case GLFW_DOUBLEBUFFER: case GLFW_DOUBLEBUFFER:
return window->doublebuffer; return window->doublebuffer;
case GLFW_CLIENT_API: case GLFW_CLIENT_API:
return window->context.client; return window->context.client;
case GLFW_CONTEXT_CREATION_API: case GLFW_CONTEXT_CREATION_API:
return window->context.source; return window->context.source;
case GLFW_CONTEXT_VERSION_MAJOR: case GLFW_CONTEXT_VERSION_MAJOR:
return window->context.major; return window->context.major;
case GLFW_CONTEXT_VERSION_MINOR: case GLFW_CONTEXT_VERSION_MINOR:
return window->context.minor; return window->context.minor;
case GLFW_CONTEXT_REVISION: case GLFW_CONTEXT_REVISION:
return window->context.revision; return window->context.revision;
case GLFW_CONTEXT_ROBUSTNESS: case GLFW_CONTEXT_ROBUSTNESS:
return window->context.robustness; return window->context.robustness;
case GLFW_OPENGL_FORWARD_COMPAT: case GLFW_OPENGL_FORWARD_COMPAT:
return window->context.forward; return window->context.forward;
case GLFW_CONTEXT_DEBUG: case GLFW_CONTEXT_DEBUG:
return window->context.debug; return window->context.debug;
case GLFW_OPENGL_PROFILE: case GLFW_OPENGL_PROFILE:
return window->context.profile; return window->context.profile;
case GLFW_CONTEXT_RELEASE_BEHAVIOR: case GLFW_CONTEXT_RELEASE_BEHAVIOR:
return window->context.release; return window->context.release;
case GLFW_CONTEXT_NO_ERROR: case GLFW_CONTEXT_NO_ERROR:
return window->context.noerror; return window->context.noerror;
} }
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib); _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
return 0; return 0;
} }
GLFWAPI void glfwSetWindowAttrib(GLFWwindow *handle, int attrib, int value) GLFWAPI void glfwSetWindowAttrib(GLFWwindow* handle, int attrib, int value)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -950,42 +951,42 @@ GLFWAPI void glfwSetWindowAttrib(GLFWwindow *handle, int attrib, int value)
switch (attrib) switch (attrib)
{ {
case GLFW_AUTO_ICONIFY: case GLFW_AUTO_ICONIFY:
window->autoIconify = value; window->autoIconify = value;
return; return;
case GLFW_RESIZABLE: case GLFW_RESIZABLE:
window->resizable = value; window->resizable = value;
if (!window->monitor) if (!window->monitor)
_glfw.platform.setWindowResizable(window, value); _glfw.platform.setWindowResizable(window, value);
return; return;
case GLFW_DECORATED: case GLFW_DECORATED:
window->decorated = value; window->decorated = value;
if (!window->monitor) if (!window->monitor)
_glfw.platform.setWindowDecorated(window, value); _glfw.platform.setWindowDecorated(window, value);
return; return;
case GLFW_FLOATING: case GLFW_FLOATING:
window->floating = value; window->floating = value;
if (!window->monitor) if (!window->monitor)
_glfw.platform.setWindowFloating(window, value); _glfw.platform.setWindowFloating(window, value);
return; return;
case GLFW_FOCUS_ON_SHOW: case GLFW_FOCUS_ON_SHOW:
window->focusOnShow = value; window->focusOnShow = value;
return; return;
case GLFW_MOUSE_PASSTHROUGH: case GLFW_MOUSE_PASSTHROUGH:
window->mousePassthrough = value; window->mousePassthrough = value;
_glfw.platform.setWindowMousePassthrough(window, value); _glfw.platform.setWindowMousePassthrough(window, value);
return; return;
} }
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib); _glfwInputError(GLFW_INVALID_ENUM, "Invalid window attribute 0x%08X", attrib);
} }
GLFWAPI GLFWmonitor *glfwGetWindowMonitor(GLFWwindow *handle) GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -995,8 +996,8 @@ GLFWAPI GLFWmonitor *glfwGetWindowMonitor(GLFWwindow *handle)
return (GLFWmonitor*) window->monitor; return (GLFWmonitor*) window->monitor;
} }
GLFWAPI void glfwSetWindowMonitor(GLFWwindow *wh, GLFWAPI void glfwSetWindowMonitor(GLFWwindow* wh,
GLFWmonitor *mh, GLFWmonitor* mh,
int xpos, int ypos, int xpos, int ypos,
int width, int height, int width, int height,
int refreshRate) int refreshRate)
@ -1026,8 +1027,8 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow *wh,
return; return;
} }
window->videoMode.width = width; window->videoMode.width = width;
window->videoMode.height = height; window->videoMode.height = height;
window->videoMode.refreshRate = refreshRate; window->videoMode.refreshRate = refreshRate;
_glfw.platform.setWindowMonitor(window, monitor, _glfw.platform.setWindowMonitor(window, monitor,
@ -1035,7 +1036,7 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow *wh,
refreshRate); refreshRate);
} }
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow *handle, void *pointer) GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
@ -1045,7 +1046,7 @@ GLFWAPI void glfwSetWindowUserPointer(GLFWwindow *handle, void *pointer)
window->userPointer = pointer; window->userPointer = pointer;
} }
GLFWAPI void *glfwGetWindowUserPointer(GLFWwindow *handle) GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* handle)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1055,7 +1056,7 @@ GLFWAPI void *glfwGetWindowUserPointer(GLFWwindow *handle)
return window->userPointer; return window->userPointer;
} }
GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow *handle, GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow* handle,
GLFWwindowposfun cbfun) GLFWwindowposfun cbfun)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1067,7 +1068,7 @@ GLFWAPI GLFWwindowposfun glfwSetWindowPosCallback(GLFWwindow *handle,
return cbfun; return cbfun;
} }
GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow *handle, GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* handle,
GLFWwindowsizefun cbfun) GLFWwindowsizefun cbfun)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1079,7 +1080,7 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow *handle,
return cbfun; return cbfun;
} }
GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow *handle, GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* handle,
GLFWwindowclosefun cbfun) GLFWwindowclosefun cbfun)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1091,7 +1092,7 @@ GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow *handle,
return cbfun; return cbfun;
} }
GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow *handle, GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow* handle,
GLFWwindowrefreshfun cbfun) GLFWwindowrefreshfun cbfun)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1103,7 +1104,7 @@ GLFWAPI GLFWwindowrefreshfun glfwSetWindowRefreshCallback(GLFWwindow *handle,
return cbfun; return cbfun;
} }
GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow *handle, GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* handle,
GLFWwindowfocusfun cbfun) GLFWwindowfocusfun cbfun)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1115,7 +1116,7 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow *handle,
return cbfun; return cbfun;
} }
GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow *handle, GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow* handle,
GLFWwindowiconifyfun cbfun) GLFWwindowiconifyfun cbfun)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1127,7 +1128,7 @@ GLFWAPI GLFWwindowiconifyfun glfwSetWindowIconifyCallback(GLFWwindow *handle,
return cbfun; return cbfun;
} }
GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow *handle, GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow* handle,
GLFWwindowmaximizefun cbfun) GLFWwindowmaximizefun cbfun)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1139,7 +1140,7 @@ GLFWAPI GLFWwindowmaximizefun glfwSetWindowMaximizeCallback(GLFWwindow *handle,
return cbfun; return cbfun;
} }
GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow *handle, GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow* handle,
GLFWframebuffersizefun cbfun) GLFWframebuffersizefun cbfun)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1151,7 +1152,7 @@ GLFWAPI GLFWframebuffersizefun glfwSetFramebufferSizeCallback(GLFWwindow *handle
return cbfun; return cbfun;
} }
GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow *handle, GLFWAPI GLFWwindowcontentscalefun glfwSetWindowContentScaleCallback(GLFWwindow* handle,
GLFWwindowcontentscalefun cbfun) GLFWwindowcontentscalefun cbfun)
{ {
_GLFW_REQUIRE_INIT_OR_RETURN(NULL); _GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -1198,3 +1199,4 @@ GLFWAPI void glfwPostEmptyEvent(void)
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();
_glfw.platform.postEmptyEvent(); _glfw.platform.postEmptyEvent();
} }

File diff suppressed because it is too large Load Diff