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

Side by Side Diff: components/exo/wayland/server.cc

Issue 1559163002: Clean up event flags a bit: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 4 years, 11 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 | « components/exo/pointer.cc ('k') | components/mus/public/cpp/lib/event_matcher.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/exo/wayland/server.h" 5 #include "components/exo/wayland/server.h"
6 6
7 #include <linux/input.h> 7 #include <linux/input.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <wayland-server-core.h> 10 #include <wayland-server-core.h>
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 return xkb_keycode - 8; 1257 return xkb_keycode - 8;
1258 } 1258 }
1259 1259
1260 // Returns a set of Xkb modififers given a set of modifier flags. 1260 // Returns a set of Xkb modififers given a set of modifier flags.
1261 uint32_t ModifierFlagsToXkbModifiers(int modifier_flags) { 1261 uint32_t ModifierFlagsToXkbModifiers(int modifier_flags) {
1262 struct { 1262 struct {
1263 ui::EventFlags flag; 1263 ui::EventFlags flag;
1264 const char* xkb_name; 1264 const char* xkb_name;
1265 } modifiers[] = { 1265 } modifiers[] = {
1266 {ui::EF_SHIFT_DOWN, XKB_MOD_NAME_SHIFT}, 1266 {ui::EF_SHIFT_DOWN, XKB_MOD_NAME_SHIFT},
1267 {ui::EF_CAPS_LOCK_DOWN, XKB_MOD_NAME_CAPS},
1268 {ui::EF_CONTROL_DOWN, XKB_MOD_NAME_CTRL}, 1267 {ui::EF_CONTROL_DOWN, XKB_MOD_NAME_CTRL},
1269 {ui::EF_ALT_DOWN, XKB_MOD_NAME_ALT}, 1268 {ui::EF_ALT_DOWN, XKB_MOD_NAME_ALT},
1270 {ui::EF_NUM_LOCK_DOWN, XKB_MOD_NAME_NUM},
1271 {ui::EF_MOD3_DOWN, "Mod3"},
1272 {ui::EF_COMMAND_DOWN, XKB_MOD_NAME_LOGO}, 1269 {ui::EF_COMMAND_DOWN, XKB_MOD_NAME_LOGO},
1273 {ui::EF_ALTGR_DOWN, "Mod5"}, 1270 {ui::EF_ALTGR_DOWN, "Mod5"},
1271 {ui::EF_MOD3_DOWN, "Mod3"},
1272 {ui::EF_NUM_LOCK_ON, XKB_MOD_NAME_NUM},
1273 {ui::EF_CAPS_LOCK_ON, XKB_MOD_NAME_CAPS},
1274 }; 1274 };
1275 uint32_t xkb_modifiers = 0; 1275 uint32_t xkb_modifiers = 0;
1276 for (auto modifier : modifiers) { 1276 for (auto modifier : modifiers) {
1277 if (modifier_flags & modifier.flag) { 1277 if (modifier_flags & modifier.flag) {
1278 xkb_modifiers |= 1278 xkb_modifiers |=
1279 1 << xkb_keymap_mod_get_index(xkb_keymap_.get(), modifier.xkb_name); 1279 1 << xkb_keymap_mod_get_index(xkb_keymap_.get(), modifier.xkb_name);
1280 } 1280 }
1281 } 1281 }
1282 return xkb_modifiers; 1282 return xkb_modifiers;
1283 } 1283 }
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 DCHECK(event_loop); 1511 DCHECK(event_loop);
1512 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 1512 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
1513 } 1513 }
1514 1514
1515 void Server::Flush() { 1515 void Server::Flush() {
1516 wl_display_flush_clients(wl_display_.get()); 1516 wl_display_flush_clients(wl_display_.get());
1517 } 1517 }
1518 1518
1519 } // namespace wayland 1519 } // namespace wayland
1520 } // namespace exo 1520 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/pointer.cc ('k') | components/mus/public/cpp/lib/event_matcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698