mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 13:46:37 +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 =
|
static _GLFWinitconfig _glfwInitHints =
|
||||||
{
|
{
|
||||||
GLFW_TRUE, // hat buttons
|
GLFW_TRUE, // hat buttons
|
||||||
|
#if defined(_GLFW_COCOA)
|
||||||
{
|
{
|
||||||
GLFW_TRUE, // macOS menu bar
|
GLFW_TRUE, // macOS menu bar
|
||||||
GLFW_TRUE // macOS bundle chdir
|
GLFW_TRUE // macOS bundle chdir
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Returns a generic string representation of the specified error
|
// 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:
|
case GLFW_JOYSTICK_HAT_BUTTONS:
|
||||||
_glfwInitHints.hatButtons = value;
|
_glfwInitHints.hatButtons = value;
|
||||||
return;
|
return;
|
||||||
|
#if defined(_GLFW_COCOA)
|
||||||
case GLFW_COCOA_CHDIR_RESOURCES:
|
case GLFW_COCOA_CHDIR_RESOURCES:
|
||||||
_glfwInitHints.ns.chdir = value;
|
_glfwInitHints.ns.chdir = value;
|
||||||
return;
|
return;
|
||||||
case GLFW_COCOA_MENUBAR:
|
case GLFW_COCOA_MENUBAR:
|
||||||
_glfwInitHints.ns.menubar = value;
|
_glfwInitHints.ns.menubar = value;
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM,
|
_glfwInputError(GLFW_INVALID_ENUM,
|
||||||
|
@ -242,10 +242,12 @@ struct _GLFWerror
|
|||||||
struct _GLFWinitconfig
|
struct _GLFWinitconfig
|
||||||
{
|
{
|
||||||
GLFWbool hatButtons;
|
GLFWbool hatButtons;
|
||||||
|
#if defined(_GLFW_COCOA)
|
||||||
struct {
|
struct {
|
||||||
GLFWbool menubar;
|
GLFWbool menubar;
|
||||||
GLFWbool chdir;
|
GLFWbool chdir;
|
||||||
} ns;
|
} ns;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Window configuration
|
// Window configuration
|
||||||
@ -267,14 +269,18 @@ struct _GLFWwndconfig
|
|||||||
GLFWbool floating;
|
GLFWbool floating;
|
||||||
GLFWbool maximized;
|
GLFWbool maximized;
|
||||||
GLFWbool centerCursor;
|
GLFWbool centerCursor;
|
||||||
|
#if defined(_GLFW_COCOA)
|
||||||
struct {
|
struct {
|
||||||
GLFWbool retina;
|
GLFWbool retina;
|
||||||
char frameName[256];
|
char frameName[256];
|
||||||
} ns;
|
} ns;
|
||||||
|
#endif
|
||||||
|
#if defined(_GLFW_X11)
|
||||||
struct {
|
struct {
|
||||||
char className[256];
|
char className[256];
|
||||||
char instanceName[256];
|
char instanceName[256];
|
||||||
} x11;
|
} x11;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Context configuration
|
// Context configuration
|
||||||
@ -296,9 +302,11 @@ struct _GLFWctxconfig
|
|||||||
int robustness;
|
int robustness;
|
||||||
int release;
|
int release;
|
||||||
_GLFWwindow* share;
|
_GLFWwindow* share;
|
||||||
|
#if defined(_GLFW_COCOA)
|
||||||
struct {
|
struct {
|
||||||
GLFWbool offline;
|
GLFWbool offline;
|
||||||
} nsgl;
|
} nsgl;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Framebuffer configuration
|
// Framebuffer configuration
|
||||||
|
@ -282,8 +282,10 @@ void glfwDefaultWindowHints(void)
|
|||||||
// The default is to select the highest available refresh rate
|
// The default is to select the highest available refresh rate
|
||||||
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
_glfw.hints.refreshRate = GLFW_DONT_CARE;
|
||||||
|
|
||||||
|
#if defined(_GLFW_COCOA)
|
||||||
// The default is to use full Retina resolution framebuffers
|
// The default is to use full Retina resolution framebuffers
|
||||||
_glfw.hints.window.ns.retina = GLFW_TRUE;
|
_glfw.hints.window.ns.retina = GLFW_TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI void glfwWindowHint(int hint, int value)
|
GLFWAPI void glfwWindowHint(int hint, int value)
|
||||||
@ -361,12 +363,14 @@ GLFWAPI void glfwWindowHint(int hint, int value)
|
|||||||
case GLFW_VISIBLE:
|
case GLFW_VISIBLE:
|
||||||
_glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.window.visible = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
return;
|
return;
|
||||||
|
#if defined(_GLFW_COCOA)
|
||||||
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
case GLFW_COCOA_RETINA_FRAMEBUFFER:
|
||||||
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.window.ns.retina = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
return;
|
return;
|
||||||
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
case GLFW_COCOA_GRAPHICS_SWITCHING:
|
||||||
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.context.nsgl.offline = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
case GLFW_CENTER_CURSOR:
|
case GLFW_CENTER_CURSOR:
|
||||||
_glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE;
|
_glfw.hints.window.centerCursor = value ? GLFW_TRUE : GLFW_FALSE;
|
||||||
return;
|
return;
|
||||||
@ -416,10 +420,13 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value)
|
|||||||
|
|
||||||
switch (hint)
|
switch (hint)
|
||||||
{
|
{
|
||||||
|
#if defined(_GLFW_COCOA)
|
||||||
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;
|
||||||
|
#endif
|
||||||
|
#if defined(_GLFW_X11)
|
||||||
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);
|
||||||
@ -428,6 +435,7 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value)
|
|||||||
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;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint);
|
_glfwInputError(GLFW_INVALID_ENUM, "Invalid window hint string 0x%08X", hint);
|
||||||
|
Loading…
Reference in New Issue
Block a user