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/hwnd_message_handler.h" | 5 #include "ui/views/win/hwnd_message_handler.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 #include <oleacc.h> | 8 #include <oleacc.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <wtsapi32.h> | 10 #include <wtsapi32.h> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return CallNextHookEx(instance_->mouse_hook_, n_code, w_param, l_param); | 140 return CallNextHookEx(instance_->mouse_hook_, n_code, w_param, l_param); |
141 } | 141 } |
142 | 142 |
143 // static | 143 // static |
144 LRESULT CALLBACK MoveLoopMouseWatcher::KeyHook(int n_code, | 144 LRESULT CALLBACK MoveLoopMouseWatcher::KeyHook(int n_code, |
145 WPARAM w_param, | 145 WPARAM w_param, |
146 LPARAM l_param) { | 146 LPARAM l_param) { |
147 if (n_code == HC_ACTION && w_param == VK_ESCAPE) { | 147 if (n_code == HC_ACTION && w_param == VK_ESCAPE) { |
148 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | 148 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { |
149 int value = TRUE; | 149 int value = TRUE; |
150 HRESULT result = DwmSetWindowAttribute( | 150 DwmSetWindowAttribute(instance_->host_->hwnd(), |
151 instance_->host_->hwnd(), | 151 DWMWA_TRANSITIONS_FORCEDISABLED, |
152 DWMWA_TRANSITIONS_FORCEDISABLED, | 152 &value, |
153 &value, | 153 sizeof(value)); |
154 sizeof(value)); | |
155 } | 154 } |
156 if (instance_->hide_on_escape_) | 155 if (instance_->hide_on_escape_) |
157 instance_->host_->Hide(); | 156 instance_->host_->Hide(); |
158 } | 157 } |
159 return CallNextHookEx(instance_->key_hook_, n_code, w_param, l_param); | 158 return CallNextHookEx(instance_->key_hook_, n_code, w_param, l_param); |
160 } | 159 } |
161 | 160 |
162 // Called from OnNCActivate. | 161 // Called from OnNCActivate. |
163 BOOL CALLBACK EnumChildWindowsForRedraw(HWND hwnd, LPARAM lparam) { | 162 BOOL CALLBACK EnumChildWindowsForRedraw(HWND hwnd, LPARAM lparam) { |
164 DWORD process_id; | 163 DWORD process_id; |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 if ((window_ex_style() & WS_EX_COMPOSITED) == 0 && !custom_window_region_ && | 1126 if ((window_ex_style() & WS_EX_COMPOSITED) == 0 && !custom_window_region_ && |
1128 (!delegate_->IsUsingCustomFrame() || !delegate_->IsWidgetWindow())) { | 1127 (!delegate_->IsUsingCustomFrame() || !delegate_->IsWidgetWindow())) { |
1129 if (force) | 1128 if (force) |
1130 SetWindowRgn(hwnd(), NULL, redraw); | 1129 SetWindowRgn(hwnd(), NULL, redraw); |
1131 return; | 1130 return; |
1132 } | 1131 } |
1133 | 1132 |
1134 // Changing the window region is going to force a paint. Only change the | 1133 // Changing the window region is going to force a paint. Only change the |
1135 // window region if the region really differs. | 1134 // window region if the region really differs. |
1136 base::win::ScopedRegion current_rgn(CreateRectRgn(0, 0, 0, 0)); | 1135 base::win::ScopedRegion current_rgn(CreateRectRgn(0, 0, 0, 0)); |
1137 int current_rgn_result = GetWindowRgn(hwnd(), current_rgn); | 1136 GetWindowRgn(hwnd(), current_rgn); |
1138 | 1137 |
1139 RECT window_rect; | 1138 RECT window_rect; |
1140 GetWindowRect(hwnd(), &window_rect); | 1139 GetWindowRect(hwnd(), &window_rect); |
1141 base::win::ScopedRegion new_region; | 1140 base::win::ScopedRegion new_region; |
1142 if (custom_window_region_) { | 1141 if (custom_window_region_) { |
1143 new_region.Set(::CreateRectRgn(0, 0, 0, 0)); | 1142 new_region.Set(::CreateRectRgn(0, 0, 0, 0)); |
1144 ::CombineRgn(new_region, custom_window_region_.Get(), NULL, RGN_COPY); | 1143 ::CombineRgn(new_region, custom_window_region_.Get(), NULL, RGN_COPY); |
1145 } else if (IsMaximized()) { | 1144 } else if (IsMaximized()) { |
1146 HMONITOR monitor = MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST); | 1145 HMONITOR monitor = MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST); |
1147 MONITORINFO mi; | 1146 MONITORINFO mi; |
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); | 2497 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); |
2499 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); | 2498 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); |
2500 } | 2499 } |
2501 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 2500 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
2502 // to notify our children too, since we can have MDI child windows who need to | 2501 // to notify our children too, since we can have MDI child windows who need to |
2503 // update their appearance. | 2502 // update their appearance. |
2504 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); | 2503 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); |
2505 } | 2504 } |
2506 | 2505 |
2507 } // namespace views | 2506 } // namespace views |
OLD | NEW |