Skip to content

Commit

Permalink
Ensure that GUI2 windows trigger the redraw-events when closed
Browse files Browse the repository at this point in the history
This changes the behaviour of the GUI2 draw-layers to rely on
tdistributor instead of thandler. tdistributor is used by every GUI2
window, making it the correct choice for triggering a redraw when it
is destroyed.
  • Loading branch information
aginor committed Feb 21, 2016
1 parent ea649ec commit a275ea9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/gui/auxiliary/event/dispatcher.hpp
Expand Up @@ -22,6 +22,8 @@

#include "SDL_events.h"

#include "video.hpp"

#include "utils/boost_function_guarded.hpp"
#include <boost/mpl/int.hpp>
#include <boost/utility/enable_if.hpp>
Expand Down
13 changes: 13 additions & 0 deletions src/gui/auxiliary/event/distributor.hpp
Expand Up @@ -271,6 +271,19 @@ class tdistributor : public tmouse_button_left,
void keyboard_remove_from_chain(twidget* widget);

private:
class layer : public video2::draw_layering
{
public:
virtual void handle_event(const SDL_Event& ) {}
#if SDL_VERSION_ATLEAST(2, 0, 0)
virtual void handle_window_event(const SDL_Event& ) {}
#endif
layer() : video2::draw_layering(false) { }
};

// make sure the appropriate things happens when we close.
layer layer_;

#if 0
bool hover_pending_; /**< Is there a hover event pending? */
unsigned hover_id_; /**< Id of the pending hover event. */
Expand Down
4 changes: 2 additions & 2 deletions src/gui/auxiliary/event/handler.cpp
Expand Up @@ -121,7 +121,7 @@ static Uint32 timer_sdl_poll_events(Uint32, void*)
*
* It's a new experimental class.
*/
class thandler : public video2::draw_layering
class thandler : public events::sdl_handler
{
friend bool gui2::is_in_dialog();

Expand Down Expand Up @@ -298,7 +298,7 @@ class thandler : public video2::draw_layering
};

thandler::thandler()
: video2::draw_layering(false)
: events::sdl_handler(false)
, mouse_focus(NULL)
, dispatchers_()
, keyboard_focus_(NULL)
Expand Down

0 comments on commit a275ea9

Please sign in to comment.