OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
6 | 6 |
7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 inserter(window_properties_, window_properties_.begin())); | 1237 inserter(window_properties_, window_properties_.begin())); |
1238 | 1238 |
1239 // Propagate the window minimization information to the content window, so | 1239 // Propagate the window minimization information to the content window, so |
1240 // the render side can update its visibility properly. OnWMStateUpdated() is | 1240 // the render side can update its visibility properly. OnWMStateUpdated() is |
1241 // called by PropertyNofify event from DispatchEvent() when the browser is | 1241 // called by PropertyNofify event from DispatchEvent() when the browser is |
1242 // minimized or shown from minimized state. On Windows, this is realized by | 1242 // minimized or shown from minimized state. On Windows, this is realized by |
1243 // calling OnHostResized() with an empty size. In particular, | 1243 // calling OnHostResized() with an empty size. In particular, |
1244 // HWNDMessageHandler::GetClientAreaBounds() returns an empty size when the | 1244 // HWNDMessageHandler::GetClientAreaBounds() returns an empty size when the |
1245 // window is minimized. On Linux, returning empty size in GetBounds() or | 1245 // window is minimized. On Linux, returning empty size in GetBounds() or |
1246 // SetBounds() does not work. | 1246 // SetBounds() does not work. |
| 1247 // We also propagate the minimization to the compositor, to makes sure that we |
| 1248 // don't draw any 'blank' frames that could be noticed in applications such as |
| 1249 // window manager previews, which show content even when a window is |
| 1250 // minimized. |
1247 bool is_minimized = IsMinimized(); | 1251 bool is_minimized = IsMinimized(); |
1248 if (is_minimized != was_minimized) { | 1252 if (is_minimized != was_minimized) { |
1249 if (is_minimized) | 1253 if (is_minimized) { |
| 1254 compositor()->SetVisible(false); |
1250 content_window_->Hide(); | 1255 content_window_->Hide(); |
1251 else | 1256 } else { |
1252 content_window_->Show(); | 1257 content_window_->Show(); |
| 1258 compositor()->SetVisible(true); |
| 1259 } |
1253 } | 1260 } |
1254 | 1261 |
1255 if (restored_bounds_.IsEmpty()) { | 1262 if (restored_bounds_.IsEmpty()) { |
1256 DCHECK(!IsFullscreen()); | 1263 DCHECK(!IsFullscreen()); |
1257 if (IsMaximized()) { | 1264 if (IsMaximized()) { |
1258 // The request that we become maximized originated from a different | 1265 // The request that we become maximized originated from a different |
1259 // process. |bounds_| already contains our maximized bounds. Do a best | 1266 // process. |bounds_| already contains our maximized bounds. Do a best |
1260 // effort attempt to get restored bounds by setting it to our previously | 1267 // effort attempt to get restored bounds by setting it to our previously |
1261 // set bounds (and if we get this wrong, we aren't any worse off since | 1268 // set bounds (and if we get this wrong, we aren't any worse off since |
1262 // we'd otherwise be returning our maximized bounds). | 1269 // we'd otherwise be returning our maximized bounds). |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 if (linux_ui) { | 1921 if (linux_ui) { |
1915 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1922 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
1916 if (native_theme) | 1923 if (native_theme) |
1917 return native_theme; | 1924 return native_theme; |
1918 } | 1925 } |
1919 | 1926 |
1920 return ui::NativeTheme::instance(); | 1927 return ui::NativeTheme::instance(); |
1921 } | 1928 } |
1922 | 1929 |
1923 } // namespace views | 1930 } // namespace views |
OLD | NEW |