| OLD | NEW |
| 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 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 return xkb_keycode - 8; | 1202 return xkb_keycode - 8; |
| 1203 } | 1203 } |
| 1204 | 1204 |
| 1205 // Returns a set of Xkb modififers given a set of modifier flags. | 1205 // Returns a set of Xkb modififers given a set of modifier flags. |
| 1206 uint32_t ModifierFlagsToXkbModifiers(int modifier_flags) { | 1206 uint32_t ModifierFlagsToXkbModifiers(int modifier_flags) { |
| 1207 struct { | 1207 struct { |
| 1208 ui::EventFlags flag; | 1208 ui::EventFlags flag; |
| 1209 const char* xkb_name; | 1209 const char* xkb_name; |
| 1210 } modifiers[] = { | 1210 } modifiers[] = { |
| 1211 {ui::EF_SHIFT_DOWN, XKB_MOD_NAME_SHIFT}, | 1211 {ui::EF_SHIFT_DOWN, XKB_MOD_NAME_SHIFT}, |
| 1212 {ui::EF_CAPS_LOCK_DOWN, XKB_MOD_NAME_CAPS}, | |
| 1213 {ui::EF_CONTROL_DOWN, XKB_MOD_NAME_CTRL}, | 1212 {ui::EF_CONTROL_DOWN, XKB_MOD_NAME_CTRL}, |
| 1214 {ui::EF_ALT_DOWN, XKB_MOD_NAME_ALT}, | 1213 {ui::EF_ALT_DOWN, XKB_MOD_NAME_ALT}, |
| 1215 {ui::EF_NUM_LOCK_DOWN, XKB_MOD_NAME_NUM}, | |
| 1216 {ui::EF_MOD3_DOWN, "Mod3"}, | |
| 1217 {ui::EF_COMMAND_DOWN, XKB_MOD_NAME_LOGO}, | 1214 {ui::EF_COMMAND_DOWN, XKB_MOD_NAME_LOGO}, |
| 1218 {ui::EF_ALTGR_DOWN, "Mod5"}, | 1215 {ui::EF_ALTGR_DOWN, "Mod5"}, |
| 1216 {ui::EF_MOD3_DOWN, "Mod3"}, |
| 1217 {ui::EF_NUM_LOCK_ON, XKB_MOD_NAME_NUM}, |
| 1218 {ui::EF_CAPS_LOCK_ON, XKB_MOD_NAME_CAPS}, |
| 1219 }; | 1219 }; |
| 1220 uint32_t xkb_modifiers = 0; | 1220 uint32_t xkb_modifiers = 0; |
| 1221 for (auto modifier : modifiers) { | 1221 for (auto modifier : modifiers) { |
| 1222 if (modifier_flags & modifier.flag) { | 1222 if (modifier_flags & modifier.flag) { |
| 1223 xkb_modifiers |= | 1223 xkb_modifiers |= |
| 1224 1 << xkb_keymap_mod_get_index(xkb_keymap_.get(), modifier.xkb_name); | 1224 1 << xkb_keymap_mod_get_index(xkb_keymap_.get(), modifier.xkb_name); |
| 1225 } | 1225 } |
| 1226 } | 1226 } |
| 1227 return xkb_modifiers; | 1227 return xkb_modifiers; |
| 1228 } | 1228 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 DCHECK(event_loop); | 1454 DCHECK(event_loop); |
| 1455 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 1455 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 void Server::Flush() { | 1458 void Server::Flush() { |
| 1459 wl_display_flush_clients(wl_display_.get()); | 1459 wl_display_flush_clients(wl_display_.get()); |
| 1460 } | 1460 } |
| 1461 | 1461 |
| 1462 } // namespace wayland | 1462 } // namespace wayland |
| 1463 } // namespace exo | 1463 } // namespace exo |
| OLD | NEW |