diff options
Diffstat (limited to 'ui/views/widget')
-rw-r--r-- | ui/views/widget/native_widget_win.cc | 72 | ||||
-rw-r--r-- | ui/views/widget/native_widget_win.h | 22 |
2 files changed, 12 insertions, 82 deletions
diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index b143228..d7a98f0 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -422,7 +422,6 @@ NativeWidgetWin::NativeWidgetWin(internal::NativeWidgetDelegate* delegate) accessibility_view_events_(kMaxAccessibilityViewEvents), previous_cursor_(NULL), fullscreen_(false), - metro_snap_(false), force_hidden_count_(0), lock_updates_count_(0), ignore_window_pos_changes_(false), @@ -991,40 +990,7 @@ void NativeWidgetWin::Restore() { void NativeWidgetWin::SetFullscreen(bool fullscreen) { if (fullscreen_ == fullscreen) - return; - - gfx::Rect window_rect; - if (fullscreen) { - MONITORINFO monitor_info; - monitor_info.cbSize = sizeof(monitor_info); - GetMonitorInfo(MonitorFromWindow(GetNativeView(), MONITOR_DEFAULTTONEAREST), - &monitor_info); - window_rect = monitor_info.rcMonitor; - } - - SetFullscreenInternal(fullscreen, window_rect); -} - -void NativeWidgetWin::SetMetroSnapFullscreen(bool metro_snap) { - if (metro_snap_ == metro_snap) - return; - - metro_snap_ = metro_snap; - - gfx::Rect window_rect; - if (!metro_snap) { - MONITORINFO monitor_info; - monitor_info.cbSize = sizeof(monitor_info); - GetMonitorInfo(MonitorFromWindow(GetNativeView(), MONITOR_DEFAULTTONEAREST), - &monitor_info); - window_rect = monitor_info.rcMonitor; - } - - SetFullscreenInternal(metro_snap, window_rect); -} - -void NativeWidgetWin::SetFullscreenInternal(bool fullscreen, - const gfx::Rect& window_rect) { + return; // Nothing to do. // Reduce jankiness during the following position changes by hiding the window // until it's in the final position. @@ -1047,35 +1013,26 @@ void NativeWidgetWin::SetFullscreenInternal(bool 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)); - - // On expand, if we're given a window_rect, grow to it, otherwise do - // not resize. - if (window_rect.width() > 0) { - SetWindowPos(NULL, window_rect.x(), window_rect.y(), - window_rect.width(), window_rect.height(), - SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); - } + 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); - - // On restore, if we're given a window_rect resize to that, otherwise - // resize to the previous saved rect size. - gfx::Rect new_rect; - if (window_rect.width() > 0) { - new_rect = window_rect; - } else { - new_rect = saved_window_info_.window_rect; - } - SetWindowPos(NULL, new_rect.x(), new_rect.y(), new_rect.width(), new_rect.height(), SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); @@ -1091,10 +1048,6 @@ bool NativeWidgetWin::IsFullscreen() const { return fullscreen_; } -bool NativeWidgetWin::IsInMetroSnapMode() const { - return metro_snap_; -} - void NativeWidgetWin::SetOpacity(unsigned char opacity) { layered_alpha_ = static_cast<BYTE>(opacity); GetWidget()->GetRootView()->SchedulePaint(); @@ -2154,10 +2107,9 @@ void NativeWidgetWin::OnWindowPosChanging(WINDOWPOS* window_pos) { gfx::Rect monitor_rect, work_area; if (GetWindowRect(&window_rect) && GetMonitorAndRects(window_rect, &monitor, &monitor_rect, &work_area)) { - bool work_area_changed = (monitor_rect == last_monitor_rect_) && - (work_area != last_work_area_); if (monitor && (monitor == last_monitor_) && - ((IsFullscreen() && !metro_snap_) || work_area_changed)) { + (IsFullscreen() || ((monitor_rect == last_monitor_rect_) && + (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. diff --git a/ui/views/widget/native_widget_win.h b/ui/views/widget/native_widget_win.h index 868c24b..d584390 100644 --- a/ui/views/widget/native_widget_win.h +++ b/ui/views/widget/native_widget_win.h @@ -115,13 +115,6 @@ class VIEWS_EXPORT NativeWidgetWin : public ui::WindowImpl, // the top of the stack. See PushForceHidden. void PopForceHidden(); - // Places the window in a pseudo-fullscreen mode where it looks and acts as - // like a fullscreen window except that it remains within the boundaries - // of the metro snap divider. - void SetMetroSnapFullscreen(bool metro_snap); - - bool IsInMetroSnapMode() const; - BOOL IsWindow() const { return ::IsWindow(GetNativeView()); } @@ -538,18 +531,6 @@ class VIEWS_EXPORT NativeWidgetWin : public ui::WindowImpl, // Overridden from internal::InputMethodDelegate virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; - // Common implementation of fullscreen-related code. This method handles - // changing from windowed mode to a display mode (dubbed fullscreen mode) - // where the window occupies a fixed portion (possibly 100%) of the screen. - // |fullscreen| specifies whether we are entering or leaving fullscreen mode. - // |window_rect| contains sizing information that describes the portion of the - // screen to be occupied. |window_rect| may be a rect of width - // 0, which indicates that sizing should be skipped when - // entering fullscreen mode and previously-stored size should - // be used when exiting fullscreen mode. - void SetFullscreenInternal(bool fullscreen, - const gfx::Rect& window_rect); - // A delegate implementation that handles events received here. // See class documentation for Widget in widget.h for a note about ownership. internal::NativeWidgetDelegate* delegate_; @@ -631,9 +612,6 @@ class VIEWS_EXPORT NativeWidgetWin : public ui::WindowImpl, // True if we're in fullscreen mode. bool fullscreen_; - // True if we're in metro snap mode. - bool metro_snap_; - // 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, |