Cleanup.
This commit is contained in:
parent
baf3feb86d
commit
478347004d
19
src/window.c
19
src/window.c
@ -221,8 +221,11 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to copy these values before doing anything that can fail, as the
|
if (width <= 0 || height <= 0)
|
||||||
// window hints should be cleared after each call even if it fails
|
{
|
||||||
|
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window size");
|
||||||
|
return GL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// Set up desired framebuffer config
|
// Set up desired framebuffer config
|
||||||
fbconfig.redBits = Max(_glfw.hints.redBits, 0);
|
fbconfig.redBits = Max(_glfw.hints.redBits, 0);
|
||||||
@ -260,15 +263,6 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
if (!_glfwIsValidContextConfig(&wndconfig))
|
if (!_glfwIsValidContextConfig(&wndconfig))
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
// Save the currently current context so it can be restored later
|
|
||||||
previous = glfwGetCurrentContext();
|
|
||||||
|
|
||||||
if (width <= 0 || height <= 0)
|
|
||||||
{
|
|
||||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window size");
|
|
||||||
return GL_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow));
|
window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow));
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
@ -295,6 +289,9 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
window->videoMode.blueBits = fbconfig.blueBits;
|
window->videoMode.blueBits = fbconfig.blueBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save the currently current context so it can be restored later
|
||||||
|
previous = glfwGetCurrentContext();
|
||||||
|
|
||||||
// Open the actual window and create its context
|
// Open the actual window and create its context
|
||||||
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
|
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
|
||||||
{
|
{
|
||||||
|
@ -124,7 +124,9 @@ typedef struct _GLFWlibraryX11
|
|||||||
Display* display;
|
Display* display;
|
||||||
int screen;
|
int screen;
|
||||||
Window root;
|
Window root;
|
||||||
Cursor cursor; // Invisible cursor for hidden cursor
|
|
||||||
|
// Invisible cursor for hidden cursor mode
|
||||||
|
Cursor cursor;
|
||||||
|
|
||||||
Atom wmDeleteWindow; // WM_DELETE_WINDOW atom
|
Atom wmDeleteWindow; // WM_DELETE_WINDOW atom
|
||||||
Atom wmName; // _NET_WM_NAME atom
|
Atom wmName; // _NET_WM_NAME atom
|
||||||
@ -161,10 +163,9 @@ typedef struct _GLFWlibraryX11
|
|||||||
int versionMinor;
|
int versionMinor;
|
||||||
} xkb;
|
} xkb;
|
||||||
|
|
||||||
// Key code LUT (mapping X11 key codes to GLFW key codes)
|
// LUT for mapping X11 key codes to GLFW key codes
|
||||||
int keyCodeLUT[256];
|
int keyCodeLUT[256];
|
||||||
|
|
||||||
// Screensaver data
|
|
||||||
struct {
|
struct {
|
||||||
GLboolean changed;
|
GLboolean changed;
|
||||||
int timeout;
|
int timeout;
|
||||||
@ -173,14 +174,12 @@ typedef struct _GLFWlibraryX11
|
|||||||
int exposure;
|
int exposure;
|
||||||
} saver;
|
} saver;
|
||||||
|
|
||||||
// Timer data
|
|
||||||
struct {
|
struct {
|
||||||
GLboolean monotonic;
|
GLboolean monotonic;
|
||||||
double resolution;
|
double resolution;
|
||||||
uint64_t base;
|
uint64_t base;
|
||||||
} timer;
|
} timer;
|
||||||
|
|
||||||
// Selection data
|
|
||||||
struct {
|
struct {
|
||||||
Atom atom;
|
Atom atom;
|
||||||
Atom formats[_GLFW_CLIPBOARD_FORMAT_COUNT];
|
Atom formats[_GLFW_CLIPBOARD_FORMAT_COUNT];
|
||||||
|
Loading…
Reference in New Issue
Block a user