Skip to content

doc: Improve documentation for mouse and focus event subtypes#3713

Open
Yokiatch wants to merge 1 commit into
SFML:masterfrom
Yokiatch:doc/improve-event-documentation
Open

doc: Improve documentation for mouse and focus event subtypes#3713
Yokiatch wants to merge 1 commit into
SFML:masterfrom
Yokiatch:doc/improve-event-documentation

Conversation

@Yokiatch
Copy link
Copy Markdown

@Yokiatch Yokiatch commented May 7, 2026

Description

Improves the documentation for the following event subtypes in Event.hpp
that previously only had a one-line description:

  • FocusLost
  • FocusGained
  • MouseEntered
  • MouseLeft
  • MouseWheelScrolled
  • MouseButtonPressed
  • MouseButtonReleased
  • MouseMoved

Closes #3663

This PR is related to the issue #3663

Tasks

  • Tested on Linux
  • Tested on Windows
  • Tested on macOS
  • Tested on iOS
  • Tested on Android

How to test this PR?

Run a small SFML program that prints event names to the console
while interacting with the window (moving mouse, clicking,
scrolling, Alt+Tab etc.) and verify the documented behavior
matches what is observed.

Note: Joystick, touch, and sensor events were left undocumented
as physical devices were not available for testing.

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include

int main()
{
sf::RenderWindow window(sf::VideoMode({800, 600}), "SFML Event Tester");

while (window.isOpen())
{
    while (const std::optional event = window.pollEvent())
    {
        if (event->is<sf::Event::Closed>())
            window.close();
        else if (event->is<sf::Event::FocusGained>())
            std::cout << "FocusGained fired!\n";
        else if (event->is<sf::Event::FocusLost>())
            std::cout << "FocusLost fired!\n";
        else if (event->is<sf::Event::MouseEntered>())
            std::cout << "MouseEntered fired!\n";
        else if (event->is<sf::Event::MouseLeft>())
            std::cout << "MouseLeft fired!\n";
    }

    window.clear(sf::Color::Black);
    window.display();
}

}

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode({1280, 720}), "Minimal, complete and verifiable example");
    window.setFramerateLimit(60);

    while (window.isOpen())
    {
        while (const std::optional event = window.pollEvent())
        {
            if (event->is<sf::Event::Closed>())
                window.close();
        }

        window.clear();
        window.display();
    }
}

@github-project-automation github-project-automation Bot moved this to Planned in SFML 3.2.0 May 7, 2026
@eXpl0it3r eXpl0it3r added this to the 3.2 milestone May 7, 2026
@eXpl0it3r eXpl0it3r moved this from Planned to In Progress in SFML 3.2.0 May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Event documentation and tests

2 participants