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

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: Compile fix 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
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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 return xkb_keycode - 8; 1194 return xkb_keycode - 8;
1195 } 1195 }
1196 1196
1197 // Returns a set of Xkb modififers given a set of modifier flags. 1197 // Returns a set of Xkb modififers given a set of modifier flags.
1198 uint32_t ModifierFlagsToXkbModifiers(int modifier_flags) { 1198 uint32_t ModifierFlagsToXkbModifiers(int modifier_flags) {
1199 struct { 1199 struct {
1200 ui::EventFlags flag; 1200 ui::EventFlags flag;
1201 const char* xkb_name; 1201 const char* xkb_name;
1202 } modifiers[] = { 1202 } modifiers[] = {
1203 {ui::EF_SHIFT_DOWN, XKB_MOD_NAME_SHIFT}, 1203 {ui::EF_SHIFT_DOWN, XKB_MOD_NAME_SHIFT},
1204 {ui::EF_CAPS_LOCK_DOWN, XKB_MOD_NAME_CAPS},
1205 {ui::EF_CONTROL_DOWN, XKB_MOD_NAME_CTRL}, 1204 {ui::EF_CONTROL_DOWN, XKB_MOD_NAME_CTRL},
1206 {ui::EF_ALT_DOWN, XKB_MOD_NAME_ALT}, 1205 {ui::EF_ALT_DOWN, XKB_MOD_NAME_ALT},
1207 {ui::EF_NUM_LOCK_DOWN, XKB_MOD_NAME_NUM},
1208 {ui::EF_MOD3_DOWN, "Mod3"},
1209 {ui::EF_COMMAND_DOWN, XKB_MOD_NAME_LOGO}, 1206 {ui::EF_COMMAND_DOWN, XKB_MOD_NAME_LOGO},
1210 {ui::EF_ALTGR_DOWN, "Mod5"}, 1207 {ui::EF_ALTGR_DOWN, "Mod5"},
1208 {ui::EF_MOD3_DOWN, "Mod3"},
1209 {ui::EF_NUM_LOCK_ON, XKB_MOD_NAME_NUM},
1210 {ui::EF_CAPS_LOCK_ON, XKB_MOD_NAME_CAPS},
1211 }; 1211 };
1212 uint32_t xkb_modifiers = 0; 1212 uint32_t xkb_modifiers = 0;
1213 for (auto modifier : modifiers) { 1213 for (auto modifier : modifiers) {
1214 if (modifier_flags & modifier.flag) { 1214 if (modifier_flags & modifier.flag) {
1215 xkb_modifiers |= 1215 xkb_modifiers |=
1216 1 << xkb_keymap_mod_get_index(xkb_keymap_.get(), modifier.xkb_name); 1216 1 << xkb_keymap_mod_get_index(xkb_keymap_.get(), modifier.xkb_name);
1217 } 1217 }
1218 } 1218 }
1219 return xkb_modifiers; 1219 return xkb_modifiers;
1220 } 1220 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 DCHECK(event_loop); 1446 DCHECK(event_loop);
1447 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 1447 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
1448 } 1448 }
1449 1449
1450 void Server::Flush() { 1450 void Server::Flush() {
1451 wl_display_flush_clients(wl_display_.get()); 1451 wl_display_flush_clients(wl_display_.get());
1452 } 1452 }
1453 1453
1454 } // namespace wayland 1454 } // namespace wayland
1455 } // namespace exo 1455 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698