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; | 1289 bool absorbed = false; |
1291 if (mouse_locked_) { | |
1292 UnlockMouse(); | |
1293 absorbed = true; | |
1294 } | |
1295 if (is_fullscreen_) { | 1290 if (is_fullscreen_) { |
1296 SendMessage(WM_CANCELMODE); | 1291 SendMessage(WM_CANCELMODE); |
1297 absorbed = true; | 1292 absorbed = true; |
yzshen1
2011/10/15 04:32:30
you could remove |absorbed| and return directly.
koz (OOO until 15th September)
2011/10/15 04:36:55
Done.
| |
1298 } | 1293 } |
1299 if (absorbed) | 1294 if (absorbed) |
1300 return 0; | 1295 return 0; |
1301 } | 1296 } |
1302 | 1297 |
1303 // If we are a pop-up, forward tab related messages to our parent HWND, so | 1298 // 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 | 1299 // that we are dismissed appropriately and so that the focus advance in our |
1305 // parent. | 1300 // parent. |
1306 // TODO(jcampan): http://b/issue?id=1192881 Could be abstracted in the | 1301 // TODO(jcampan): http://b/issue?id=1192881 Could be abstracted in the |
1307 // FocusManager. | 1302 // FocusManager. |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1941 if (message == WM_MOUSEMOVE) { | 1936 if (message == WM_MOUSEMOVE) { |
1942 CPoint center = GetClientCenter(); | 1937 CPoint center = GetClientCenter(); |
1943 // Ignore WM_MOUSEMOVE messages generated by MoveCursorToCenter(). | 1938 // Ignore WM_MOUSEMOVE messages generated by MoveCursorToCenter(). |
1944 if (LOWORD(lparam) == center.x && HIWORD(lparam) == center.y) | 1939 if (LOWORD(lparam) == center.x && HIWORD(lparam) == center.y) |
1945 return; | 1940 return; |
1946 } | 1941 } |
1947 | 1942 |
1948 ForwardMouseEventToRenderer(message, wparam, lparam); | 1943 ForwardMouseEventToRenderer(message, wparam, lparam); |
1949 } | 1944 } |
1950 | 1945 |
OLD | NEW |