From: Cheng Zhao Date: Thu, 4 Jun 2015 08:10:19 +0000 (+0800) Subject: Allow removing menu bar X-Git-Tag: v0.27.3~9^2~2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=5d23b7468eab6f1cb7856585149807f5d91dc764;p=electron.git Allow removing menu bar --- diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 8f5e51ed..710788dd 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -541,6 +541,19 @@ bool NativeWindowViews::IsKiosk() { } void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) { + if (menu_model == nullptr) { + // Remove accelerators + accelerator_table_.clear(); + GetFocusManager()->UnregisterAccelerators(this); + // and menu bar. +#if defined(USE_X11) + global_menu_bar_.reset(); +#endif + SetMenuBarVisibility(false); + menu_bar_.reset(); + return; + } + RegisterAccelerators(menu_model); #if defined(USE_X11)