Skip to content

Commit

Permalink
fix(windows): redraw menubar after inserting (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir authored Sep 20, 2023
1 parent bdd0c9a commit f7e3030
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/windows-menubar-redraw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"muda": "patch"
---

On Windwos, redraw the menubar when adding a new menu item or a submenu.
6 changes: 6 additions & 0 deletions src/platform_impl/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ impl Menu {
}
}

// redraw the menu bar
for hwnd in &self.hwnds {
unsafe { DrawMenuBar(*hwnd) };
}

{
let mut child_ = child.borrow_mut();
child_.parents_hemnu.push(self.hmenu);
Expand All @@ -270,6 +275,7 @@ impl Menu {
RemoveMenu(self.hmenu, id, MF_BYCOMMAND);
RemoveMenu(self.hpopupmenu, id, MF_BYCOMMAND);

// redraw the menu bar
for hwnd in &self.hwnds {
DrawMenuBar(*hwnd);
}
Expand Down

0 comments on commit f7e3030

Please sign in to comment.