Add glfwInitHintString

Adds string type init hints.  Adds X11 specific init hints for WM_CLASS
components.  Documentation work.

Fixes #893.
This commit is contained in:
Camilla Löwy
2017-07-25 01:55:08 +02:00
parent 00d2efb9ab
commit 213dd2d0d6
7 changed files with 139 additions and 34 deletions
+30 -4
View File
@@ -32,6 +32,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
// The global variables below comprise all global data in GLFW.
@@ -48,10 +49,14 @@ static _GLFWerror _glfwMainThreadError;
static GLFWerrorfun _glfwErrorCallback;
static _GLFWinitconfig _glfwInitHints =
{
GLFW_TRUE, // hat buttons
GLFW_TRUE, // hat buttons
{
GLFW_TRUE, // menubar
GLFW_TRUE // chdir
GLFW_TRUE, // macOS menu bar
GLFW_TRUE // macOS bundle chdir
},
{
"", // X11 WM_CLASS name
"" // X11 WM_CLASS class
}
};
@@ -243,7 +248,28 @@ GLFWAPI void glfwInitHint(int hint, int value)
return;
}
_glfwInputError(GLFW_INVALID_ENUM, "Invalid init hint 0x%08X", hint);
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid integer type init hint 0x%08X", hint);
}
GLFWAPI void glfwInitHintString(int hint, const char* value)
{
assert(value != NULL);
switch (hint)
{
case GLFW_X11_WM_CLASS_NAME:
strncpy(_glfwInitHints.x11.className, value,
sizeof(_glfwInitHints.x11.className) - 1);
break;
case GLFW_X11_WM_CLASS_CLASS:
strncpy(_glfwInitHints.x11.classClass, value,
sizeof(_glfwInitHints.x11.classClass) - 1);
break;
}
_glfwInputError(GLFW_INVALID_ENUM,
"Invalid string type init hint 0x%08X", hint);
}
GLFWAPI void glfwGetVersion(int* major, int* minor, int* rev)