Chromium Code Reviews| Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| index 3b848bc9ddb9aa899dc8eaf96f30a0a97998e5b1..920e0a31bb0d20d3ace1c2ad8b6981818f5b1cce 100644 |
| --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc |
| @@ -188,7 +188,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( |
| x_root_window_(DefaultRootWindow(xdisplay_)), |
| atom_cache_(xdisplay_, kAtomsToCache), |
| window_mapped_(false), |
| - wait_for_unmap_(false), |
| + is_visible_(false), |
| is_fullscreen_(false), |
| is_always_on_top_(false), |
| use_native_frame_(false), |
| @@ -593,7 +593,7 @@ void DesktopWindowTreeHostX11::ShowMaximizedWithBounds( |
| } |
| bool DesktopWindowTreeHostX11::IsVisible() const { |
| - return window_mapped_ && !wait_for_unmap_; |
| + return is_visible_; |
| } |
| void DesktopWindowTreeHostX11::SetSize(const gfx::Size& requested_size) { |
| @@ -1214,7 +1214,7 @@ void DesktopWindowTreeHostX11::ShowImpl() { |
| void DesktopWindowTreeHostX11::HideImpl() { |
| if (IsVisible()) { |
| XWithdrawWindow(xdisplay_, xwindow_, 0); |
|
Daniel Erat
2017/03/09 15:07:22
this also unmaps the window, right? is there a rea
Tom (Use chromium acct)
2017/03/10 01:29:57
Before, we had wait_for_unmap_ that sort of did th
|
| - wait_for_unmap_ = true; |
| + is_visible_ = false; |
| } |
| native_widget_delegate_->OnNativeWidgetVisibilityChanged(false); |
| } |
| @@ -1232,9 +1232,12 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( |
| XWindowChanges changes = {0}; |
| unsigned value_mask = 0; |
| - delayed_resize_task_.Cancel(); |
| if (size_changed) { |
| + // Only cancel the delayed resize task if we're already about to call |
| + // OnHostResized in this function. |
| + delayed_resize_task_.Cancel(); |
| + |
| // Update the minimum and maximum sizes in case they have changed. |
| UpdateMinAndMaxSize(); |
| @@ -1654,9 +1657,6 @@ void DesktopWindowTreeHostX11::OnFrameExtentsUpdated() { |
| } |
| void DesktopWindowTreeHostX11::UpdateMinAndMaxSize() { |
| - if (!IsVisible()) |
| - return; |
| - |
| gfx::Size minimum_in_pixels = |
| ToPixelRect(gfx::Rect(native_widget_delegate_->GetMinimumSize())).size(); |
| gfx::Size maximum_in_pixels = |
| @@ -1927,19 +1927,10 @@ void DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState show_state) { |
| ui::X11EventSource* event_source = ui::X11EventSource::GetInstance(); |
| DCHECK(event_source); |
| - if (wait_for_unmap_) { |
| - // Block until our window is unmapped. This avoids a race condition when |
| - // remapping an unmapped window. |
| - event_source->BlockUntilWindowUnmapped(xwindow_); |
| - DCHECK(!wait_for_unmap_); |
| - } |
| + UpdateMinAndMaxSize(); |
| XMapWindow(xdisplay_, xwindow_); |
| - |
| - // We now block until our window is mapped. Some X11 APIs will crash and |
| - // burn if passed |xwindow_| before the window is mapped, and XMapWindow is |
| - // asynchronous. |
| - event_source->BlockUntilWindowMapped(xwindow_); |
| + is_visible_ = true; |
| } |
| void DesktopWindowTreeHostX11::SetWindowTransparency() { |
| @@ -2167,8 +2158,6 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( |
| for (DesktopWindowTreeHostObserverX11& observer : observer_list_) |
| observer.OnWindowMapped(xwindow_); |
| - UpdateMinAndMaxSize(); |
| - |
| // Some WMs only respect maximize hints after the window has been mapped. |
| // Check whether we need to re-do a maximization. |
| if (should_maximize_after_map_) { |
| @@ -2180,7 +2169,6 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( |
| } |
| case UnmapNotify: { |
| window_mapped_ = false; |
| - wait_for_unmap_ = false; |
| has_pointer_ = false; |
| has_pointer_grab_ = false; |
| has_pointer_focus_ = false; |