The Battle for Wesnoth  1.15.2+dev
Public Member Functions | Private Attributes | List of all members
gui2::event::resource_locker Class Reference

SDL_AddTimer() callback for the hover event. More...

Public Member Functions

 resource_locker (bool &locked)
 
 ~resource_locker ()
 

Private Attributes

bool & locked_
 

Detailed Description

SDL_AddTimer() callback for the hover event.

When this callback is called it pushes a new hover event in the event queue.

Parameters
intervalThe time parameter of SDL_AddTimer.
paramPointer to a widget that's able to show the tooltip (will be used as a dispatcher).
Returns
The new timer interval, 0 to stop. Small helper to keep a resource (boolean) locked.

Some of the event handling routines can't be called recursively, this due to the fact that they are attached to the pre queue and when the forward an event the pre queue event gets triggered recursively causing infinite recursion.

To prevent that those functions check the lock and exit when the lock is held otherwise grab the lock here.

Definition at line 85 of file distributor.cpp.

Constructor & Destructor Documentation

◆ resource_locker()

gui2::event::resource_locker::resource_locker ( bool &  locked)
inline

Definition at line 88 of file distributor.cpp.

References locked_.

◆ ~resource_locker()

gui2::event::resource_locker::~resource_locker ( )
inline

Definition at line 94 of file distributor.cpp.

References locked_.

Member Data Documentation

◆ locked_

bool& gui2::event::resource_locker::locked_
private

Definition at line 101 of file distributor.cpp.

Referenced by resource_locker(), and ~resource_locker().


The documentation for this class was generated from the following file: