OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/view_manager/display_manager.h" | 5 #include "components/view_manager/display_manager.h" |
6 | 6 |
7 #include "base/numerics/safe_conversions.h" | 7 #include "base/numerics/safe_conversions.h" |
8 #include "components/view_manager/display_manager_factory.h" | 8 #include "components/view_manager/display_manager_factory.h" |
9 #include "components/view_manager/gles2/gpu_state.h" | 9 #include "components/view_manager/gles2/gpu_state.h" |
10 #include "components/view_manager/native_viewport/onscreen_context_provider.h" | 10 #include "components/view_manager/native_viewport/onscreen_context_provider.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 case ui::ET_TOUCH_PRESSED: | 271 case ui::ET_TOUCH_PRESSED: |
272 platform_window_->SetCapture(); | 272 platform_window_->SetCapture(); |
273 break; | 273 break; |
274 case ui::ET_MOUSE_RELEASED: | 274 case ui::ET_MOUSE_RELEASED: |
275 case ui::ET_TOUCH_RELEASED: | 275 case ui::ET_TOUCH_RELEASED: |
276 platform_window_->ReleaseCapture(); | 276 platform_window_->ReleaseCapture(); |
277 break; | 277 break; |
278 default: | 278 default: |
279 break; | 279 break; |
280 } | 280 } |
281 | |
282 #if defined(USE_X11) | |
283 // We want to emulate the WM_CHAR generation behaviour of Windows. | |
Shu Chen
2015/07/17 01:54:08
I don't recommend to emulate the WM_CHAR, because
Elliot Glaysher
2015/07/17 17:52:35
This is part of the patch which was a revert. That
| |
284 // | |
285 // On Linux, we've previously inserted characters by having | |
286 // InputMethodAuraLinux take all key down events and send a character event | |
287 // to the TextInputClient. This causes a mismatch in code that has to be | |
288 // shared between Windows and Linux, including blink code. Now that we're | |
289 // trying to have one way of doing things, we need to standardize on and | |
290 // emulate Windows character events. | |
291 // | |
292 // This is equivalent to what we're doing in the current Linux port, but | |
293 // done once instead of done multiple times in different places. | |
294 if (event->type() == ui::ET_KEY_PRESSED) { | |
295 ui::KeyEvent* key_press_event = static_cast<ui::KeyEvent*>(event); | |
296 ui::KeyEvent char_event(key_press_event->GetCharacter(), | |
297 key_press_event->key_code(), | |
298 key_press_event->flags()); | |
299 | |
300 DCHECK_EQ(key_press_event->GetCharacter(), char_event.GetCharacter()); | |
301 DCHECK_EQ(key_press_event->key_code(), char_event.key_code()); | |
302 DCHECK_EQ(key_press_event->flags(), char_event.flags()); | |
303 | |
304 char_event.SetExtendedKeyEventData( | |
305 make_scoped_ptr(new mojo::MojoExtendedKeyEventData( | |
306 key_press_event->GetLocatedWindowsKeyboardCode(), | |
307 key_press_event->GetText(), | |
308 key_press_event->GetUnmodifiedText()))); | |
309 char_event.set_platform_keycode(key_press_event->platform_keycode()); | |
310 | |
311 delegate_->OnEvent(mojo::Event::From(char_event)); | |
312 } | |
313 #endif | |
281 } | 314 } |
282 | 315 |
283 void DefaultDisplayManager::OnCloseRequest() { | 316 void DefaultDisplayManager::OnCloseRequest() { |
284 platform_window_->Close(); | 317 platform_window_->Close(); |
285 } | 318 } |
286 | 319 |
287 void DefaultDisplayManager::OnClosed() { | 320 void DefaultDisplayManager::OnClosed() { |
288 delegate_->OnDisplayClosed(); | 321 delegate_->OnDisplayClosed(); |
289 } | 322 } |
290 | 323 |
291 void DefaultDisplayManager::OnWindowStateChanged( | 324 void DefaultDisplayManager::OnWindowStateChanged( |
292 ui::PlatformWindowState new_state) { | 325 ui::PlatformWindowState new_state) { |
293 } | 326 } |
294 | 327 |
295 void DefaultDisplayManager::OnLostCapture() { | 328 void DefaultDisplayManager::OnLostCapture() { |
296 } | 329 } |
297 | 330 |
298 void DefaultDisplayManager::OnAcceleratedWidgetAvailable( | 331 void DefaultDisplayManager::OnAcceleratedWidgetAvailable( |
299 gfx::AcceleratedWidget widget, | 332 gfx::AcceleratedWidget widget, |
300 float device_pixel_ratio) { | 333 float device_pixel_ratio) { |
301 context_provider_->SetAcceleratedWidget(widget); | 334 context_provider_->SetAcceleratedWidget(widget); |
302 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); | 335 UpdateMetrics(metrics_.size_in_pixels.To<gfx::Size>(), device_pixel_ratio); |
303 } | 336 } |
304 | 337 |
305 void DefaultDisplayManager::OnActivationChanged(bool active) { | 338 void DefaultDisplayManager::OnActivationChanged(bool active) { |
306 } | 339 } |
307 | 340 |
308 } // namespace view_manager | 341 } // namespace view_manager |
OLD | NEW |