pygame-ce icon indicating copy to clipboard operation
pygame-ce copied to clipboard

Documentation need to explain the difference between WINDOWFOCUSGAINED and WINDOWTAKEFOCUS

Open mentat51 opened this issue 11 months ago • 2 comments

The short description of the two events doesn't give more information : WINDOWFOCUSGAINED Window gained focus WINDOWTAKEFOCUS Window was offered focus

And the word TAKE give "was offered" ? What does it mean ?

mentat51 avatar Dec 05 '24 16:12 mentat51

Following infomation may be useful:

Accroding to the comments in SDL_video.h of SDL2.30.9:

typedef enum
{
    ...
    SDL_WINDOWEVENT_FOCUS_GAINED,   /**< Window has gained keyboard focus */
    ...
    SDL_WINDOWEVENT_TAKE_FOCUS,     /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */
    ...
} SDL_WindowEventID;

Accroding to the comments in SDL_events.h of SDL3.1.6:

typedef enum SDL_EventType
{
    ...
    SDL_EVENT_WINDOW_FOCUS_GAINED,      /**< Window has gained keyboard focus */
    ...
} SDL_EventType;

In SDL3, WINDOW_TAKE_FOCUS is no longer exist.

yunline avatar Dec 09 '24 04:12 yunline

Good answer ! I've read the SDL3 doc and i've see that too. Perhaps we can mark OBSOLETE/DEPRECATED the WINDOWTAKEFOCUS in the doc ?

mentat51 avatar Dec 16 '24 20:12 mentat51