mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-27 04:28:52 -05:00
Fixed duplicate events being reported.
This commit is contained in:
parent
d31322cdcd
commit
a7ff236b32
|
@ -104,6 +104,8 @@ See the [GLFW 3.0 documentation](http://www.glfw.org/docs/3.0/).
|
||||||
library
|
library
|
||||||
- [Win32] Bugfix: Context creation was attempted even if no valid pixel formats
|
- [Win32] Bugfix: Context creation was attempted even if no valid pixel formats
|
||||||
had been found
|
had been found
|
||||||
|
- [X11] Bugfix: Duplicate window position and window and framebuffer size
|
||||||
|
events were reported
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
|
@ -86,6 +86,10 @@ typedef struct _GLFWwindowX11
|
||||||
GLboolean cursorGrabbed; // True if cursor is currently grabbed
|
GLboolean cursorGrabbed; // True if cursor is currently grabbed
|
||||||
GLboolean cursorHidden; // True if cursor is currently hidden
|
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
|
// The last received cursor position, regardless of source
|
||||||
double cursorPosX, cursorPosY;
|
double cursorPosX, cursorPosY;
|
||||||
// The last position the cursor was warped to by GLFW
|
// The last position the cursor was warped to by GLFW
|
||||||
|
|
|
@ -291,6 +291,9 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||||
XRRSelectInput(_glfw.x11.display, window->x11.handle,
|
XRRSelectInput(_glfw.x11.display, window->x11.handle,
|
||||||
RRScreenChangeNotifyMask);
|
RRScreenChangeNotifyMask);
|
||||||
|
|
||||||
|
_glfwPlatformGetWindowPos(window, &window->x11.xpos, &window->x11.ypos);
|
||||||
|
_glfwPlatformGetWindowSize(window, &window->x11.width, &window->x11.height);
|
||||||
|
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,6 +637,9 @@ static void processEvent(XEvent *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
|
{
|
||||||
|
if (event->xconfigure.width != window->x11.width ||
|
||||||
|
event->xconfigure.height != window->x11.height)
|
||||||
{
|
{
|
||||||
_glfwInputFramebufferSize(window,
|
_glfwInputFramebufferSize(window,
|
||||||
event->xconfigure.width,
|
event->xconfigure.width,
|
||||||
|
@ -643,10 +649,21 @@ static void processEvent(XEvent *event)
|
||||||
event->xconfigure.width,
|
event->xconfigure.width,
|
||||||
event->xconfigure.height);
|
event->xconfigure.height);
|
||||||
|
|
||||||
|
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,
|
_glfwInputWindowPos(window,
|
||||||
event->xconfigure.x,
|
event->xconfigure.x,
|
||||||
event->xconfigure.y);
|
event->xconfigure.y);
|
||||||
|
|
||||||
|
window->x11.xpos = event->xconfigure.x;
|
||||||
|
window->x11.ypos = event->xconfigure.y;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user