don't dispatch activation/focus events if the status did not change
This commit prevents the dispatch of activation/focus events if the status did not change. This eliminates useless repaints when mousing around inside a button.
This commit is contained in:
parent
c85c367e11
commit
8251532938
1 changed files with 6 additions and 0 deletions
|
@ -167,6 +167,9 @@ void Widget::handle_mouse_move_event(MouseMoveEvent &event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_is_focused == update_focus_to)
|
||||||
|
return;
|
||||||
|
|
||||||
m_is_focused = update_focus_to;
|
m_is_focused = update_focus_to;
|
||||||
auto focus_update_event = FocusUpdateEvent(update_focus_to);
|
auto focus_update_event = FocusUpdateEvent(update_focus_to);
|
||||||
on_focus_update(focus_update_event);
|
on_focus_update(focus_update_event);
|
||||||
|
@ -187,6 +190,9 @@ void Widget::handle_mouse_button_event(MouseButtonEvent &event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_is_active == update_activation_to)
|
||||||
|
return;
|
||||||
|
|
||||||
m_is_active = update_activation_to;
|
m_is_active = update_activation_to;
|
||||||
auto activation_update_event = ActivationUpdateEvent(update_activation_to);
|
auto activation_update_event = ActivationUpdateEvent(update_activation_to);
|
||||||
on_activation_update(activation_update_event);
|
on_activation_update(activation_update_event);
|
||||||
|
|
Loading…
Reference in a new issue