Window event tracking
Each window allows you to track events occurring with it (for example, its movement). Each event can have its own callback function. To do this, use the addEventListener
method, which is exactly the same as the components and has the following form:
Windows can track the following events:
Action
Description
shown
Window has been shown
hidden
Window has been hidden
exposed
Window has been exposed and should be redrawn
moved
Window has been moved to data1
, data2
resized
Window has been resized to data1
xdata2
minimized
Window has been minimized
maximized
Window has been maximized
restored
Window has been restored to normal size and position
enter
Window has gained mouse focus
leave
Window has lost mouse focus
focus_gained
Window has gained keyboard focus
focus_lost
Window has lost keyboard focus
close
The window manager requests that the window be closed
take_focus
Window is being offered a focus
hit_test
Window had a hit test that wasn't SDL_HITTEST_NORMAL
data1
and data2
are the fields of the window
structure of the Event
union (for example, access to the data1 field looks like this: e->window.data1
).
Last updated
Was this helpful?