Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: ui/aura/remote_root_window_host_win.cc

Issue 13003004: Support multi touch on Windows 8 AURA and ASH. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/remote_root_window_host_win.h ('k') | ui/metro_viewer/metro_viewer_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/aura/remote_root_window_host_win.h" 5 #include "ui/aura/remote_root_window_host_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "ipc/ipc_message.h" 12 #include "ipc/ipc_message.h"
13 #include "ipc/ipc_sender.h" 13 #include "ipc/ipc_sender.h"
14 #include "ui/aura/client/capture_client.h" 14 #include "ui/aura/client/capture_client.h"
15 #include "ui/aura/root_window.h" 15 #include "ui/aura/root_window.h"
16 #include "ui/base/cursor/cursor_loader_win.h" 16 #include "ui/base/cursor/cursor_loader_win.h"
17 #include "ui/base/events/event.h" 17 #include "ui/base/events/event.h"
18 #include "ui/base/events/event_utils.h" 18 #include "ui/base/events/event_utils.h"
19 #include "ui/base/keycodes/keyboard_code_conversion_win.h" 19 #include "ui/base/keycodes/keyboard_code_conversion_win.h"
20 #include "ui/base/view_prop.h" 20 #include "ui/base/view_prop.h"
21 #include "ui/gfx/insets.h" 21 #include "ui/gfx/insets.h"
22 #include "ui/metro_viewer/metro_viewer_messages.h" 22 #include "ui/metro_viewer/metro_viewer_messages.h"
23 23
24 namespace aura { 24 namespace aura {
25 25
26 namespace { 26 namespace {
27 27
28 const char* kRootWindowHostWinKey = "__AURA_REMOTE_ROOT_WINDOW_HOST_WIN__"; 28 const char* kRootWindowHostWinKey = "__AURA_REMOTE_ROOT_WINDOW_HOST_WIN__";
29 29
30 // The touch id to be used for touch events coming in from Windows Ash.
31 const int kRemoteWindowTouchId = 10;
32
33 // Sets the keystate for the virtual key passed in to down or up. 30 // Sets the keystate for the virtual key passed in to down or up.
34 void SetKeyState(uint8* key_states, bool key_down, uint32 virtual_key_code) { 31 void SetKeyState(uint8* key_states, bool key_down, uint32 virtual_key_code) {
35 DCHECK(key_states); 32 DCHECK(key_states);
36 33
37 if (key_down) 34 if (key_down)
38 key_states[virtual_key_code] |= 0x80; 35 key_states[virtual_key_code] |= 0x80;
39 else 36 else
40 key_states[virtual_key_code] &= 0x7F; 37 key_states[virtual_key_code] &= 0x7F;
41 } 38 }
42 39
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 uint32 flags) { 363 uint32 flags) {
367 DispatchKeyboardMessage(ui::ET_KEY_PRESSED, key_code, repeat_count, 364 DispatchKeyboardMessage(ui::ET_KEY_PRESSED, key_code, repeat_count,
368 scan_code, flags, true); 365 scan_code, flags, true);
369 } 366 }
370 367
371 void RemoteRootWindowHostWin::OnVisibilityChanged(bool visible) { 368 void RemoteRootWindowHostWin::OnVisibilityChanged(bool visible) {
372 if (visible) 369 if (visible)
373 delegate_->OnHostActivated(); 370 delegate_->OnHostActivated();
374 } 371 }
375 372
376 void RemoteRootWindowHostWin::OnTouchDown(int32 x, int32 y, uint64 timestamp) { 373 void RemoteRootWindowHostWin::OnTouchDown(int32 x,
374 int32 y,
375 uint64 timestamp,
376 uint32 pointer_id) {
377 ui::TouchEvent event(ui::ET_TOUCH_PRESSED, 377 ui::TouchEvent event(ui::ET_TOUCH_PRESSED,
378 gfx::Point(x, y), 378 gfx::Point(x, y),
379 kRemoteWindowTouchId, 379 pointer_id,
380 base::TimeDelta::FromMicroseconds(timestamp)); 380 base::TimeDelta::FromMicroseconds(timestamp));
381 delegate_->OnHostTouchEvent(&event); 381 delegate_->OnHostTouchEvent(&event);
382 } 382 }
383 383
384 void RemoteRootWindowHostWin::OnTouchUp(int32 x, int32 y, uint64 timestamp) { 384 void RemoteRootWindowHostWin::OnTouchUp(int32 x,
385 int32 y,
386 uint64 timestamp,
387 uint32 pointer_id) {
385 ui::TouchEvent event(ui::ET_TOUCH_RELEASED, 388 ui::TouchEvent event(ui::ET_TOUCH_RELEASED,
386 gfx::Point(x, y), 389 gfx::Point(x, y),
387 kRemoteWindowTouchId, 390 pointer_id,
388 base::TimeDelta::FromMicroseconds(timestamp)); 391 base::TimeDelta::FromMicroseconds(timestamp));
389 delegate_->OnHostTouchEvent(&event); 392 delegate_->OnHostTouchEvent(&event);
390 } 393 }
391 394
392 void RemoteRootWindowHostWin::OnTouchMoved(int32 x, 395 void RemoteRootWindowHostWin::OnTouchMoved(int32 x,
393 int32 y, 396 int32 y,
394 uint64 timestamp) { 397 uint64 timestamp,
398 uint32 pointer_id) {
395 ui::TouchEvent event(ui::ET_TOUCH_MOVED, 399 ui::TouchEvent event(ui::ET_TOUCH_MOVED,
396 gfx::Point(x, y), 400 gfx::Point(x, y),
397 kRemoteWindowTouchId, 401 pointer_id,
398 base::TimeDelta::FromMicroseconds(timestamp)); 402 base::TimeDelta::FromMicroseconds(timestamp));
399 delegate_->OnHostTouchEvent(&event); 403 delegate_->OnHostTouchEvent(&event);
400 } 404 }
401 405
402 void RemoteRootWindowHostWin::OnFileSaveAsDone(bool success, 406 void RemoteRootWindowHostWin::OnFileSaveAsDone(bool success,
403 string16 filename, 407 string16 filename,
404 int filter_index) { 408 int filter_index) {
405 if (success) { 409 if (success) {
406 file_saveas_completion_callback_.Run( 410 file_saveas_completion_callback_.Run(
407 base::FilePath(filename), filter_index, NULL); 411 base::FilePath(filename), filter_index, NULL);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 } else { 449 } else {
446 ui::KeyEvent event(type, 450 ui::KeyEvent event(type,
447 ui::KeyboardCodeForWindowsKeyCode(vkey), 451 ui::KeyboardCodeForWindowsKeyCode(vkey),
448 flags, 452 flags,
449 is_character); 453 is_character);
450 delegate_->OnHostKeyEvent(&event); 454 delegate_->OnHostKeyEvent(&event);
451 } 455 }
452 } 456 }
453 457
454 } // namespace aura 458 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/remote_root_window_host_win.h ('k') | ui/metro_viewer/metro_viewer_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698