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 | 1287 // When Escape is pressed, force fullscreen windows to close if necessary. |
1288 // close if necessary. | |
1289 if ((message == WM_KEYDOWN || message == WM_KEYUP) && wparam == VK_ESCAPE) { | 1288 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_) { | 1289 if (is_fullscreen_) { |
1296 SendMessage(WM_CANCELMODE); | 1290 SendMessage(WM_CANCELMODE); |
1297 absorbed = true; | 1291 return 0; |
1298 } | 1292 } |
1299 if (absorbed) | |
1300 return 0; | |
1301 } | 1293 } |
1302 | 1294 |
1303 // If we are a pop-up, forward tab related messages to our parent HWND, so | 1295 // 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 | 1296 // that we are dismissed appropriately and so that the focus advance in our |
1305 // parent. | 1297 // parent. |
1306 // TODO(jcampan): http://b/issue?id=1192881 Could be abstracted in the | 1298 // TODO(jcampan): http://b/issue?id=1192881 Could be abstracted in the |
1307 // FocusManager. | 1299 // FocusManager. |
1308 if (close_on_deactivate_ && | 1300 if (close_on_deactivate_ && |
1309 (((message == WM_KEYDOWN || message == WM_KEYUP) && (wparam == VK_TAB)) || | 1301 (((message == WM_KEYDOWN || message == WM_KEYUP) && (wparam == VK_TAB)) || |
1310 (message == WM_CHAR && wparam == L'\t'))) { | 1302 (message == WM_CHAR && wparam == L'\t'))) { |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 if (message == WM_MOUSEMOVE) { | 1933 if (message == WM_MOUSEMOVE) { |
1942 CPoint center = GetClientCenter(); | 1934 CPoint center = GetClientCenter(); |
1943 // Ignore WM_MOUSEMOVE messages generated by MoveCursorToCenter(). | 1935 // Ignore WM_MOUSEMOVE messages generated by MoveCursorToCenter(). |
1944 if (LOWORD(lparam) == center.x && HIWORD(lparam) == center.y) | 1936 if (LOWORD(lparam) == center.x && HIWORD(lparam) == center.y) |
1945 return; | 1937 return; |
1946 } | 1938 } |
1947 | 1939 |
1948 ForwardMouseEventToRenderer(message, wparam, lparam); | 1940 ForwardMouseEventToRenderer(message, wparam, lparam); |
1949 } | 1941 } |
1950 | 1942 |
OLD | NEW |