OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/win/fullscreen_handler.h" | 5 #include "ui/views/win/fullscreen_handler.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/win/win_util.h" | 8 #include "base/win/win_util.h" |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 #include "ui/views/win/scoped_fullscreen_visibility.h" | 10 #include "ui/views/win/scoped_fullscreen_visibility.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 saved_window_info_.style & ~(WS_CAPTION | WS_THICKFRAME)); | 69 saved_window_info_.style & ~(WS_CAPTION | WS_THICKFRAME)); |
70 SetWindowLong(hwnd_, GWL_EXSTYLE, | 70 SetWindowLong(hwnd_, GWL_EXSTYLE, |
71 saved_window_info_.ex_style & ~(WS_EX_DLGMODALFRAME | | 71 saved_window_info_.ex_style & ~(WS_EX_DLGMODALFRAME | |
72 WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); | 72 WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)); |
73 | 73 |
74 // On expand, if we're given a window_rect, grow to it, otherwise do | 74 // On expand, if we're given a window_rect, grow to it, otherwise do |
75 // not resize. | 75 // not resize. |
76 if (!for_metro) { | 76 if (!for_metro) { |
77 MONITORINFO monitor_info; | 77 MONITORINFO monitor_info; |
78 monitor_info.cbSize = sizeof(monitor_info); | 78 monitor_info.cbSize = sizeof(monitor_info); |
79 base::win::GetMonitorInfoWrapper( | 79 GetMonitorInfo(MonitorFromWindow(hwnd_, MONITOR_DEFAULTTONEAREST), |
80 MonitorFromWindow(hwnd_, MONITOR_DEFAULTTONEAREST), &monitor_info); | 80 &monitor_info); |
81 gfx::Rect window_rect(monitor_info.rcMonitor); | 81 gfx::Rect window_rect(monitor_info.rcMonitor); |
82 SetWindowPos(hwnd_, NULL, window_rect.x(), window_rect.y(), | 82 SetWindowPos(hwnd_, NULL, window_rect.x(), window_rect.y(), |
83 window_rect.width(), window_rect.height(), | 83 window_rect.width(), window_rect.height(), |
84 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); | 84 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); |
85 } | 85 } |
86 } else { | 86 } else { |
87 // Reset original window style and size. The multiple window size/moves | 87 // Reset original window style and size. The multiple window size/moves |
88 // here are ugly, but if SetWindowPos() doesn't redraw, the taskbar won't be | 88 // here are ugly, but if SetWindowPos() doesn't redraw, the taskbar won't be |
89 // repainted. Better-looking methods welcome. | 89 // repainted. Better-looking methods welcome. |
90 SetWindowLong(hwnd_, GWL_STYLE, saved_window_info_.style); | 90 SetWindowLong(hwnd_, GWL_STYLE, saved_window_info_.style); |
91 SetWindowLong(hwnd_, GWL_EXSTYLE, saved_window_info_.ex_style); | 91 SetWindowLong(hwnd_, GWL_EXSTYLE, saved_window_info_.ex_style); |
92 | 92 |
93 if (!for_metro) { | 93 if (!for_metro) { |
94 // On restore, resize to the previous saved rect size. | 94 // On restore, resize to the previous saved rect size. |
95 gfx::Rect new_rect(saved_window_info_.window_rect); | 95 gfx::Rect new_rect(saved_window_info_.window_rect); |
96 SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(), | 96 SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(), |
97 new_rect.width(), new_rect.height(), | 97 new_rect.width(), new_rect.height(), |
98 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); | 98 SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); |
99 } | 99 } |
100 if (saved_window_info_.maximized) | 100 if (saved_window_info_.maximized) |
101 ::SendMessage(hwnd_, WM_SYSCOMMAND, SC_MAXIMIZE, 0); | 101 ::SendMessage(hwnd_, WM_SYSCOMMAND, SC_MAXIMIZE, 0); |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
105 } // namespace views | 105 } // namespace views |
OLD | NEW |