Commit a607d323 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Ensure OnVisibilityChanged called in X11

Make sure OnVisibilityChanged() is called for all codepaths that affect
visibility.

Bug: 821820
Change-Id: I3a98be29a619533c09d5963f33723f62e3304b74
Reviewed-on: https://chromium-review.googlesource.com/962681Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543102}
parent 1c712d01
...@@ -518,7 +518,7 @@ aura::WindowTreeHost* DesktopWindowTreeHostX11::AsWindowTreeHost() { ...@@ -518,7 +518,7 @@ aura::WindowTreeHost* DesktopWindowTreeHostX11::AsWindowTreeHost() {
void DesktopWindowTreeHostX11::ShowWindowWithState( void DesktopWindowTreeHostX11::ShowWindowWithState(
ui::WindowShowState show_state) { ui::WindowShowState show_state) {
if (compositor()) if (compositor())
compositor()->SetVisible(true); SetVisible(true);
if (!IsVisible() || !window_mapped_in_server_) if (!IsVisible() || !window_mapped_in_server_)
MapWindow(show_state); MapWindow(show_state);
...@@ -875,6 +875,13 @@ bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const { ...@@ -875,6 +875,13 @@ bool DesktopWindowTreeHostX11::IsAlwaysOnTop() const {
return is_always_on_top_; return is_always_on_top_;
} }
void DesktopWindowTreeHostX11::SetVisible(bool visible) {
if (compositor())
compositor()->SetVisible(visible);
if (IsVisible() != visible)
native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible);
}
void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) { void DesktopWindowTreeHostX11::SetVisibleOnAllWorkspaces(bool always_visible) {
ui::SetWMSpecState(xwindow_, always_visible, ui::SetWMSpecState(xwindow_, always_visible,
gfx::GetAtom("_NET_WM_STATE_STICKY"), x11::None); gfx::GetAtom("_NET_WM_STATE_STICKY"), x11::None);
...@@ -1179,15 +1186,14 @@ gfx::AcceleratedWidget DesktopWindowTreeHostX11::GetAcceleratedWidget() { ...@@ -1179,15 +1186,14 @@ gfx::AcceleratedWidget DesktopWindowTreeHostX11::GetAcceleratedWidget() {
void DesktopWindowTreeHostX11::ShowImpl() { void DesktopWindowTreeHostX11::ShowImpl() {
ShowWindowWithState(ui::SHOW_STATE_NORMAL); ShowWindowWithState(ui::SHOW_STATE_NORMAL);
native_widget_delegate_->OnNativeWidgetVisibilityChanged(true);
} }
void DesktopWindowTreeHostX11::HideImpl() { void DesktopWindowTreeHostX11::HideImpl() {
if (IsVisible()) { if (IsVisible()) {
XWithdrawWindow(xdisplay_, xwindow_, 0); XWithdrawWindow(xdisplay_, xwindow_, 0);
window_mapped_in_client_ = false; window_mapped_in_client_ = false;
native_widget_delegate_->OnNativeWidgetVisibilityChanged(false);
} }
native_widget_delegate_->OnNativeWidgetVisibilityChanged(false);
} }
gfx::Rect DesktopWindowTreeHostX11::GetBoundsInPixels() const { gfx::Rect DesktopWindowTreeHostX11::GetBoundsInPixels() const {
...@@ -1628,11 +1634,11 @@ void DesktopWindowTreeHostX11::OnWMStateUpdated() { ...@@ -1628,11 +1634,11 @@ void DesktopWindowTreeHostX11::OnWMStateUpdated() {
// minimized. // minimized.
if (is_minimized != was_minimized) { if (is_minimized != was_minimized) {
if (is_minimized) { if (is_minimized) {
compositor()->SetVisible(false); SetVisible(false);
content_window_->Hide(); content_window_->Hide();
} else { } else {
content_window_->Show(); content_window_->Show();
compositor()->SetVisible(true); SetVisible(true);
} }
} }
......
...@@ -282,6 +282,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 ...@@ -282,6 +282,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11
// the queue) and adds it back at the end of the queue. // the queue) and adds it back at the end of the queue.
void RestartDelayedResizeTask(); void RestartDelayedResizeTask();
// Set visibility and fire OnNativeWidgetVisibilityChanged() if it changed.
void SetVisible(bool visible);
// X11 things // X11 things
// The display and the native X window hosting the root window. // The display and the native X window hosting the root window.
XDisplay* xdisplay_; XDisplay* xdisplay_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment