summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/gtk
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-22 15:47:39 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-22 15:47:39 +0000
commit400eaf8568057c158aaf8f0bf2d1095498791af4 (patch)
treea21011a58f29e3e790ead3b94ed7d249256f3b93 /chrome/browser/ui/gtk
parentbe128cfc576f164873323bb28dd8939c183af84f (diff)
downloadchromium_src-400eaf8568057c158aaf8f0bf2d1095498791af4.zip
chromium_src-400eaf8568057c158aaf8f0bf2d1095498791af4.tar.gz
chromium_src-400eaf8568057c158aaf8f0bf2d1095498791af4.tar.bz2
Restoring a session should restore window minimization state
Extends session service to support more generalized "show" state encompassing maximized, minimized, and normal window states. This includes forward-migration logic from old stored session data. Mac changes to save and restore minimized windows as well as fixes for window position. Linux/GTK changes to save and restore minimized windows. Windows/Views changes to follow. BUG=43274 TEST=Manual. SessionServiceTest.* Review URL: http://codereview.chromium.org/7621061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/gtk')
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.cc23
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.h9
2 files changed, 24 insertions, 8 deletions
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index 4b4dea8..3b7219f 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) {
@@ -646,9 +646,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
@@ -837,6 +840,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();
}
@@ -1602,7 +1609,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
@@ -1891,8 +1898,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
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h
index c7fd581..ecb2e3c 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.h
+++ b/chrome/browser/ui/gtk/browser_window_gtk.h
@@ -18,6 +18,7 @@
#include "chrome/browser/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/browser_window.h"
#include "ui/base/gtk/gtk_signal.h"
+#include "ui/base/ui_base_types.h"
#include "ui/base/x/active_window_watcher_x.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/rect.h"
@@ -76,6 +77,7 @@ class BrowserWindowGtk : public BrowserWindow,
virtual gfx::Rect GetRestoredBounds() const;
virtual gfx::Rect GetBounds() const;
virtual bool IsMaximized() const;
+ virtual bool IsMinimized() const;
virtual void SetFullscreen(bool fullscreen);
virtual bool IsFullscreen() const;
virtual bool IsFullscreenBubbleVisible() const;
@@ -491,9 +493,10 @@ class BrowserWindowGtk : public BrowserWindow,
guint32 last_click_time_;
gfx::Point last_click_position_;
- // If true, maximize the window after we call BrowserWindow::Show for the
- // first time. This is to work around a compiz bug.
- bool maximize_after_show_;
+ // Optionally maximize or minimize the window after we call
+ // BrowserWindow::Show for the first time. This is to work around a compiz
+ // bug.
+ ui::WindowShowState show_state_after_show_;
// If true, don't call gdk_window_raise() when we get a click in the title
// bar or window border. This is to work around a compiz bug.