OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/renderer_host/render_widget_host_view_win.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1277 } | 1277 } |
1278 | 1278 |
1279 ForwardMouseEventToRenderer(message, wparam, lparam); | 1279 ForwardMouseEventToRenderer(message, wparam, lparam); |
1280 return 0; | 1280 return 0; |
1281 } | 1281 } |
1282 | 1282 |
1283 LRESULT RenderWidgetHostViewWin::OnKeyEvent(UINT message, WPARAM wparam, | 1283 LRESULT RenderWidgetHostViewWin::OnKeyEvent(UINT message, WPARAM wparam, |
1284 LPARAM lparam, BOOL& handled) { | 1284 LPARAM lparam, BOOL& handled) { |
1285 handled = TRUE; | 1285 handled = TRUE; |
1286 | 1286 |
1287 // When Escape is pressed, unlock the mouse or force fullscreen windows to | |
1288 // close if necessary. | |
1289 if ((message == WM_KEYDOWN || message == WM_KEYUP) && wparam == VK_ESCAPE) { | |
1290 bool absorbed = false; | |
1291 if (mouse_locked_) { | |
1292 UnlockMouse(); | |
1293 absorbed = true; | |
1294 } | |
1295 if (is_fullscreen_) { | |
yzshen1
2011/10/15 03:25:53
This is the flash-style fullscreen. You should not
koz (OOO until 15th September)
2011/10/15 04:12:35
Done.
| |
1296 SendMessage(WM_CANCELMODE); | |
1297 absorbed = true; | |
1298 } | |
1299 if (absorbed) | |
1300 return 0; | |
1301 } | |
1302 | |
1303 // If we are a pop-up, forward tab related messages to our parent HWND, so | 1287 // If we are a pop-up, forward tab related messages to our parent HWND, so |
1304 // that we are dismissed appropriately and so that the focus advance in our | 1288 // that we are dismissed appropriately and so that the focus advance in our |
1305 // parent. | 1289 // parent. |
1306 // TODO(jcampan): http://b/issue?id=1192881 Could be abstracted in the | 1290 // TODO(jcampan): http://b/issue?id=1192881 Could be abstracted in the |
1307 // FocusManager. | 1291 // FocusManager. |
1308 if (close_on_deactivate_ && | 1292 if (close_on_deactivate_ && |
1309 (((message == WM_KEYDOWN || message == WM_KEYUP) && (wparam == VK_TAB)) || | 1293 (((message == WM_KEYDOWN || message == WM_KEYUP) && (wparam == VK_TAB)) || |
1310 (message == WM_CHAR && wparam == L'\t'))) { | 1294 (message == WM_CHAR && wparam == L'\t'))) { |
1311 DCHECK(parent_hwnd_); | 1295 DCHECK(parent_hwnd_); |
1312 // First close the pop-up. | 1296 // First close the pop-up. |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1941 if (message == WM_MOUSEMOVE) { | 1925 if (message == WM_MOUSEMOVE) { |
1942 CPoint center = GetClientCenter(); | 1926 CPoint center = GetClientCenter(); |
1943 // Ignore WM_MOUSEMOVE messages generated by MoveCursorToCenter(). | 1927 // Ignore WM_MOUSEMOVE messages generated by MoveCursorToCenter(). |
1944 if (LOWORD(lparam) == center.x && HIWORD(lparam) == center.y) | 1928 if (LOWORD(lparam) == center.x && HIWORD(lparam) == center.y) |
1945 return; | 1929 return; |
1946 } | 1930 } |
1947 | 1931 |
1948 ForwardMouseEventToRenderer(message, wparam, lparam); | 1932 ForwardMouseEventToRenderer(message, wparam, lparam); |
1949 } | 1933 } |
1950 | 1934 |
OLD | NEW |