Fixed duplicate events being reported.

This commit is contained in:
Camilla Berglund 2013-06-16 18:29:46 +02:00
parent d31322cdcd
commit a7ff236b32
3 changed files with 32 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}