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

Unified Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

Issue 7621061: Restoring a session should restore window minimization state (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing Mark's comments. Created 9 years, 4 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 | « chrome/browser/ui/gtk/browser_window_gtk.h ('k') | chrome/browser/ui/panels/panel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/browser_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index 608d770d7c17c715f68e98c67d48c219029cf42b..41588802434741b03307c450da415428b9688624 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -324,7 +324,7 @@ BrowserWindowGtk::BrowserWindowGtk(Browser* browser)
frame_cursor_(NULL),
is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()),
last_click_time_(0),
- maximize_after_show_(false),
+ show_state_after_show_(ui::SHOW_STATE_DEFAULT),
suppress_window_raise_(false),
accel_group_(NULL),
debounce_timer_disabled_(false) {
@@ -645,9 +645,12 @@ void BrowserWindowGtk::Show() {
BrowserList::SetLastActive(browser());
gtk_window_present(window_);
- if (maximize_after_show_) {
+ if (show_state_after_show_ == ui::SHOW_STATE_MAXIMIZED) {
gtk_window_maximize(window_);
- maximize_after_show_ = false;
+ show_state_after_show_ = ui::SHOW_STATE_NORMAL;
+ } else if (show_state_after_show_ == ui::SHOW_STATE_MINIMIZED) {
+ gtk_window_iconify(window_);
+ show_state_after_show_ = ui::SHOW_STATE_NORMAL;
}
// If we have sized the window by setting a size request for the render
@@ -836,6 +839,10 @@ bool BrowserWindowGtk::IsMaximized() const {
return (state_ & GDK_WINDOW_STATE_MAXIMIZED);
}
+bool BrowserWindowGtk::IsMinimized() const {
+ return (state_ & GDK_WINDOW_STATE_ICONIFIED);
+}
+
bool BrowserWindowGtk::ShouldDrawContentDropShadow() {
return !IsMaximized() && UseCustomFrame();
}
@@ -1601,7 +1608,7 @@ void BrowserWindowGtk::SetGeometryHints() {
// confused and maximizes the window, but doesn't set the
// GDK_WINDOW_STATE_MAXIMIZED bit. So instead, we keep track of whether to
// maximize and call it after gtk_window_present.
- maximize_after_show_ = browser_->GetSavedMaximizedState();
+ show_state_after_show_ = browser_->GetSavedWindowShowState();
gfx::Rect bounds = browser_->GetSavedWindowBounds();
// We don't blindly call SetBounds here: that sets a forced position
@@ -1890,8 +1897,14 @@ void BrowserWindowGtk::UpdateCustomFrame() {
void BrowserWindowGtk::SaveWindowPosition() {
// Browser::SaveWindowPlacement is used for session restore.
+ ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL;
+ if (IsMaximized())
+ show_state = ui::SHOW_STATE_MAXIMIZED;
+ else if (IsMinimized())
+ show_state = ui::SHOW_STATE_MINIMIZED;
+
if (browser_->ShouldSaveWindowPlacement())
- browser_->SaveWindowPlacement(restored_bounds_, IsMaximized());
+ browser_->SaveWindowPlacement(restored_bounds_, show_state);
// We also need to save the placement for startup.
// This is a web of calls between views and delegates on Windows, but the
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.h ('k') | chrome/browser/ui/panels/panel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698