mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
Merge branch 'master' into multi-monitor
Conflicts: src/cocoa_window.m src/init.c tests/iconify.c tests/reopen.c
This commit is contained in:
+7
-5
@@ -51,6 +51,11 @@ static void set_swap_interval(GLFWwindow window, int interval)
|
||||
glfwSetWindowTitle(window, title);
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
{
|
||||
window_width = width;
|
||||
@@ -80,18 +85,15 @@ int main(void)
|
||||
GLFWwindow window;
|
||||
int width, height;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(window_width, window_height, "", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -47,6 +47,11 @@ static GLboolean control_is_down(GLFWwindow window)
|
||||
glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL);
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
{
|
||||
closed = GL_TRUE;
|
||||
@@ -93,11 +98,6 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error in %s\n", description);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int ch;
|
||||
|
||||
+7
-5
@@ -72,16 +72,20 @@ static ParamGLFW glfw_params[] =
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i, width, height;
|
||||
GLFWwindow window;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
|
||||
|
||||
@@ -89,8 +93,6 @@ int main(void)
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -218,6 +218,11 @@ static const char* get_character_string(int character)
|
||||
return result;
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_pos_callback(GLFWwindow window, int x, int y)
|
||||
{
|
||||
printf("%08x at %0.3f: Window position: %i %i\n",
|
||||
@@ -370,11 +375,10 @@ int main(void)
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
printf("Library initialized\n");
|
||||
|
||||
@@ -382,8 +386,6 @@ int main(void)
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -38,6 +38,11 @@
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
@@ -82,11 +87,10 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (samples)
|
||||
printf("Requesting FSAA with %i samples\n", samples);
|
||||
@@ -99,8 +103,6 @@ int main(int argc, char** argv)
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -113,8 +115,6 @@ int main(int argc, char** argv)
|
||||
if (!glfwExtensionSupported("GL_ARB_multisample"))
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Context reports GL_ARB_multisample is not supported\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -35,6 +35,11 @@
|
||||
|
||||
static GLboolean running = GL_TRUE;
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_focus_callback(GLFWwindow window, int focused)
|
||||
{
|
||||
printf("%0.3f: Window %s\n",
|
||||
@@ -76,18 +81,15 @@ int main(void)
|
||||
{
|
||||
GLFWwindow window;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(640, 480, "Fullscreen focus", glfwGetPrimaryMonitor(), NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -52,6 +52,11 @@ static void set_gamma(float value)
|
||||
glfwSetGamma(gamma_value);
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
{
|
||||
closed = GL_TRUE;
|
||||
@@ -118,11 +123,10 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (monitor)
|
||||
{
|
||||
@@ -141,8 +145,6 @@ int main(int argc, char** argv)
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
@@ -257,10 +257,7 @@ int main(int argc, char** argv)
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (major != 1 || minor != 0)
|
||||
{
|
||||
|
||||
+10
-8
@@ -42,6 +42,11 @@ static void usage(void)
|
||||
printf("Usage: iconify [-h] [-f]\n");
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
{
|
||||
closed = GL_TRUE;
|
||||
@@ -95,12 +100,6 @@ int main(int argc, char** argv)
|
||||
GLFWmonitor monitor = NULL;
|
||||
GLFWwindow window;
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while ((ch = getopt(argc, argv, "fh")) != -1)
|
||||
{
|
||||
switch (ch)
|
||||
@@ -119,6 +118,11 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
if (monitor)
|
||||
{
|
||||
GLFWvidmode mode;
|
||||
@@ -136,8 +140,6 @@ int main(int argc, char** argv)
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
+7
-5
@@ -47,6 +47,11 @@ typedef struct Joystick
|
||||
static Joystick joysticks[GLFW_JOYSTICK_LAST - GLFW_JOYSTICK_1 + 1];
|
||||
static int joystick_count = 0;
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
@@ -185,18 +190,15 @@ int main(void)
|
||||
|
||||
memset(joysticks, 0, sizeof(joysticks));
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(640, 480, "Joystick Test", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -56,6 +56,11 @@ static void toggle_cursor(GLFWwindow window)
|
||||
}
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void cursor_position_callback(GLFWwindow window, int x, int y)
|
||||
{
|
||||
printf("Cursor moved to: %i %i (%i %i)\n", x, y, x - cursor_x, y - cursor_y);
|
||||
@@ -111,16 +116,13 @@ static GLboolean open_window(void)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (!open_window())
|
||||
{
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -139,8 +141,6 @@ int main(void)
|
||||
glfwDestroyWindow(window_handle);
|
||||
if (!open_window())
|
||||
{
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+9
-10
@@ -41,6 +41,11 @@
|
||||
static GLFWwindow window_handle = NULL;
|
||||
static GLboolean closed = GL_FALSE;
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
@@ -71,16 +76,14 @@ static GLboolean open_window(int width, int height, GLFWmonitor monitor)
|
||||
{
|
||||
double base;
|
||||
|
||||
if (!glfwInit())
|
||||
return GL_FALSE;
|
||||
|
||||
base = glfwGetTime();
|
||||
|
||||
window_handle = glfwCreateWindow(width, height, "Window Re-opener", monitor, NULL);
|
||||
if (!window_handle)
|
||||
{
|
||||
fprintf(stderr, "Failed to open %s mode GLFW window: %s\n",
|
||||
monitor ? "fullscreen" : "windowed",
|
||||
glfwErrorString(glfwGetError()));
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window_handle);
|
||||
glfwSwapInterval(1);
|
||||
@@ -110,11 +113,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
return GL_FALSE;
|
||||
}
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
||||
+7
-7
@@ -39,6 +39,11 @@
|
||||
static GLFWwindow windows[2];
|
||||
static GLboolean closed = GL_FALSE;
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow window, int key, int action)
|
||||
{
|
||||
if (action == GLFW_PRESS && key == GLFW_KEY_ESCAPE)
|
||||
@@ -128,17 +133,14 @@ int main(int argc, char** argv)
|
||||
{
|
||||
GLuint texture;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
windows[0] = open_window("First", NULL, 0, 0);
|
||||
if (!windows[0])
|
||||
{
|
||||
fprintf(stderr, "Failed to open first GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
@@ -152,8 +154,6 @@ int main(int argc, char** argv)
|
||||
windows[1] = open_window("Second", windows[0], WIDTH + 50, 0);
|
||||
if (!windows[1])
|
||||
{
|
||||
fprintf(stderr, "Failed to open second GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+7
-5
@@ -48,6 +48,11 @@ static void set_swap_interval(GLFWwindow window, int interval)
|
||||
glfwSetWindowTitle(window, title);
|
||||
}
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
@@ -64,17 +69,14 @@ int main(void)
|
||||
float position;
|
||||
GLFWwindow window;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(640, 480, "", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+10
-6
@@ -47,6 +47,11 @@ typedef struct
|
||||
|
||||
static volatile GLboolean running = GL_TRUE;
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static int thread_main(void* data)
|
||||
{
|
||||
const Thread* thread = (const Thread*) data;
|
||||
@@ -80,12 +85,10 @@ int main(void)
|
||||
};
|
||||
const int count = sizeof(threads) / sizeof(Thread);
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n",
|
||||
glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
@@ -96,8 +99,7 @@ int main(void)
|
||||
NULL, NULL);
|
||||
if (!threads[i].window)
|
||||
{
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n",
|
||||
glfwErrorString(glfwGetError()));
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -105,6 +107,8 @@ int main(void)
|
||||
thrd_success)
|
||||
{
|
||||
fprintf(stderr, "Failed to create secondary thread\n");
|
||||
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-5
@@ -32,6 +32,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
@@ -41,17 +46,14 @@ int main(void)
|
||||
{
|
||||
GLFWwindow window;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n", glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(400, 400, "English 日本語 русский язык 官話", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
+7
-7
@@ -40,18 +40,21 @@ static const char* titles[] =
|
||||
"Quux"
|
||||
};
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
GLboolean running = GL_TRUE;
|
||||
GLFWwindow windows[4];
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
fprintf(stderr, "Failed to initialize GLFW: %s\n",
|
||||
glfwErrorString(glfwGetError()));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -60,9 +63,6 @@ int main(void)
|
||||
windows[i] = glfwCreateWindow(200, 200, titles[i], NULL, NULL);
|
||||
if (!windows[i])
|
||||
{
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n",
|
||||
glfwErrorString(glfwGetError()));
|
||||
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user