summaryrefslogtreecommitdiffstats
path: root/views/window
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-01 15:26:06 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-01 15:26:06 +0000
commitc28f7c6db2a9592834cdbe7b4537644323964608 (patch)
treebde2d909fb32d4adb433604f911a74e0066d6e05 /views/window
parentd42098a2cbb81f550df12cd8180acc49510ff555 (diff)
downloadchromium_src-c28f7c6db2a9592834cdbe7b4537644323964608.zip
chromium_src-c28f7c6db2a9592834cdbe7b4537644323964608.tar.gz
chromium_src-c28f7c6db2a9592834cdbe7b4537644323964608.tar.bz2
Move Fullscreen API onto Widget.
BUG=72040 TEST=none Review URL: http://codereview.chromium.org/7105003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/window')
-rw-r--r--views/window/native_window.h2
-rw-r--r--views/window/native_window_gtk.cc11
-rw-r--r--views/window/native_window_gtk.h2
-rw-r--r--views/window/native_window_views.cc8
-rw-r--r--views/window/native_window_views.h2
-rw-r--r--views/window/native_window_win.cc85
-rw-r--r--views/window/native_window_win.h32
-rw-r--r--views/window/window.cc8
-rw-r--r--views/window/window.h4
9 files changed, 1 insertions, 153 deletions
diff --git a/views/window/native_window.h b/views/window/native_window.h
index e029718..1decf93 100644
--- a/views/window/native_window.h
+++ b/views/window/native_window.h
@@ -89,8 +89,6 @@ class NativeWindow {
// Window pass-thrus ---------------------------------------------------------
// See documentation in window.h
- virtual void SetFullscreen(bool fullscreen) = 0;
- virtual bool IsFullscreen() const = 0;
virtual void SetUseDragFrame(bool use_drag_frame) = 0;
virtual NonClientFrameView* CreateFrameViewForWindow() = 0;
virtual void UpdateFrameAfterFrameChange() = 0;
diff --git a/views/window/native_window_gtk.cc b/views/window/native_window_gtk.cc
index cf09524..d01ffe4 100644
--- a/views/window/native_window_gtk.cc
+++ b/views/window/native_window_gtk.cc
@@ -285,17 +285,6 @@ const Window* NativeWindowGtk::GetWindow() const {
return delegate_->AsWindow();
}
-void NativeWindowGtk::SetFullscreen(bool fullscreen) {
- if (fullscreen)
- gtk_window_fullscreen(GetNativeWindow());
- else
- gtk_window_unfullscreen(GetNativeWindow());
-}
-
-bool NativeWindowGtk::IsFullscreen() const {
- return window_state_ & GDK_WINDOW_STATE_FULLSCREEN;
-}
-
void NativeWindowGtk::SetUseDragFrame(bool use_drag_frame) {
NOTIMPLEMENTED();
}
diff --git a/views/window/native_window_gtk.h b/views/window/native_window_gtk.h
index 6516b33..776356b 100644
--- a/views/window/native_window_gtk.h
+++ b/views/window/native_window_gtk.h
@@ -61,8 +61,6 @@ class NativeWindowGtk : public NativeWidgetGtk, public NativeWindow {
virtual void SetAccessibleName(const std::wstring& name) OVERRIDE;
virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
- virtual void SetFullscreen(bool fullscreen) OVERRIDE;
- virtual bool IsFullscreen() const OVERRIDE;
virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE;
virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE;
virtual void UpdateFrameAfterFrameChange() OVERRIDE;
diff --git a/views/window/native_window_views.cc b/views/window/native_window_views.cc
index 21addf3..b37e9d3 100644
--- a/views/window/native_window_views.cc
+++ b/views/window/native_window_views.cc
@@ -85,14 +85,6 @@ void NativeWindowViews::SetAccessibleState(
ui::AccessibilityTypes::State state) {
}
-void NativeWindowViews::SetFullscreen(bool fullscreen) {
-}
-
-bool NativeWindowViews::IsFullscreen() const {
- NOTIMPLEMENTED();
- return false;
-}
-
void NativeWindowViews::SetUseDragFrame(bool use_drag_frame) {
}
diff --git a/views/window/native_window_views.h b/views/window/native_window_views.h
index 1d1ac2d..c75d126 100644
--- a/views/window/native_window_views.h
+++ b/views/window/native_window_views.h
@@ -42,8 +42,6 @@ class NativeWindowViews : public NativeWidgetViews,
virtual void SetAccessibleName(const std::wstring& name) OVERRIDE;
virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
- virtual void SetFullscreen(bool fullscreen) OVERRIDE;
- virtual bool IsFullscreen() const OVERRIDE;
virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE;
virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE;
virtual void UpdateFrameAfterFrameChange() OVERRIDE;
diff --git a/views/window/native_window_win.cc b/views/window/native_window_win.cc
index 0b3e0d1d..9d12226 100644
--- a/views/window/native_window_win.cc
+++ b/views/window/native_window_win.cc
@@ -182,13 +182,11 @@ NativeWindowWin::NativeWindowWin(internal::NativeWindowDelegate* delegate)
delegate_(delegate),
focus_on_creation_(true),
restored_enabled_(false),
- fullscreen_(false),
is_active_(false),
lock_updates_(false),
saved_window_style_(0),
ignore_window_pos_changes_(false),
ignore_pos_changes_factory_(this),
- force_hidden_count_(0),
is_right_mouse_pressed_on_caption_(false),
last_monitor_(NULL) {
is_window_ = true;
@@ -198,8 +196,6 @@ NativeWindowWin::NativeWindowWin(internal::NativeWindowDelegate* delegate)
set_window_ex_style(0);
}
-
-
NativeWindowWin::~NativeWindowWin() {
}
@@ -226,18 +222,6 @@ void NativeWindowWin::Show(int show_state) {
SetInitialFocus();
}
-void NativeWindowWin::PushForceHidden() {
- if (force_hidden_count_++ == 0)
- Hide();
-}
-
-void NativeWindowWin::PopForceHidden() {
- if (--force_hidden_count_ <= 0) {
- force_hidden_count_ = 0;
- ShowWindow(SW_SHOW);
- }
-}
-
// static
gfx::Font NativeWindowWin::GetWindowTitleFont() {
NONCLIENTMETRICS ncm;
@@ -848,12 +832,6 @@ void NativeWindowWin::OnSysCommand(UINT notification_code, CPoint click) {
}
void NativeWindowWin::OnWindowPosChanging(WINDOWPOS* window_pos) {
- if (force_hidden_count_) {
- // Prevent the window from being made visible if we've been asked to do so.
- // See comment in header as to why we might want this.
- window_pos->flags &= ~SWP_SHOWWINDOW;
- }
-
if (ignore_window_pos_changes_) {
// If somebody's trying to toggle our visibility, change the nonclient area,
// change our Z-order, or activate us, we should probably let it go through.
@@ -872,7 +850,7 @@ void NativeWindowWin::OnWindowPosChanging(WINDOWPOS* window_pos) {
GetMonitorAndRects(window_rect, &monitor, &monitor_rect, &work_area)) {
if (monitor && (monitor == last_monitor_) &&
(IsFullscreen() || ((monitor_rect == last_monitor_rect_) &&
- (work_area != last_work_area_)))) {
+ (work_area != last_work_area_)))) {
// A rect for the monitor we're on changed. Normally Windows notifies
// us about this (and thus we're reaching here due to the SetWindowPos()
// call in OnSettingChange() above), but with some software (e.g.
@@ -1115,67 +1093,6 @@ void NativeWindowWin::SetAccessibleState(ui::AccessibilityTypes::State state) {
}
}
-void NativeWindowWin::SetFullscreen(bool fullscreen) {
- if (fullscreen_ == fullscreen)
- return; // Nothing to do.
-
- // Reduce jankiness during the following position changes by hiding the window
- // until it's in the final position.
- PushForceHidden();
-
- // Size/position/style window appropriately.
- if (!fullscreen_) {
- // Save current window information. We force the window into restored mode
- // before going fullscreen because Windows doesn't seem to hide the
- // taskbar if the window is in the maximized state.
- saved_window_info_.maximized = IsMaximized();
- if (saved_window_info_.maximized)
- Restore();
- saved_window_info_.style = GetWindowLong(GWL_STYLE);
- saved_window_info_.ex_style = GetWindowLong(GWL_EXSTYLE);
- GetWindowRect(&saved_window_info_.window_rect);
- }
-
- // Toggle fullscreen mode.
- fullscreen_ = fullscreen;
-
- if (fullscreen_) {
- // Set new window style and size.
- MONITORINFO monitor_info;
- monitor_info.cbSize = sizeof(monitor_info);
- GetMonitorInfo(MonitorFromWindow(GetNativeView(), MONITOR_DEFAULTTONEAREST),
- &monitor_info);
- gfx::Rect monitor_rect(monitor_info.rcMonitor);
- SetWindowLong(GWL_STYLE,
- saved_window_info_.style & ~(WS_CAPTION | WS_THICKFRAME));
- SetWindowLong(GWL_EXSTYLE,
- saved_window_info_.ex_style & ~(WS_EX_DLGMODALFRAME |
- WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
- SetWindowPos(NULL, monitor_rect.x(), monitor_rect.y(),
- monitor_rect.width(), monitor_rect.height(),
- SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
- } else {
- // Reset original window style and size. The multiple window size/moves
- // here are ugly, but if SetWindowPos() doesn't redraw, the taskbar won't be
- // repainted. Better-looking methods welcome.
- gfx::Rect new_rect(saved_window_info_.window_rect);
- SetWindowLong(GWL_STYLE, saved_window_info_.style);
- SetWindowLong(GWL_EXSTYLE, saved_window_info_.ex_style);
- SetWindowPos(NULL, new_rect.x(), new_rect.y(), new_rect.width(),
- new_rect.height(),
- SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
- if (saved_window_info_.maximized)
- Maximize();
- }
-
- // Undo our anti-jankiness hacks.
- PopForceHidden();
-}
-
-bool NativeWindowWin::IsFullscreen() const {
- return fullscreen_;
-}
-
void NativeWindowWin::SetUseDragFrame(bool use_drag_frame) {
if (use_drag_frame) {
// Make the frame slightly transparent during the drag operation.
diff --git a/views/window/native_window_win.h b/views/window/native_window_win.h
index a79025b..df374d2 100644
--- a/views/window/native_window_win.h
+++ b/views/window/native_window_win.h
@@ -55,15 +55,6 @@ class NativeWindowWin : public NativeWidgetWin,
focus_on_creation_ = focus_on_creation;
}
- // Hides the window if it hasn't already been force-hidden. The force hidden
- // count is tracked, so calling multiple times is allowed, you just have to
- // be sure to call PopForceHidden the same number of times.
- void PushForceHidden();
-
- // Decrements the force hidden count, showing the window if we have reached
- // the top of the stack. See PushForceHidden.
- void PopForceHidden();
-
// Returns the system set window title font.
static gfx::Font GetWindowTitleFont();
@@ -149,8 +140,6 @@ class NativeWindowWin : public NativeWidgetWin,
virtual void SetAccessibleName(const std::wstring& name) OVERRIDE;
virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
- virtual void SetFullscreen(bool fullscreen) OVERRIDE;
- virtual bool IsFullscreen() const OVERRIDE;
virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE;
virtual NonClientFrameView* CreateFrameViewForWindow() OVERRIDE;
virtual void UpdateFrameAfterFrameChange() OVERRIDE;
@@ -161,15 +150,6 @@ class NativeWindowWin : public NativeWidgetWin,
virtual bool IsActive() const OVERRIDE;
private:
- // Information saved before going into fullscreen mode, used to restore the
- // window afterwards.
- struct SavedWindowInfo {
- bool maximized;
- LONG style;
- LONG ex_style;
- RECT window_rect;
- };
-
// If necessary, enables all ancestors.
void RestoreEnabledIfNecessary();
@@ -212,12 +192,6 @@ class NativeWindowWin : public NativeWidgetWin,
// true.
bool restored_enabled_;
- // True if we're in fullscreen mode.
- bool fullscreen_;
-
- // Saved window information from before entering fullscreen mode.
- SavedWindowInfo saved_window_info_;
-
// True if this window is the active top level window.
bool is_active_;
@@ -236,12 +210,6 @@ class NativeWindowWin : public NativeWidgetWin,
// periods.
ScopedRunnableMethodFactory<NativeWindowWin> ignore_pos_changes_factory_;
- // If this is greater than zero, we should prevent attempts to make the window
- // visible when we handle WM_WINDOWPOSCHANGING. Some calls like
- // ShowWindow(SW_RESTORE) make the window visible in addition to restoring it,
- // when all we want to do is restore it.
- int force_hidden_count_;
-
// Set to true when the user presses the right mouse button on the caption
// area. We need this so we can correctly show the context menu on mouse-up.
bool is_right_mouse_pressed_on_caption_;
diff --git a/views/window/window.cc b/views/window/window.cc
index ca9519f..29e482c 100644
--- a/views/window/window.cc
+++ b/views/window/window.cc
@@ -116,14 +116,6 @@ void Window::DisableInactiveRendering() {
non_client_view_->DisableInactiveRendering(disable_inactive_rendering_);
}
-void Window::SetFullscreen(bool fullscreen) {
- native_window_->SetFullscreen(fullscreen);
-}
-
-bool Window::IsFullscreen() const {
- return native_window_->IsFullscreen();
-}
-
void Window::SetUseDragFrame(bool use_drag_frame) {
native_window_->SetUseDragFrame(use_drag_frame);
}
diff --git a/views/window/window.h b/views/window/window.h
index ddd8789..5bdfcc2 100644
--- a/views/window/window.h
+++ b/views/window/window.h
@@ -88,10 +88,6 @@ class Window : public Widget,
// leads to sync problems.
void DisableInactiveRendering();
- // Accessors for fullscreen state.
- void SetFullscreen(bool fullscreen);
- bool IsFullscreen() const;
-
// Sets whether or not the window should show its frame as a "transient drag
// frame" - slightly transparent and without the standard window controls.
void SetUseDragFrame(bool use_drag_frame);