Last active
December 11, 2015 21:59
-
-
Save jarrettchisholm/4666488 to your computer and use it in GitHub Desktop.
x11 window position patch for SFML 2.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
284,286c284,304 | |
< XWindowAttributes attributes; | |
< XGetWindowAttributes(m_display, m_window, &attributes); | |
< return Vector2i(attributes.x, attributes.y); | |
--- | |
> ::Window activeWin, root; | |
> int xCoordinate, yCoordinate; | |
> uint width, height, border_width, depth; | |
> ::Window *children; | |
> uint childcount; | |
> | |
> int x = 0; | |
> int y = 0; | |
> | |
> activeWin = m_window; | |
> | |
> while (activeWin != root) { | |
> if(XGetGeometry(m_display, activeWin, &root, &xCoordinate, &yCoordinate, &width, &height, &border_width, &depth)) { | |
> x += xCoordinate; | |
> y += yCoordinate; | |
> } | |
> | |
> XQueryTree(m_display, activeWin, &root, &activeWin, &children, &childcount); | |
> } | |
> | |
> return Vector2i(x, y); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment