| 150 | ////////////////////////////////////////////////////////////////////////// |
| 151 | |
| 152 | GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, |
| 153 | const char* title, |
| 154 | GLFWmonitor* monitor, |
| 155 | GLFWwindow* share) |
| 156 | { |
| 157 | _GLFWfbconfig fbconfig; |
| 158 | _GLFWctxconfig ctxconfig; |
| 159 | _GLFWwndconfig wndconfig; |
| 160 | _GLFWwindow* window; |
| 161 | |
| 162 | assert(title != NULL); |
| 163 | assert(width >= 0); |
| 164 | assert(height >= 0); |
| 165 | |
| 166 | _GLFW_REQUIRE_INIT_OR_RETURN(NULL); |
| 167 | |
| 168 | if (width <= 0 || height <= 0) |
| 169 | { |
| 170 | _glfwInputError(GLFW_INVALID_VALUE, |
| 171 | "Invalid window size %ix%i", |
| 172 | width, height); |
| 173 | |
| 174 | return NULL; |
| 175 | } |
| 176 | |
| 177 | fbconfig = _glfw.hints.framebuffer; |
| 178 | ctxconfig = _glfw.hints.context; |
| 179 | wndconfig = _glfw.hints.window; |
| 180 | |
| 181 | wndconfig.width = width; |
| 182 | wndconfig.height = height; |
| 183 | wndconfig.title = title; |
| 184 | ctxconfig.share = (_GLFWwindow*) share; |
| 185 | |
| 186 | if (!_glfwIsValidContextConfig(&ctxconfig)) |
| 187 | return NULL; |
| 188 | |
| 189 | window = calloc(1, sizeof(_GLFWwindow)); |
| 190 | window->next = _glfw.windowListHead; |
| 191 | _glfw.windowListHead = window; |
| 192 | |
| 193 | window->videoMode.width = width; |
| 194 | window->videoMode.height = height; |
| 195 | window->videoMode.redBits = fbconfig.redBits; |
| 196 | window->videoMode.greenBits = fbconfig.greenBits; |
| 197 | window->videoMode.blueBits = fbconfig.blueBits; |
| 198 | window->videoMode.refreshRate = _glfw.hints.refreshRate; |
| 199 | |
| 200 | window->monitor = (_GLFWmonitor*) monitor; |
| 201 | window->resizable = wndconfig.resizable; |
| 202 | window->decorated = wndconfig.decorated; |
| 203 | window->autoIconify = wndconfig.autoIconify; |
| 204 | window->floating = wndconfig.floating; |
| 205 | window->focusOnShow = wndconfig.focusOnShow; |
| 206 | window->cursorMode = GLFW_CURSOR_NORMAL; |
| 207 | |
| 208 | window->doublebuffer = fbconfig.doublebuffer; |
| 209 |
no test coverage detected