diff --git a/README.md b/README.md index 8ea66454..ed9e3def 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,8 @@ See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/). library - [Win32] Bugfix: Context creation was attempted even if no valid pixel formats had been found + - [X11] Bugfix: Duplicate window position and window and framebuffer size + events were reported ## Contact diff --git a/src/x11_platform.h b/src/x11_platform.h index 172b4d81..6f94b508 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -86,6 +86,10 @@ typedef struct _GLFWwindowX11 GLboolean cursorGrabbed; // True if cursor is currently grabbed GLboolean cursorHidden; // True if cursor is currently hidden + // Cached position and size used to filter out duplicate events + int width, height; + int xpos, ypos; + // The last received cursor position, regardless of source double cursorPosX, cursorPosY; // The last position the cursor was warped to by GLFW diff --git a/src/x11_window.c b/src/x11_window.c index 7c118dd2..711f2d2a 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -291,6 +291,9 @@ static GLboolean createWindow(_GLFWwindow* window, XRRSelectInput(_glfw.x11.display, window->x11.handle, RRScreenChangeNotifyMask); + _glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos); + _glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height); + return GL_TRUE; } @@ -635,17 +638,31 @@ static void processEvent(XEvent *event) case ConfigureNotify: { - _glfwInputFramebufferSize(window, - event->xconfigure.width, - event->xconfigure.height); + if (event->xconfigure.width != window->x11.width || + event->xconfigure.height != window->x11.height) + { + _glfwInputFramebufferSize(window, + event->xconfigure.width, + event->xconfigure.height); - _glfwInputWindowSize(window, - event->xconfigure.width, - event->xconfigure.height); + _glfwInputWindowSize(window, + event->xconfigure.width, + event->xconfigure.height); - _glfwInputWindowPos(window, - event->xconfigure.x, - event->xconfigure.y); + window->x11.width = event->xconfigure.width; + window->x11.height = event->xconfigure.height; + } + + if (event->xconfigure.x != window->x11.xpos || + event->xconfigure.y != window->x11.ypos) + { + _glfwInputWindowPos(window, + event->xconfigure.x, + event->xconfigure.y); + + window->x11.xpos = event->xconfigure.x; + window->x11.ypos = event->xconfigure.y; + } break; }