mirror of
				https://github.com/glfw/glfw.git
				synced 2025-11-04 14:16:42 +00:00 
			
		
		
		
	Move X11 PPosition hack to glfwSetWindowPos
This commit is contained in:
		
							parent
							
								
									ea73ccf22d
								
							
						
					
					
						commit
						0d1dd82b89
					
				@ -446,14 +446,6 @@ static GLFWbool createWindow(_GLFWwindow* window,
 | 
				
			|||||||
            hints->flags |= PPosition;
 | 
					            hints->flags |= PPosition;
 | 
				
			||||||
            _glfwPlatformGetMonitorPos(wndconfig->monitor, &hints->x, &hints->y);
 | 
					            _glfwPlatformGetMonitorPos(wndconfig->monitor, &hints->x, &hints->y);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            // HACK: Explicitly setting PPosition to any value causes some WMs,
 | 
					 | 
				
			||||||
            //       notably Compiz and Metacity, to honor the position of
 | 
					 | 
				
			||||||
            //       unmapped windows set by XMoveWindow
 | 
					 | 
				
			||||||
            hints->flags |= PPosition;
 | 
					 | 
				
			||||||
            hints->x = hints->y = 0;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!wndconfig->resizable)
 | 
					        if (!wndconfig->resizable)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
@ -1615,6 +1607,24 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
 | 
					void _glfwPlatformSetWindowPos(_GLFWwindow* window, int xpos, int ypos)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    // HACK: Explicitly setting PPosition to any value causes some WMs, notably
 | 
				
			||||||
 | 
					    //       Compiz and Metacity, to honor the position of unmapped windows
 | 
				
			||||||
 | 
					    if (!_glfwPlatformWindowVisible(window))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        long supplied;
 | 
				
			||||||
 | 
					        XSizeHints* hints = XAllocSizeHints();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (XGetWMNormalHints(_glfw.x11.display, window->x11.handle, hints, &supplied))
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            hints->flags |= PPosition;
 | 
				
			||||||
 | 
					            hints->x = hints->y = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            XSetWMNormalHints(_glfw.x11.display, window->x11.handle, hints);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        XFree(hints);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    XMoveWindow(_glfw.x11.display, window->x11.handle, xpos, ypos);
 | 
					    XMoveWindow(_glfw.x11.display, window->x11.handle, xpos, ypos);
 | 
				
			||||||
    XFlush(_glfw.x11.display);
 | 
					    XFlush(_glfw.x11.display);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user