Skip to content

Commit

Permalink
Remove useless redraw, merge if's
Browse files Browse the repository at this point in the history
  • Loading branch information
captchaKing committed Feb 12, 2022
1 parent f721737 commit b49b263
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 1 addition & 5 deletions crates/kas-widgets/src/menu/menubar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,7 @@ widget! {
coord,
..
} => {
if !mgr.set_grab_depress(source, cur_id.clone()) {
// If redraw hasn't happened, force it to fix
// highligting of previously selected menu-item
mgr.send_action(TkAction::REDRAW);
}
mgr.set_grab_depress(source, cur_id.clone());

let id = match cur_id {
Some(x) => x,
Expand Down
6 changes: 2 additions & 4 deletions crates/kas-widgets/src/menu/submenu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,8 @@ widget! {

fn draw(&mut self, mut draw: DrawMgr) {
let mut draw = draw.with_core(self.core_data());
if self.popup_id.is_some() {
if !self.closing_menu {
draw.state.insert(InputState::DEPRESS);
}
if self.popup_id.is_some() && !self.closing_menu {
draw.state.insert(InputState::DEPRESS);
}
draw.menu_entry(self.core.rect);
draw.text_accel(
Expand Down

0 comments on commit b49b263

Please sign in to comment.