Strange bug with widgets coordinates in fullscreen mode

Started by Vasily, 23 June 2016, 16:00:27

Vasily

Dear Texus !

First of all, thanks for your TGUI, it is simple and useful - very fit for educational purposes.
And second - i'm experiencing strange bug with widget coodinates with your sample program "full sample"
In windowed mode it works just fine, but in fullscreen everything get shifted.  (see pic).
But the mouse thinks, that widgets are right in place.

My code is the same as in "full sample" , except fullscreen
I'm on linux 64 bit with gcc

#include <TGUI/TGUI.hpp>

int main()
{

    sf::VideoMode desktop = sf::VideoMode::getDesktopMode();
    sf::RenderWindow window(desktop, "TGUI window", sf::Style::Fullscreen);

    window.setFramerateLimit(60);

    tgui::Gui gui(window);

.....

texus

Could you add some sfml rendering to it and see where it renders? Just load an sf::Texture and draw the corresponding sf::Sprite between gui.draw and window.display. Is it shifted as well? If it is also shifted, then try creating a simple example with only sfml and see if it still occurs.

Vasily

Sorry - this is probably SFML bug.
I draw the sprite over GUI with 50 pixel step,
starting with 0,0 and it is also shifted.
...
   window.clear();
        gui.draw();
        for (int i=0;i<1000;i=i+50)
        {
            spr->setPosition(sf::Vector2f(i,i));
           window.draw(*spr);
        }

        window.display();
...

texus

This is indeed an SFML bug, fullscreen windows in SFML seems to be pretty broken on linux.
https://en.sfml-dev.org/forums/index.php?topic=20482
https://github.com/SFML/SFML/issues/921

Replacing line 504 in src/SFML/Window/Unix/WindowImplX11.cpp from "if ((!m_fullscreen || (windowManagerName == "Openbox")) && !(style & Style::Resize))" to "if (!(style & Style::Resize))" seems to fix the issue for me, you should check if it fixes it for you as well.

Vasily