Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Linux]window.setPosition()  (Read 5504 times)

0 Members and 2 Guests are viewing this topic.

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
[Linux]window.setPosition()
« 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)
« Last Edit: February 05, 2015, 08:43:52 am by AlexxanderX »
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [Linux]window.setPosition()
« Reply #1 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.
Laurent Gomila - SFML developer

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: [Linux]window.setPosition()
« Reply #2 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)
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [Linux]window.setPosition()
« Reply #3 on: February 04, 2015, 10:08:01 pm »
Quote
Should move the window when the white bar is dragged.
And what does it do?
Laurent Gomila - SFML developer

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: [Linux]window.setPosition()
« Reply #4 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).
« Last Edit: February 04, 2015, 10:38:32 pm by AlexxanderX »
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

Aster

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: [Linux]window.setPosition()
« Reply #5 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.
« Last Edit: February 04, 2015, 10:49:15 pm by Aster »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [Linux]window.setPosition()
« Reply #6 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.
« Last Edit: February 04, 2015, 10:43:30 pm by Laurent »
Laurent Gomila - SFML developer

Aster

  • Full Member
  • ***
  • Posts: 130
    • View Profile
Re: [Linux]window.setPosition()
« Reply #7 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.

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: [Linux]window.setPosition()
« Reply #8 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.
« Last Edit: February 05, 2015, 08:36:23 pm by AlexxanderX »
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

 

anything