Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

don't redraw menus on every menu change

  • Loading branch information...
commit 241ae3d4da9129168638a70bc5db9864e8b36ce2 1 parent b27c538
@redmunds redmunds authored
Showing with 19 additions and 1 deletion.
  1. +19 −1 appshell/appshell_extensions_win.cpp
View
20 appshell/appshell_extensions_win.cpp
@@ -1779,6 +1779,15 @@ int32 SetMenuItemShortcut(CefRefPtr<CefBrowser> browser, ExtensionString command
int32 RemoveMenu(CefRefPtr<CefBrowser> browser, const ExtensionString& commandId)
{
+ // The menu bar needs to be redrawn, but we don't want to redraw with
+ // *every* menu change since that causes flicker if we're changing a
+ // bunch of menus in a row (like at "reload without user extensions").
+ // Set a timer here so we only do a single redraw.
+ if (!redrawTimerId) {
+ redrawBrowser = browser;
+ redrawTimerId = SetTimer(NULL, redrawTimerId, kMenuRedrawTimeout, MenuRedrawTimerHandler);
+ }
+
return RemoveMenuItem(browser, commandId);
}
@@ -1796,7 +1805,16 @@ int32 RemoveMenuItem(CefRefPtr<CefBrowser> browser, const ExtensionString& comma
DeleteMenu(mainMenu, tag, MF_BYCOMMAND);
NativeMenuModel::getInstance(getMenuParent(browser)).removeMenuItem(commandId);
RemoveKeyFromAcceleratorTable(tag);
- DrawMenuBar((HWND)getMenuParent(browser));
+
+ // The menu bar needs to be redrawn, but we don't want to redraw with
+ // *every* menu change since that causes flicker if we're changing a
+ // bunch of menus in a row (like at "reload without user extensions").
+ // Set a timer here so we only do a single redraw.
+ if (!redrawTimerId) {
+ redrawBrowser = browser;
+ redrawTimerId = SetTimer(NULL, redrawTimerId, kMenuRedrawTimeout, MenuRedrawTimerHandler);
+ }
+
return NO_ERROR;
}
Please sign in to comment.
Something went wrong with that request. Please try again.