Merge pull request #4581 from atom/linux-menu-fix
Notify the global menu bar when window is mapped
This commit is contained in:
commit
3a3a95b0a9
3 changed files with 27 additions and 0 deletions
|
@ -300,14 +300,29 @@ bool NativeWindowViews::IsFocused() {
|
||||||
|
|
||||||
void NativeWindowViews::Show() {
|
void NativeWindowViews::Show() {
|
||||||
window_->native_widget_private()->ShowWithWindowState(GetRestoredState());
|
window_->native_widget_private()->ShowWithWindowState(GetRestoredState());
|
||||||
|
|
||||||
|
#if defined(USE_X11)
|
||||||
|
if (global_menu_bar_)
|
||||||
|
global_menu_bar_->OnWindowMapped();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::ShowInactive() {
|
void NativeWindowViews::ShowInactive() {
|
||||||
window_->ShowInactive();
|
window_->ShowInactive();
|
||||||
|
|
||||||
|
#if defined(USE_X11)
|
||||||
|
if (global_menu_bar_)
|
||||||
|
global_menu_bar_->OnWindowMapped();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowViews::Hide() {
|
void NativeWindowViews::Hide() {
|
||||||
window_->Hide();
|
window_->Hide();
|
||||||
|
|
||||||
|
#if defined(USE_X11)
|
||||||
|
if (global_menu_bar_)
|
||||||
|
global_menu_bar_->OnWindowUnmapped();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NativeWindowViews::IsVisible() {
|
bool NativeWindowViews::IsVisible() {
|
||||||
|
|
|
@ -210,6 +210,14 @@ void GlobalMenuBarX11::InitServer(gfx::AcceleratedWidget xid) {
|
||||||
server_ = server_new(path.c_str());
|
server_ = server_new(path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GlobalMenuBarX11::OnWindowMapped() {
|
||||||
|
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowMapped(xid_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GlobalMenuBarX11::OnWindowUnmapped() {
|
||||||
|
GlobalMenuBarRegistrarX11::GetInstance()->OnWindowUnmapped(xid_);
|
||||||
|
}
|
||||||
|
|
||||||
void GlobalMenuBarX11::BuildMenuFromModel(ui::MenuModel* model,
|
void GlobalMenuBarX11::BuildMenuFromModel(ui::MenuModel* model,
|
||||||
DbusmenuMenuitem* parent) {
|
DbusmenuMenuitem* parent) {
|
||||||
for (int i = 0; i < model->GetItemCount(); ++i) {
|
for (int i = 0; i < model->GetItemCount(); ++i) {
|
||||||
|
|
|
@ -46,6 +46,10 @@ class GlobalMenuBarX11 {
|
||||||
void SetMenu(ui::MenuModel* menu_model);
|
void SetMenu(ui::MenuModel* menu_model);
|
||||||
bool IsServerStarted() const;
|
bool IsServerStarted() const;
|
||||||
|
|
||||||
|
// Called by NativeWindow when it show/hides.
|
||||||
|
void OnWindowMapped();
|
||||||
|
void OnWindowUnmapped();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Creates a DbusmenuServer.
|
// Creates a DbusmenuServer.
|
||||||
void InitServer(gfx::AcceleratedWidget xid);
|
void InitServer(gfx::AcceleratedWidget xid);
|
||||||
|
|
Loading…
Add table
Reference in a new issue