Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 340783004: visibility bug fix for https://crbug.com/246844 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comments with the solution for windows. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 (was_minimized == false && is_minimized == true) {
1199 content_window_->Hide();
1200 } else if (was_minimized == true && is_minimized == false) {
1201 content_window_->Show();
1202 }
pkotwicz 2014/06/19 22:50:36 I think a structure like this would be slightly ni
Zhen Wang 2014/06/19 23:02:24 Indeed. Updated. On 2014/06/19 22:50:36, pkotwicz
1203
1187 if (restored_bounds_.IsEmpty()) { 1204 if (restored_bounds_.IsEmpty()) {
1188 DCHECK(!IsFullscreen()); 1205 DCHECK(!IsFullscreen());
1189 if (IsMaximized()) { 1206 if (IsMaximized()) {
1190 // The request that we become maximized originated from a different 1207 // The request that we become maximized originated from a different
1191 // process. |bounds_| already contains our maximized bounds. Do a best 1208 // process. |bounds_| already contains our maximized bounds. Do a best
1192 // effort attempt to get restored bounds by setting it to our previously 1209 // 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 1210 // set bounds (and if we get this wrong, we aren't any worse off since
1194 // we'd otherwise be returning our maximized bounds). 1211 // we'd otherwise be returning our maximized bounds).
1195 restored_bounds_ = previous_bounds_; 1212 restored_bounds_ = previous_bounds_;
1196 } 1213 }
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 if (linux_ui) { 1804 if (linux_ui) {
1788 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); 1805 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window);
1789 if (native_theme) 1806 if (native_theme)
1790 return native_theme; 1807 return native_theme;
1791 } 1808 }
1792 1809
1793 return ui::NativeTheme::instance(); 1810 return ui::NativeTheme::instance();
1794 } 1811 }
1795 1812
1796 } // namespace views 1813 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698