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;
|
||||
}
|
||||
|
||||
// We need to copy these values before doing anything that can fail, as the
|
||||
// window hints should be cleared after each call even if it fails
|
||||
if (width <= 0 || height <= 0)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid window size");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
// Set up desired framebuffer config
|
||||
fbconfig.redBits = Max(_glfw.hints.redBits, 0);
|
||||
@ -260,15 +263,6 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
||||
if (!_glfwIsValidContextConfig(&wndconfig))
|
||||
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));
|
||||
if (!window)
|
||||
{
|
||||
@ -295,6 +289,9 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
||||
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
|
||||
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
|
||||
{
|
||||
|
@ -124,7 +124,9 @@ typedef struct _GLFWlibraryX11
|
||||
Display* display;
|
||||
int screen;
|
||||
Window root;
|
||||
Cursor cursor; // Invisible cursor for hidden cursor
|
||||
|
||||
// Invisible cursor for hidden cursor mode
|
||||
Cursor cursor;
|
||||
|
||||
Atom wmDeleteWindow; // WM_DELETE_WINDOW atom
|
||||
Atom wmName; // _NET_WM_NAME atom
|
||||
@ -161,10 +163,9 @@ typedef struct _GLFWlibraryX11
|
||||
int versionMinor;
|
||||
} 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];
|
||||
|
||||
// Screensaver data
|
||||
struct {
|
||||
GLboolean changed;
|
||||
int timeout;
|
||||
@ -173,14 +174,12 @@ typedef struct _GLFWlibraryX11
|
||||
int exposure;
|
||||
} saver;
|
||||
|
||||
// Timer data
|
||||
struct {
|
||||
GLboolean monotonic;
|
||||
double resolution;
|
||||
uint64_t base;
|
||||
} timer;
|
||||
|
||||
// Selection data
|
||||
struct {
|
||||
Atom atom;
|
||||
Atom formats[_GLFW_CLIPBOARD_FORMAT_COUNT];
|
||||
|
Loading…
Reference in New Issue
Block a user