SFML community forums

Help => Window => Topic started by: AlexxanderX on February 04, 2015, 08:27:34 pm

Title: [Linux]window.setPosition()
Post by: AlexxanderX on February 04, 2015, 08:27:34 pm
I think this is a bug on linux: not setting correctly the position of the window. (last git sources - Linux Mint 17.1)
(click to show/hide)
Title: Re: [Linux]window.setPosition()
Post by: Laurent on February 04, 2015, 08:41:36 pm
What does this code is supposed to do, and what does it do?

One known bug on Linux is that window.getPosition() and window.setPosition() don't match: one takes the decorations in account, the other not.
Title: Re: [Linux]window.setPosition()
Post by: AlexxanderX on February 04, 2015, 08:57:59 pm
Updated the code.

Should move the window when the white bar is dragged.
I recently installed linux and in windows the code worked correctly( from what I remember, I'm not really sure)
Title: Re: [Linux]window.setPosition()
Post by: Laurent on February 04, 2015, 10:08:01 pm
Quote
Should move the window when the white bar is dragged.
And what does it do?
Title: Re: [Linux]window.setPosition()
Post by: AlexxanderX on February 04, 2015, 10:31:42 pm
When starting to drag the bar, the window move fast on the x axis to the maximum(screenWidth - windowWidth) and then is blocking( not crashing but can't do anything).
Title: Re: [Linux]window.setPosition()
Post by: Aster on February 04, 2015, 10:39:34 pm
sf::Window::getPosition() does not update when sf::Window::setPosition(...) is called. I just tested this with:
(click to show/hide)

This is probably a child/parent/root window issue in the xcb code.
Title: Re: [Linux]window.setPosition()
Post by: Laurent on February 04, 2015, 10:41:04 pm
You can easily test the known bug I mentioned in a previous post, by calling setPosition(x, y) and checking if getPosition() returns {x, y}.

This is not exactly a child/parent issue in the XCB code, rather a limitation of the X11 protocol: when you set the position of the window, it's with decorations (the WM adds them at this position). But when you request the window position, Xlib has no knowledge about what the WM added around the X window, so it returns the position of the client area, that is, without decorations. At least that's what I understood / remembers from the issue.
Title: Re: [Linux]window.setPosition()
Post by: Aster on February 04, 2015, 10:44:28 pm
You can easily test the known bug I mentioned in a previous post, by calling setPosition(x, y) and checking if getPosition() returns {x, y}.

This is fixed in the XCB patch. test code:
(click to show/hide)

This isn't the same bug, I think.
Title: Re: [Linux]window.setPosition()
Post by: AlexxanderX on February 05, 2015, 08:44:59 am
This is fixed in the XCB patch. test code:

This isn't the same bug, I think.

I think it is the same bug, here is another test code in which it doesn't correctly set the position:
(click to show/hide)

EDIT: The example code doesn't work. Trying to make a working one, but I have some problems with linux.
EDIT2:The example now works on windows, but not on linux. For smooth run disable the comment which show to position of window.