mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 08:50:15 +00:00
Merge branch 'master' into multi-monitor
Conflicts: include/GL/glfw3.h readme.html src/CMakeLists.txt src/win32_window.c src/window.c src/x11_window.c tests/clipboard.c tests/defaults.c tests/events.c tests/fsfocus.c tests/glfwinfo.c tests/joysticks.c tests/peter.c tests/sharing.c tests/tearing.c tests/title.c tests/windows.c
This commit is contained in:
+1
-1
@@ -125,7 +125,7 @@ int main(int argc, char** argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(0, 0, "Clipboard Test", NULL, NULL);
|
||||
window = glfwCreateWindow(200, 200, "Clipboard Test", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@ int main(void)
|
||||
|
||||
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
|
||||
|
||||
window = glfwCreateWindow(0, 0, "Defaults", NULL, NULL);
|
||||
window = glfwCreateWindow(640, 480, "Defaults", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
+3
-26
@@ -41,8 +41,6 @@
|
||||
#include <locale.h>
|
||||
|
||||
// These must match the input mode defaults
|
||||
static GLboolean keyrepeat = GL_FALSE;
|
||||
static GLboolean systemkeys = GL_TRUE;
|
||||
static GLboolean closeable = GL_TRUE;
|
||||
|
||||
// Event index
|
||||
@@ -249,12 +247,12 @@ static void window_refresh_callback(GLFWwindow window)
|
||||
}
|
||||
}
|
||||
|
||||
static void window_focus_callback(GLFWwindow window, int activated)
|
||||
static void window_focus_callback(GLFWwindow window, int focused)
|
||||
{
|
||||
printf("%08x at %0.3f: Window %s\n",
|
||||
counter++,
|
||||
glfwGetTime(),
|
||||
activated ? "activated" : "deactivated");
|
||||
focused ? "focused" : "defocused");
|
||||
}
|
||||
|
||||
static void window_iconify_callback(GLFWwindow window, int iconified)
|
||||
@@ -311,24 +309,6 @@ static void key_callback(GLFWwindow window, int key, int action)
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case GLFW_KEY_R:
|
||||
{
|
||||
keyrepeat = !keyrepeat;
|
||||
glfwSetInputMode(window, GLFW_KEY_REPEAT, keyrepeat);
|
||||
|
||||
printf("(( key repeat %s ))\n", keyrepeat ? "enabled" : "disabled");
|
||||
break;
|
||||
}
|
||||
|
||||
case GLFW_KEY_S:
|
||||
{
|
||||
systemkeys = !systemkeys;
|
||||
glfwSetInputMode(window, GLFW_SYSTEM_KEYS, systemkeys);
|
||||
|
||||
printf("(( system keys %s ))\n", systemkeys ? "enabled" : "disabled");
|
||||
break;
|
||||
}
|
||||
|
||||
case GLFW_KEY_C:
|
||||
{
|
||||
closeable = !closeable;
|
||||
@@ -389,7 +369,7 @@ int main(void)
|
||||
|
||||
printf("Library initialized\n");
|
||||
|
||||
window = glfwCreateWindow(0, 0, "Event Linter", NULL, NULL);
|
||||
window = glfwCreateWindow(640, 480, "Event Linter", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
@@ -420,9 +400,6 @@ int main(void)
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
printf("Window size should be %ix%i\n", width, height);
|
||||
|
||||
printf("Key repeat should be %s\n", keyrepeat ? "enabled" : "disabled");
|
||||
printf("System keys should be %s\n", systemkeys ? "enabled" : "disabled");
|
||||
|
||||
printf("Main loop starting\n");
|
||||
|
||||
while (!glfwGetWindowParam(window, GLFW_CLOSE_REQUESTED))
|
||||
|
||||
+4
-4
@@ -23,8 +23,8 @@
|
||||
//
|
||||
//========================================================================
|
||||
//
|
||||
// This test is used to test window activation and iconfication for
|
||||
// fullscreen windows with a video mode differing from the current mode
|
||||
// This test is used to test window focusing and iconfication for
|
||||
// fullscreen windows with a video mode differing from the desktop mode
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
|
||||
static GLboolean running = GL_TRUE;
|
||||
|
||||
static void window_focus_callback(GLFWwindow window, int activated)
|
||||
static void window_focus_callback(GLFWwindow window, int focused)
|
||||
{
|
||||
printf("%0.3f: Window %s\n",
|
||||
glfwGetTime(),
|
||||
activated ? "activated" : "deactivated");
|
||||
focused ? "focused" : "defocused");
|
||||
}
|
||||
|
||||
static void window_key_callback(GLFWwindow window, int key, int action)
|
||||
|
||||
+2
-2
@@ -133,8 +133,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
width = 0;
|
||||
height = 0;
|
||||
width = 200;
|
||||
height = 200;
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(width, height, "Gamma Test", monitor, NULL);
|
||||
|
||||
+1
-1
@@ -268,7 +268,7 @@ int main(int argc, char** argv)
|
||||
// We assume here that we stand a better chance of success by leaving all
|
||||
// possible details of pixel format selection to GLFW
|
||||
|
||||
window = glfwCreateWindow(0, 0, "Version", NULL, NULL);
|
||||
window = glfwCreateWindow(200, 200, "Version", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
+5
-5
@@ -75,11 +75,11 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
static void window_focus_callback(GLFWwindow window, int activated)
|
||||
static void window_focus_callback(GLFWwindow window, int focused)
|
||||
{
|
||||
printf("%0.2f Window %s\n",
|
||||
glfwGetTime(),
|
||||
activated ? "activated" : "deactivated");
|
||||
focused ? "focused" : "defocused");
|
||||
}
|
||||
|
||||
static void window_iconify_callback(GLFWwindow window, int iconified)
|
||||
@@ -128,8 +128,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
else
|
||||
{
|
||||
width = 0;
|
||||
height = 0;
|
||||
width = 640;
|
||||
height = 480;
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(width, height, "Iconify", monitor, NULL);
|
||||
@@ -152,7 +152,7 @@ int main(int argc, char** argv)
|
||||
|
||||
printf("Window is %s and %s\n",
|
||||
glfwGetWindowParam(window, GLFW_ICONIFIED) ? "iconified" : "restored",
|
||||
glfwGetWindowParam(window, GLFW_ACTIVE) ? "active" : "inactive");
|
||||
glfwGetWindowParam(window, GLFW_FOCUSED) ? "focused" : "defocused");
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
|
||||
+1
-1
@@ -186,7 +186,7 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(0, 0, "Joystick Test", NULL, NULL);
|
||||
window = glfwCreateWindow(640, 480, "Joystick Test", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ static void window_size_callback(GLFWwindow window, int width, int height)
|
||||
|
||||
static GLboolean open_window(void)
|
||||
{
|
||||
window_handle = glfwCreateWindow(0, 0, "Peter Detector", NULL, NULL);
|
||||
window_handle = glfwCreateWindow(640, 480, "Peter Detector", NULL, NULL);
|
||||
if (!window_handle)
|
||||
return GL_FALSE;
|
||||
|
||||
|
||||
+10
-9
@@ -51,10 +51,12 @@ static int window_close_callback(GLFWwindow window)
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static GLFWwindow open_window(const char* title, GLFWwindow share)
|
||||
static GLFWwindow open_window(const char* title, GLFWwindow share, int posX, int posY)
|
||||
{
|
||||
GLFWwindow window;
|
||||
|
||||
glfwWindowHint(GLFW_POSITION_X, posX);
|
||||
glfwWindowHint(GLFW_POSITION_Y, posY);
|
||||
window = glfwCreateWindow(WIDTH, HEIGHT, title, NULL, share);
|
||||
if (!window)
|
||||
return NULL;
|
||||
@@ -125,7 +127,6 @@ static void draw_quad(GLuint texture)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
GLuint texture;
|
||||
int x, y;
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
@@ -133,7 +134,7 @@ int main(int argc, char** argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
windows[0] = open_window("First", NULL);
|
||||
windows[0] = open_window("First", NULL, 0, 0);
|
||||
if (!windows[0])
|
||||
{
|
||||
fprintf(stderr, "Failed to open first GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
@@ -147,7 +148,8 @@ int main(int argc, char** argv)
|
||||
// It will then be shared with the second context, created below
|
||||
texture = create_texture();
|
||||
|
||||
windows[1] = open_window("Second", windows[0]);
|
||||
// Put the second window to the right of the first one
|
||||
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()));
|
||||
@@ -156,14 +158,13 @@ int main(int argc, char** argv)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Set drawing color for the first context and copy it to the second
|
||||
// Set drawing color for both contexts
|
||||
glfwMakeContextCurrent(windows[0]);
|
||||
glColor3f(0.6f, 0.f, 0.6f);
|
||||
glfwCopyContext(windows[0], windows[1], GL_CURRENT_BIT);
|
||||
glfwMakeContextCurrent(windows[1]);
|
||||
glColor3f(0.6f, 0.6f, 0.f);
|
||||
|
||||
// Put the second window to the right of the first one
|
||||
glfwGetWindowPos(windows[0], &x, &y);
|
||||
glfwSetWindowPos(windows[1], x + WIDTH + 50, y);
|
||||
glfwMakeContextCurrent(windows[0]);
|
||||
|
||||
while (!closed)
|
||||
{
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(0, 0, "", NULL, NULL);
|
||||
window = glfwCreateWindow(640, 480, "", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
|
||||
+2
-2
@@ -89,6 +89,8 @@ int main(void)
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
glfwWindowHint(GLFW_POSITION_X, 200 + 250 * i);
|
||||
glfwWindowHint(GLFW_POSITION_Y, 200);
|
||||
threads[i].window = glfwCreateWindow(200, 200,
|
||||
threads[i].title,
|
||||
NULL, NULL);
|
||||
@@ -99,8 +101,6 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200);
|
||||
|
||||
if (thrd_create(&threads[i].id, thread_main, threads + i) !=
|
||||
thrd_success)
|
||||
{
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
window = glfwCreateWindow(0, 0, "English 日本語 русский язык 官話", NULL, NULL);
|
||||
window = glfwCreateWindow(400, 400, "English 日本語 русский язык 官話", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
fprintf(stderr, "Failed to open GLFW window: %s\n", glfwErrorString(glfwGetError()));
|
||||
|
||||
+2
-2
@@ -55,6 +55,8 @@ int main(void)
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
glfwWindowHint(GLFW_POSITION_X, 100 + (i & 1) * 300);
|
||||
glfwWindowHint(GLFW_POSITION_Y, 100 + (i >> 1) * 300);
|
||||
windows[i] = glfwCreateWindow(200, 200, titles[i], NULL, NULL);
|
||||
if (!windows[i])
|
||||
{
|
||||
@@ -70,8 +72,6 @@ int main(void)
|
||||
(GLclampf) (i >> 1),
|
||||
i ? 0.f : 1.f,
|
||||
0.f);
|
||||
|
||||
glfwSetWindowPos(windows[i], 100 + (i & 1) * 300, 100 + (i >> 1) * 300);
|
||||
}
|
||||
|
||||
while (running)
|
||||
|
||||
Reference in New Issue
Block a user