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

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

Issue 2567903003: exo: Produce an error if get_keyboard_device_configuration is called with a keyboard object that al… (Closed)
Patch Set: Created 4 years 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
« components/exo/keyboard.cc ('K') | « components/exo/keyboard.cc ('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 // 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 <grp.h> 7 #include <grp.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 3040 matching lines...) Expand 10 before | Expand all | Expand 10 after
3051 keyboard_device_configuration_destroy}; 3051 keyboard_device_configuration_destroy};
3052 3052
3053 //////////////////////////////////////////////////////////////////////////////// 3053 ////////////////////////////////////////////////////////////////////////////////
3054 // keyboard_configuration interface: 3054 // keyboard_configuration interface:
3055 3055
3056 void keyboard_configuration_get_keyboard_device_configuration( 3056 void keyboard_configuration_get_keyboard_device_configuration(
3057 wl_client* client, 3057 wl_client* client,
3058 wl_resource* resource, 3058 wl_resource* resource,
3059 uint32_t id, 3059 uint32_t id,
3060 wl_resource* keyboard_resource) { 3060 wl_resource* keyboard_resource) {
3061 // TODO(yhanada): Produce an error if a delegate already exists. 3061 if (GetUserDataAs<Keyboard>(keyboard_resource)
reveman 2016/12/12 11:52:56 nit: "Keyboard* keyboard = GetUserDataAs<Keyboard>
yhanada 2016/12/12 15:44:03 Done.
3062 ->HasDeviceConfigurationDelegate()) {
3063 wl_resource_post_error(
3064 resource,
3065 ZCR_KEYBOARD_CONFIGURATION_V1_ERROR_DEVICE_CONFIGURATION_EXISTS,
3066 "keyboard has already been associated with a device configuration "
3067 "object");
3068 return;
3069 }
3070
3062 wl_resource* keyboard_device_configuration_resource = wl_resource_create( 3071 wl_resource* keyboard_device_configuration_resource = wl_resource_create(
3063 client, &zcr_keyboard_device_configuration_v1_interface, 1, id); 3072 client, &zcr_keyboard_device_configuration_v1_interface, 1, id);
3064 3073
3065 SetImplementation( 3074 SetImplementation(
3066 keyboard_device_configuration_resource, 3075 keyboard_device_configuration_resource,
3067 &keyboard_device_configuration_implementation, 3076 &keyboard_device_configuration_implementation,
3068 base::MakeUnique<WaylandKeyboardDeviceConfigurationDelegate>( 3077 base::MakeUnique<WaylandKeyboardDeviceConfigurationDelegate>(
3069 keyboard_device_configuration_resource, 3078 keyboard_device_configuration_resource,
3070 GetUserDataAs<Keyboard>(keyboard_resource))); 3079 GetUserDataAs<Keyboard>(keyboard_resource)));
3071 } 3080 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
3120 display_, bind_secure_output); 3129 display_, bind_secure_output);
3121 wl_global_create(wl_display_.get(), &zcr_alpha_compositing_v1_interface, 1, 3130 wl_global_create(wl_display_.get(), &zcr_alpha_compositing_v1_interface, 1,
3122 display_, bind_alpha_compositing); 3131 display_, bind_alpha_compositing);
3123 wl_global_create(wl_display_.get(), &zcr_remote_shell_v1_interface, 3132 wl_global_create(wl_display_.get(), &zcr_remote_shell_v1_interface,
3124 remote_shell_version, display_, bind_remote_shell); 3133 remote_shell_version, display_, bind_remote_shell);
3125 wl_global_create(wl_display_.get(), &zcr_gaming_input_v1_interface, 1, 3134 wl_global_create(wl_display_.get(), &zcr_gaming_input_v1_interface, 1,
3126 display_, bind_gaming_input); 3135 display_, bind_gaming_input);
3127 wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 1, display_, 3136 wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 1, display_,
3128 bind_stylus); 3137 bind_stylus);
3129 wl_global_create(wl_display_.get(), &zcr_keyboard_configuration_v1_interface, 3138 wl_global_create(wl_display_.get(), &zcr_keyboard_configuration_v1_interface,
3130 1, display_, bind_keyboard_configuration); 3139 2, display_, bind_keyboard_configuration);
3131 } 3140 }
3132 3141
3133 Server::~Server() {} 3142 Server::~Server() {}
3134 3143
3135 // static 3144 // static
3136 std::unique_ptr<Server> Server::Create(Display* display) { 3145 std::unique_ptr<Server> Server::Create(Display* display) {
3137 std::unique_ptr<Server> server(new Server(display)); 3146 std::unique_ptr<Server> server(new Server(display));
3138 3147
3139 char* runtime_dir = getenv("XDG_RUNTIME_DIR"); 3148 char* runtime_dir = getenv("XDG_RUNTIME_DIR");
3140 if (!runtime_dir) { 3149 if (!runtime_dir) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 DCHECK(event_loop); 3201 DCHECK(event_loop);
3193 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 3202 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
3194 } 3203 }
3195 3204
3196 void Server::Flush() { 3205 void Server::Flush() {
3197 wl_display_flush_clients(wl_display_.get()); 3206 wl_display_flush_clients(wl_display_.get());
3198 } 3207 }
3199 3208
3200 } // namespace wayland 3209 } // namespace wayland
3201 } // namespace exo 3210 } // namespace exo
OLDNEW
« components/exo/keyboard.cc ('K') | « components/exo/keyboard.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698