Chromium Code Reviews| 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 bool is_minimized; | |
| 1185 | |
| 1183 window_properties_.clear(); | 1186 window_properties_.clear(); |
| 1184 std::copy(atom_list.begin(), atom_list.end(), | 1187 std::copy(atom_list.begin(), atom_list.end(), |
| 1185 inserter(window_properties_, window_properties_.begin())); | 1188 inserter(window_properties_, window_properties_.begin())); |
| 1186 | 1189 |
| 1190 // Propagate the window minimization information to the content window, so | |
| 1191 // the render side can update its visibility properly. OnWMStateUpdated() is | |
| 1192 // called by PropertyNofify event from DispatchEvent() when the browser is | |
| 1193 // minimized or shown from minimized state. | |
|
Elliot Glaysher
2014/06/19 20:09:56
If you go this route, please also mention that on
Zhen Wang
2014/06/19 22:45:01
This is just a note. I have discussed with Elliot
| |
| 1194 is_minimized = IsMinimized(); | |
|
Elliot Glaysher
2014/06/19 20:09:56
Move the declaration of bool is_minimized here, si
| |
| 1195 if (was_minimized == false && is_minimized == true) { | |
| 1196 content_window_->Hide(); | |
| 1197 } else if (was_minimized == true && is_minimized == false) { | |
| 1198 content_window_->Show(); | |
| 1199 } | |
| 1200 | |
| 1187 if (restored_bounds_.IsEmpty()) { | 1201 if (restored_bounds_.IsEmpty()) { |
| 1188 DCHECK(!IsFullscreen()); | 1202 DCHECK(!IsFullscreen()); |
| 1189 if (IsMaximized()) { | 1203 if (IsMaximized()) { |
| 1190 // The request that we become maximized originated from a different | 1204 // The request that we become maximized originated from a different |
| 1191 // process. |bounds_| already contains our maximized bounds. Do a best | 1205 // process. |bounds_| already contains our maximized bounds. Do a best |
| 1192 // effort attempt to get restored bounds by setting it to our previously | 1206 // 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 | 1207 // set bounds (and if we get this wrong, we aren't any worse off since |
| 1194 // we'd otherwise be returning our maximized bounds). | 1208 // we'd otherwise be returning our maximized bounds). |
| 1195 restored_bounds_ = previous_bounds_; | 1209 restored_bounds_ = previous_bounds_; |
| 1196 } | 1210 } |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1787 if (linux_ui) { | 1801 if (linux_ui) { |
| 1788 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1802 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 1789 if (native_theme) | 1803 if (native_theme) |
| 1790 return native_theme; | 1804 return native_theme; |
| 1791 } | 1805 } |
| 1792 | 1806 |
| 1793 return ui::NativeTheme::instance(); | 1807 return ui::NativeTheme::instance(); |
| 1794 } | 1808 } |
| 1795 | 1809 |
| 1796 } // namespace views | 1810 } // namespace views |
| OLD | NEW |