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

Side by Side Diff: win8/metro_driver/metro_driver_win7.cc

Issue 1267483003: Combine the WM_CHAR with WM_KEY* for key event flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
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 "stdafx.h" 5 #include "stdafx.h"
6 #include <corewindow.h> 6 #include <corewindow.h>
7 #include <shobjidl.h> 7 #include <shobjidl.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 HRESULT STDMETHODCALLTYPE 456 HRESULT STDMETHODCALLTYPE
457 ProcessEvents(winui::Core::CoreProcessEventsOption options) override { 457 ProcessEvents(winui::Core::CoreProcessEventsOption options) override {
458 // We don't support the other message pump modes. So we basically enter a 458 // We don't support the other message pump modes. So we basically enter a
459 // traditional message loop that we only exit a teardown. 459 // traditional message loop that we only exit a teardown.
460 if (options != winui::Core::CoreProcessEventsOption_ProcessUntilQuit) 460 if (options != winui::Core::CoreProcessEventsOption_ProcessUntilQuit)
461 return E_FAIL; 461 return E_FAIL;
462 462
463 MSG msg = {0}; 463 MSG msg = {0};
464 while((::GetMessage(&msg, NULL, 0, 0) != 0) && g_window_count > 0) { 464 while((::GetMessage(&msg, NULL, 0, 0) != 0) && g_window_count > 0) {
465 ProcessInputMessage(msg); 465 ProcessInputMessage(msg);
466 ::TranslateMessage(&msg);
467 ::DispatchMessage(&msg); 466 ::DispatchMessage(&msg);
468 } 467 }
469 // TODO(cpu): figure what to do with msg.WParam which we would normally 468 // TODO(cpu): figure what to do with msg.WParam which we would normally
470 // return here. 469 // return here.
471 return S_OK; 470 return S_OK;
472 } 471 }
473 472
474 HRESULT STDMETHODCALLTYPE 473 HRESULT STDMETHODCALLTYPE
475 RunAsync(winui::Core::CoreDispatcherPriority priority, 474 RunAsync(winui::Core::CoreDispatcherPriority priority,
476 winui::Core::IDispatchedHandler* agileCallback, 475 winui::Core::IDispatchedHandler* agileCallback,
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 905
907 HRESULT STDMETHODCALLTYPE put_MessageHandled(boolean value) override { 906 HRESULT STDMETHODCALLTYPE put_MessageHandled(boolean value) override {
908 return S_OK; 907 return S_OK;
909 } 908 }
910 909
911 // InputHandler 910 // InputHandler
912 bool HandleKeyboardMessage(const MSG& msg) override { 911 bool HandleKeyboardMessage(const MSG& msg) override {
913 switch (msg.message) { 912 switch (msg.message) {
914 case WM_KEYDOWN: 913 case WM_KEYDOWN:
915 case WM_KEYUP: { 914 case WM_KEYUP: {
915 ::TranslateMessage(&msg);
916 MSG char_msg;
917 while (::PeekMessage(&char_msg, msg.hwnd, WM_CHAR, WM_SYSCHAR,
James Su 2015/08/04 17:06:44 ditto And WM_KEYDOWN/WM_KEYUP won't generate WM_S
Shu Chen 2015/08/05 01:36:45 Done.
918 PM_REMOVE)) {
919 mswr::ComPtr<winui::Core::ICharacterReceivedEventArgs> char_args;
920 char_args = mswr::Make<KeyEvent>(char_msg);
921 character_received_handler_->Invoke(this, char_args.Get());
922 }
916 mswr::ComPtr<winui::Core::IKeyEventArgs> event_args; 923 mswr::ComPtr<winui::Core::IKeyEventArgs> event_args;
917 event_args = mswr::Make<KeyEvent>(msg); 924 event_args = mswr::Make<KeyEvent>(msg);
918 KeyEventHandler* handler = NULL; 925 KeyEventHandler* handler = NULL;
919 if (msg.message == WM_KEYDOWN) { 926 if (msg.message == WM_KEYDOWN) {
920 handler = key_down_handler_; 927 handler = key_down_handler_;
921 } else { 928 } else {
922 handler = key_up_handler_; 929 handler = key_up_handler_;
923 } 930 }
924 handler->Invoke(this, event_args.Get()); 931 handler->Invoke(this, event_args.Get());
925 break; 932 break;
926 } 933 }
927 934
928 case WM_CHAR:
929 case WM_DEADCHAR:
930 case WM_UNICHAR: {
931 mswr::ComPtr<winui::Core::ICharacterReceivedEventArgs> event_args;
932 event_args = mswr::Make<KeyEvent>(msg);
933 character_received_handler_->Invoke(this, event_args.Get());
934 break;
935 }
936
937 default: 935 default:
938 return false; 936 return false;
939 } 937 }
940 return true; 938 return true;
941 } 939 }
942 940
943 bool HandleMouseMessage(const MSG& msg) override { 941 bool HandleMouseMessage(const MSG& msg) override {
944 PointerEventHandler* handler = NULL; 942 PointerEventHandler* handler = NULL;
945 mswr::ComPtr<winui::Core::IPointerEventArgs> event_args; 943 mswr::ComPtr<winui::Core::IPointerEventArgs> event_args;
946 event_args = mswr::Make<MouseEvent>(msg); 944 event_args = mswr::Make<MouseEvent>(msg);
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 }; 1216 };
1219 1217
1220 1218
1221 mswr::ComPtr<winapp::Core::ICoreApplication> InitWindows7() { 1219 mswr::ComPtr<winapp::Core::ICoreApplication> InitWindows7() {
1222 HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); 1220 HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
1223 if (FAILED(hr)) 1221 if (FAILED(hr))
1224 CHECK(false); 1222 CHECK(false);
1225 return mswr::Make<CoreApplicationWin7Emulation>(); 1223 return mswr::Make<CoreApplicationWin7Emulation>();
1226 } 1224 }
1227 1225
OLDNEW
« ui/base/ime/remote_input_method_win.cc ('K') | « ui/base/ime/remote_input_method_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698