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

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc

Issue 543663003: Fix maximize on some window managers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1fd497f8b0197acafe82684fec3ffbc2739a1352..d82843a4072eec9ca3d038e24f53c64f879f9194 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
@@ -138,6 +138,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
is_fullscreen_(false),
is_always_on_top_(false),
use_native_frame_(false),
+ should_maximize_after_map_(false),
use_argb_visual_(false),
drag_drop_client_(NULL),
native_widget_delegate_(native_widget_delegate),
@@ -366,9 +367,6 @@ void DesktopWindowTreeHostX11::ShowWindowWithState(
if (show_state == ui::SHOW_STATE_NORMAL ||
show_state == ui::SHOW_STATE_MAXIMIZED) {
- // Note: XFCE ignores a maximize hint given before mapping the window.
- if (show_state == ui::SHOW_STATE_MAXIMIZED)
- Maximize();
Activate();
}
@@ -541,6 +539,10 @@ void DesktopWindowTreeHostX11::Maximize() {
SetBounds(adjusted_bounds);
}
+ // Some WMs do not respect maximization hints on unmapped windows, so we
+ // save this one for later too.
+ should_maximize_after_map_ = !window_mapped_;
+
// When we are in the process of requesting to maximize a window, we can
// accurately keep track of our restored bounds instead of relying on the
// heuristics that are in the PropertyNotify and ConfigureNotify handlers.
@@ -559,6 +561,7 @@ void DesktopWindowTreeHostX11::Minimize() {
}
void DesktopWindowTreeHostX11::Restore() {
+ should_maximize_after_map_ = false;
Elliot Glaysher 2014/09/04 17:37:04 This seems fragile. Could you please test in the
Arjan van Leeuwen 2014/09/05 11:23:26 You can't restore the window through the window ma
SetWMSpecState(false,
atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"),
atom_cache_.GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ"));
@@ -1583,6 +1586,13 @@ void DesktopWindowTreeHostX11::MapWindow(ui::WindowShowState show_state) {
if (ui::X11EventSource::GetInstance())
ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_);
window_mapped_ = true;
+
+ // 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_) {
+ Maximize();
+ should_maximize_after_map_ = false;
+ }
}
void DesktopWindowTreeHostX11::SetWindowTransparency() {
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698