SFML community forums

Help => Window => Topic started by: skaught on March 27, 2013, 06:51:54 pm

Title: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None
Post by: skaught on March 27, 2013, 06:51:54 pm
Hello,

I recently started using SFML 2.0 for our software's windowing, unfortunately I've run into a bit of an issue.

When setting the window style to Fullscreen or None, the mouse cursor dissapears when I move the mouse over the window. I've tried calling window.setMouseCursorVisible(true); but that has no effect.

Running Windows 7 64 bit, aero enabled.
ATI Radeon HD5800 with latest drivers.
It's a dev machine and has 3 monitors.

Title: Re: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None
Post by: eXpl0it3r on March 27, 2013, 11:43:29 pm
Do you make sure to call setMouseCursorVisible after you've created the window?

#include <SFML/Graphics.hpp>

int main()
{
        sf::Window window(sf::VideoMode(800, 600), "Y U NO PROVIDE MINIMAL EXAMPLE?!", sf::Style::None);
        //sf::Window window(sf::VideoMode(1024, 768), "Y U NO PROVIDE MINIMAL EXAMPLE?!", sf::Style::Fullscreen);
        window.setFramerateLimit(60);

        while(window.isOpen())
        {
                sf::Event event;
                while(window.pollEvent(event))
                {
                        if(event.type == sf::Event::Closed)
                                window.close();
                }

                window.display();
        }
}

Works without problems for me...
Title: Re: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None
Post by: skaught on March 28, 2013, 12:21:15 am
Yes, I call it after creating the window.

Sorry, here's an excerpt from my code, I've pulled some stuff out.

I guess I should note that in this particular case _owner->getX() and _owner->getY() return 1, so the window size is the desktop size, 1920x1200.

void WindowThread::operator ()()
{
        sf::ContextSettings settings;
        settings.depthBits = 16;
        settings.stencilBits = 8;
        sf::Window window(sf::VideoMode(width, height, desktop.bitsPerPixel), _owner->getName(),sf::Style::None,settings);
        window.setMouseCursorVisible(true);
        int x = static_cast<int>(desktop.width * _owner->getX());
        int y = static_cast<int>(desktop.height * _owner->getY());
        window.setPosition(sf::Vector2i(x, y));
        window.setActive(false);
        _owner->resize(width, height);
        utility::refct_ptr<RenderThread> renderThread(new RenderThread(_owner, &window));
        _owner->setRenderThread(renderThread);
        renderThread->run();
        sf::Event event;
        sf::Keyboard::Key lastKey = sf::Keyboard::Unknown;
        utility::Rect<int> mouseInfo(0,0,(int)width,(int)height);
        while(wait(1000) != EWAIT_TERMINATE) {
                //handle events
        }
}

void RenderThread::operator ()()
{      
        while(wait(10000000) != EWAIT_TERMINATE) {
                _window->setActive(true);
                while(!_eventQueue.empty()) {
                        _eventQueue.front()();
                        _eventQueue.pop();
                }
                _owner->draw();
                _window->display();
        }
}
 
Title: Re: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None
Post by: eXpl0it3r on March 28, 2013, 12:54:23 am
Sorry, here's an excerpt from my code, I've pulled some stuff out.
Well that's neither a minimal nor a complete example.. ::)

Does the one I posted also hide the cursor?
Title: Re: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None
Post by: skaught on March 28, 2013, 01:42:04 am
Ok, I see what you were asking now.

I tried out your code, as it currently is, the cursor shows over the window.

However, if I change the window size to be 1920x1200, my current screen resolution. It actually kind of acts like it went to fullscreen mode instead of windowed without decorations.

Also the mouse now dissapears when I move it over the window.

The mouse also dissapears in Fullscreen.