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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 SetWindowIcons(gfx::ImageSkia(), *window_icon); | 1173 SetWindowIcons(gfx::ImageSkia(), *window_icon); |
1174 } | 1174 } |
1175 CreateCompositor(GetAcceleratedWidget()); | 1175 CreateCompositor(GetAcceleratedWidget()); |
1176 } | 1176 } |
1177 | 1177 |
1178 void DesktopWindowTreeHostX11::OnWMStateUpdated() { | 1178 void DesktopWindowTreeHostX11::OnWMStateUpdated() { |
1179 std::vector< ::Atom> atom_list; | 1179 std::vector< ::Atom> atom_list; |
1180 if (!ui::GetAtomArrayProperty(xwindow_, "_NET_WM_STATE", &atom_list)) | 1180 if (!ui::GetAtomArrayProperty(xwindow_, "_NET_WM_STATE", &atom_list)) |
1181 return; | 1181 return; |
1182 | 1182 |
| 1183 bool was_minimized = IsMinimized(); |
| 1184 |
1183 window_properties_.clear(); | 1185 window_properties_.clear(); |
1184 std::copy(atom_list.begin(), atom_list.end(), | 1186 std::copy(atom_list.begin(), atom_list.end(), |
1185 inserter(window_properties_, window_properties_.begin())); | 1187 inserter(window_properties_, window_properties_.begin())); |
1186 | 1188 |
| 1189 // Propagate the window minimization information to the content window, so |
| 1190 // the render side can update its visibility properly. OnWMStateUpdated() is |
| 1191 // called by PropertyNofify event from DispatchEvent() when the browser is |
| 1192 // minimized or shown from minimized state. On Windows, this is realized by |
| 1193 // calling OnHostResized() with an empty size. In particular, |
| 1194 // HWNDMessageHandler::GetClientAreaBounds() returns an empty size when the |
| 1195 // window is minimized. On Linux, returning empty size in GetBounds() or |
| 1196 // SetBounds() does not work. |
| 1197 bool is_minimized = IsMinimized(); |
| 1198 if (is_minimized != was_minimized) { |
| 1199 if (is_minimized) |
| 1200 content_window_->Hide(); |
| 1201 else |
| 1202 content_window_->Show(); |
| 1203 } |
| 1204 |
1187 if (restored_bounds_.IsEmpty()) { | 1205 if (restored_bounds_.IsEmpty()) { |
1188 DCHECK(!IsFullscreen()); | 1206 DCHECK(!IsFullscreen()); |
1189 if (IsMaximized()) { | 1207 if (IsMaximized()) { |
1190 // The request that we become maximized originated from a different | 1208 // The request that we become maximized originated from a different |
1191 // process. |bounds_| already contains our maximized bounds. Do a best | 1209 // process. |bounds_| already contains our maximized bounds. Do a best |
1192 // effort attempt to get restored bounds by setting it to our previously | 1210 // effort attempt to get restored bounds by setting it to our previously |
1193 // set bounds (and if we get this wrong, we aren't any worse off since | 1211 // set bounds (and if we get this wrong, we aren't any worse off since |
1194 // we'd otherwise be returning our maximized bounds). | 1212 // we'd otherwise be returning our maximized bounds). |
1195 restored_bounds_ = previous_bounds_; | 1213 restored_bounds_ = previous_bounds_; |
1196 } | 1214 } |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 if (linux_ui) { | 1805 if (linux_ui) { |
1788 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1806 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
1789 if (native_theme) | 1807 if (native_theme) |
1790 return native_theme; | 1808 return native_theme; |
1791 } | 1809 } |
1792 | 1810 |
1793 return ui::NativeTheme::instance(); | 1811 return ui::NativeTheme::instance(); |
1794 } | 1812 } |
1795 | 1813 |
1796 } // namespace views | 1814 } // namespace views |
OLD | NEW |