mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 05:36:35 +00:00
Compile platform-specific hints conditionally
This prevents them from being compiled on unrelated platforms.
This commit is contained in:
parent
34d20b0f03
commit
378e84a133
@ -51,10 +51,12 @@ static GLFWerrorfun _glfwErrorCallback;
|
||||
static _GLFWinitconfig _glfwInitHints =
|
||||
{
|
||||
GLFW_TRUE, // hat buttons
|
||||
#if defined(_GLFW_COCOA)
|
||||
{
|
||||
GLFW_TRUE, // macOS menu bar
|
||||
GLFW_TRUE // macOS bundle chdir
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
// Returns a generic string representation of the specified error
|
||||
@ -263,12 +265,14 @@ GLFWAPI void glfwInitHint(int hint, int value)
|
||||
case GLFW_JOYSTICK_HAT_BUTTONS:
|
||||
_glfwInitHints.hatButtons = value;
|
||||
return;
|
||||
#if defined(_GLFW_COCOA)
|
||||
case GLFW_COCOA_CHDIR_RESOURCES:
|
||||
_glfwInitHints.ns.chdir = value;
|
||||
return;
|
||||
case GLFW_COCOA_MENUBAR:
|
||||
_glfwInitHints.ns.menubar = value;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
_glfwInputError(GLFW_INVALID_ENUM,
|
||||
|
@ -242,10 +242,12 @@ struct _GLFWerror
|
||||
struct _GLFWinitconfig
|
||||
{
|
||||
GLFWbool hatButtons;
|
||||
#if defined(_GLFW_COCOA)
|
||||
struct {
|
||||
GLFWbool menubar;
|
||||
GLFWbool chdir;
|
||||
} ns;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Window configuration
|
||||
@ -267,14 +269,18 @@ struct _GLFWwndconfig
|
||||
GLFWbool floating;
|
||||
GLFWbool maximized;
|
||||
GLFWbool centerCursor;
|
||||
#if defined(_GLFW_COCOA)
|
||||
struct {
|
||||
GLFWbool retina;
|
||||
char frameName[256];
|
||||
} ns;
|
||||
#endif
|
||||
#if defined(_GLFW_X11)
|
||||
struct {
|
||||
char className[256];
|
||||
char instanceName[256];
|
||||
} x11;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Context configuration
|
||||
@ -296,9 +302,11 @@ struct _GLFWctxconfig
|
||||
int robustness;
|
||||
int release;
|
||||
_GLFWwindow* share;
|
||||
#if defined(_GLFW_COCOA)
|
||||
struct {
|
||||
GLFWbool offline;
|
||||
} nsgl;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Framebuffer configuration
|
||||
|
@ -282,8 +282,10 @@ void glfwDefaultWindowHints(void)
|
||||
// The default is to select the highest available refresh rate
|
||||
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
||||
|
||||
#if defined(_GLFW_COCOA)
|
||||
// The default is to use full Retina resolution framebuffers
|
||||
_glfw.hints.window.ns.retina = GLFW_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
GLFWAPI void glfwWindowHint(int hint, int value)
|
||||
@ -361,12 +363,14 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
||||
case GLFW_VISIBLE:
|
||||
_glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
#if defined(_GLFW_COCOA)
|
||||
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
||||
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
||||
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
#endif
|
||||
case GLFW_CENTER_CURSOR:
|
||||
_glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE;
|
||||
return;
|
||||
@ -416,10 +420,13 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value)
|
||||
|
||||
switch (hint)
|
||||
{
|
||||
#if defined(_GLFW_COCOA)
|
||||
case GLFW_COCOA_FRAME_NAME:
|
||||
strncpy(_glfw.hints.window.ns.frameName, value,
|
||||
sizeof(_glfw.hints.window.ns.frameName) - 1);
|
||||
return;
|
||||
#endif
|
||||
#if defined(_GLFW_X11)
|
||||
case GLFW_X11_CLASS_NAME:
|
||||
strncpy(_glfw.hints.window.x11.className, value,
|
||||
sizeof(_glfw.hints.window.x11.className) - 1);
|
||||
@ -428,6 +435,7 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value)
|
||||
strncpy(_glfw.hints.window.x11.instanceName, value,
|
||||
sizeof(_glfw.hints.window.x11.instanceName) - 1);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint);
|
||||
|
Loading…
Reference in New Issue
Block a user