mirror of
				https://github.com/glfw/glfw.git
				synced 2025-11-04 06:15:07 +00: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
 | 
			
		||||
 - [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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -634,6 +637,9 @@ static void processEvent(XEvent *event)
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        case ConfigureNotify:
 | 
			
		||||
        {
 | 
			
		||||
            if (event->xconfigure.width != window->x11.width ||
 | 
			
		||||
                event->xconfigure.height != window->x11.height)
 | 
			
		||||
            {
 | 
			
		||||
                _glfwInputFramebufferSize(window,
 | 
			
		||||
                                          event->xconfigure.width,
 | 
			
		||||
@ -643,10 +649,21 @@ static void processEvent(XEvent *event)
 | 
			
		||||
                                     event->xconfigure.width,
 | 
			
		||||
                                     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,
 | 
			
		||||
                                    event->xconfigure.x,
 | 
			
		||||
                                    event->xconfigure.y);
 | 
			
		||||
 | 
			
		||||
                window->x11.xpos = event->xconfigure.x;
 | 
			
		||||
                window->x11.ypos = event->xconfigure.y;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user