Fix tooltips still being drawn over

Simply use the list of event dispatchers like the old code did.
This commit is contained in:
Jyrki Vesterinen 2017-11-02 19:34:14 +02:00
parent 54d7f6154c
commit a82eb4452f
3 changed files with 20 additions and 7 deletions

View file

@ -146,6 +146,11 @@ public:
*/
void disconnect(dispatcher* dispatcher);
/**
* Returns all dispatchers in the Z order.
*/
std::vector<dispatcher*>& get_dispatchers() { return dispatchers_; }
/** The dispatcher that captured the mouse focus. */
dispatcher* mouse_focus;
@ -807,6 +812,12 @@ void disconnect_dispatcher(dispatcher* dispatcher)
handler_->disconnect(dispatcher);
}
std::vector<dispatcher*>& get_all_dispatchers()
{
assert(handler_);
return handler_->get_dispatchers();
}
void init_mouse_location()
{
point mouse = get_mouse_position();

View file

@ -247,6 +247,11 @@ void connect_dispatcher(dispatcher* dispatcher);
*/
void disconnect_dispatcher(dispatcher* dispatcher);
/**
* Gets all event dispatchers in the Z order.
*/
std::vector<dispatcher*>& get_all_dispatchers();
/**
* Initializes the location of the mouse.
*

View file

@ -1225,15 +1225,12 @@ void window_swap_grid(grid* g,
void window::redraw_windows_on_top() const
{
auto me = std::find(open_window_stack.begin(), open_window_stack.end(), this);
if(me == open_window_stack.end()) {
// Known to happen for tooltips.
return;
}
std::vector<dispatcher*>& dispatchers = event::get_all_dispatchers();
auto me = std::find(dispatchers.begin(), dispatchers.end(), this);
for(auto it = std::next(me); it != open_window_stack.end(); ++it) {
for(auto it = std::next(me); it != dispatchers.end(); ++it) {
// Note that setting an entire window dirty like this is expensive.
(*it)->set_is_dirty(true);
dynamic_cast<widget&>(**it).set_is_dirty(true);
}
}