mirror of
https://github.com/glfw/glfw.git
synced 2026-09-18 22:55:46 +00:00
Merge branch 'master' into tls
Conflicts: src/x11_window.c
This commit is contained in:
+6
-55
@@ -133,8 +133,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
// TODO: Handle all the various error codes here and translate them
|
||||
// to GLFW errors
|
||||
|
||||
_glfwSetError(GLFW_PLATFORM_ERROR,
|
||||
"X11/GLX: Failed to create window");
|
||||
_glfwSetError(GLFW_PLATFORM_ERROR, "X11: Failed to create window");
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
@@ -193,7 +192,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
if (!hints)
|
||||
{
|
||||
_glfwSetError(GLFW_OUT_OF_MEMORY,
|
||||
"X11/GLX: Failed to allocate WM hints");
|
||||
"X11: Failed to allocate WM hints");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -210,7 +209,7 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
if (!hints)
|
||||
{
|
||||
_glfwSetError(GLFW_OUT_OF_MEMORY,
|
||||
"X11/GLX: Failed to allocate size hints");
|
||||
"X11: Failed to allocate size hints");
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -477,17 +476,10 @@ static void processEvent(XEvent *event)
|
||||
// A keyboard key was pressed
|
||||
window = findWindow(event->xkey.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for KeyPress event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Translate and report key press
|
||||
_glfwInputKey(window, translateKey(event->xkey.keycode), GLFW_PRESS);
|
||||
|
||||
// Translate and report character input
|
||||
_glfwInputChar(window, translateChar(&event->xkey));
|
||||
|
||||
_glfwInputKey(window, translateKey(event.xkey.keycode), GLFW_PRESS);
|
||||
_glfwInputChar(window, translateChar(&event.xkey));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -496,10 +488,7 @@ static void processEvent(XEvent *event)
|
||||
// A keyboard key was released
|
||||
window = findWindow(event->xkey.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for KeyRelease event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not report key releases for key repeats. For key repeats we
|
||||
// will get KeyRelease/KeyPress pairs with similar or identical
|
||||
@@ -527,9 +516,7 @@ static void processEvent(XEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
// Translate and report key release
|
||||
_glfwInputKey(window, translateKey(event->xkey.keycode), GLFW_RELEASE);
|
||||
|
||||
_glfwInputKey(window, translateKey(event.xkey.keycode), GLFW_RELEASE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -538,10 +525,7 @@ static void processEvent(XEvent *event)
|
||||
// A mouse button was pressed or a scrolling event occurred
|
||||
window = findWindow(event->xbutton.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for ButtonPress event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->xbutton.button == Button1)
|
||||
_glfwInputMouseClick(window, GLFW_MOUSE_BUTTON_LEFT, GLFW_PRESS);
|
||||
@@ -570,10 +554,7 @@ static void processEvent(XEvent *event)
|
||||
// A mouse button was released
|
||||
window = findWindow(event->xbutton.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for ButtonRelease event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->xbutton.button == Button1)
|
||||
{
|
||||
@@ -601,10 +582,7 @@ static void processEvent(XEvent *event)
|
||||
// The cursor entered the window
|
||||
window = findWindow(event->xcrossing.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for EnterNotify event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
||||
hideCursor(window);
|
||||
@@ -618,10 +596,7 @@ static void processEvent(XEvent *event)
|
||||
// The cursor left the window
|
||||
window = findWindow(event->xcrossing.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for LeaveNotify event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->cursorMode == GLFW_CURSOR_HIDDEN)
|
||||
showCursor(window);
|
||||
@@ -635,10 +610,7 @@ static void processEvent(XEvent *event)
|
||||
// The cursor was moved
|
||||
window = findWindow(event->xmotion.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for MotionNotify event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (event->xmotion.x != window->X11.cursorPosX ||
|
||||
event->xmotion.y != window->X11.cursorPosY)
|
||||
@@ -676,10 +648,7 @@ static void processEvent(XEvent *event)
|
||||
// The window configuration changed somehow
|
||||
window = findWindow(event->xconfigure.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for ConfigureNotify event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
_glfwInputWindowSize(window,
|
||||
event->xconfigure.width,
|
||||
@@ -697,10 +666,7 @@ static void processEvent(XEvent *event)
|
||||
// Custom client message, probably from the window manager
|
||||
window = findWindow(event->xclient.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for ClientMessage event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((Atom) event->xclient.data.l[0] == _glfwLibrary.X11.wmDeleteWindow)
|
||||
{
|
||||
@@ -731,10 +697,7 @@ static void processEvent(XEvent *event)
|
||||
// The window was mapped
|
||||
window = findWindow(event->xmap.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for MapNotify event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
_glfwInputWindowIconify(window, GL_FALSE);
|
||||
break;
|
||||
@@ -745,10 +708,7 @@ static void processEvent(XEvent *event)
|
||||
// The window was unmapped
|
||||
window = findWindow(event->xmap.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for UnmapNotify event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
_glfwInputWindowIconify(window, GL_TRUE);
|
||||
break;
|
||||
@@ -759,10 +719,7 @@ static void processEvent(XEvent *event)
|
||||
// The window gained focus
|
||||
window = findWindow(event->xfocus.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for FocusIn event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
_glfwInputWindowFocus(window, GL_TRUE);
|
||||
|
||||
@@ -777,10 +734,7 @@ static void processEvent(XEvent *event)
|
||||
// The window lost focus
|
||||
window = findWindow(event->xfocus.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for FocusOut event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
_glfwInputWindowFocus(window, GL_FALSE);
|
||||
|
||||
@@ -795,10 +749,7 @@ static void processEvent(XEvent *event)
|
||||
// The window's contents was damaged
|
||||
window = findWindow(event->xexpose.window);
|
||||
if (window == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cannot find GLFW window structure for Expose event\n");
|
||||
return;
|
||||
}
|
||||
|
||||
_glfwInputWindowDamage(window);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user