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

Side by Side Diff: tools/viewer/sk_app/win/Window_win.cpp

Issue 1955293002: Add flexible keybinding/command system to sk_app (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 7 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
« no previous file with comments | « tools/viewer/sk_app/Window.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Window_win.h" 8 #include "Window_win.h"
9 9
10 #include <tchar.h> 10 #include <tchar.h>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 SetWindowLongPtr(fHWnd, GWLP_USERDATA, (LONG_PTR)this); 86 SetWindowLongPtr(fHWnd, GWLP_USERDATA, (LONG_PTR)this);
87 87
88 return true; 88 return true;
89 } 89 }
90 90
91 static Window::Key get_key(WPARAM vk) { 91 static Window::Key get_key(WPARAM vk) {
92 static const struct { 92 static const struct {
93 WPARAM fVK; 93 WPARAM fVK;
94 Window::Key fKey; 94 Window::Key fKey;
95 } gPair[] = { 95 } gPair[] = {
96 { VK_BACK, Window::kBack_Key }, 96 { VK_BACK, Window::Key::kBack },
97 { VK_CLEAR, Window::kBack_Key }, 97 { VK_CLEAR, Window::Key::kBack },
98 { VK_RETURN, Window::kOK_Key }, 98 { VK_RETURN, Window::Key::kOK },
99 { VK_UP, Window::kUp_Key }, 99 { VK_UP, Window::Key::kUp },
100 { VK_DOWN, Window::kDown_Key }, 100 { VK_DOWN, Window::Key::kDown },
101 { VK_LEFT, Window::kLeft_Key }, 101 { VK_LEFT, Window::Key::kLeft },
102 { VK_RIGHT, Window::kRight_Key } 102 { VK_RIGHT, Window::Key::kRight }
103 }; 103 };
104 for (size_t i = 0; i < SK_ARRAY_COUNT(gPair); i++) { 104 for (size_t i = 0; i < SK_ARRAY_COUNT(gPair); i++) {
105 if (gPair[i].fVK == vk) { 105 if (gPair[i].fVK == vk) {
106 return gPair[i].fKey; 106 return gPair[i].fKey;
107 } 107 }
108 } 108 }
109 return Window::kNONE_Key; 109 return Window::Key::kNONE;
110 } 110 }
111 111
112 static uint32_t get_modifiers(UINT message, WPARAM wParam, LPARAM lParam) { 112 static uint32_t get_modifiers(UINT message, WPARAM wParam, LPARAM lParam) {
113 uint32_t modifiers = 0; 113 uint32_t modifiers = 0;
114 114
115 switch (message) { 115 switch (message) {
116 case WM_UNICHAR: 116 case WM_UNICHAR:
117 case WM_CHAR: 117 case WM_CHAR:
118 if (0 == (lParam & (1 << 30))) { 118 if (0 == (lParam & (1 << 30))) {
119 modifiers |= Window::kFirstPress_ModifierKey; 119 modifiers |= Window::kFirstPress_ModifierKey;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 fWindowContext = VulkanWindowContext::Create((void*)&platformData, params); 276 fWindowContext = VulkanWindowContext::Create((void*)&platformData, params);
277 277
278 return (SkToBool(fWindowContext)); 278 return (SkToBool(fWindowContext));
279 } 279 }
280 280
281 void Window_win::inval() { 281 void Window_win::inval() {
282 InvalidateRect(fHWnd, nullptr, false); 282 InvalidateRect(fHWnd, nullptr, false);
283 } 283 }
284 284
285 } // namespace sk_app 285 } // namespace sk_app
OLDNEW
« no previous file with comments | « tools/viewer/sk_app/Window.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698