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

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: rebase 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
« no previous file with comments | « 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 Keyboard* keyboard = GetUserDataAs<Keyboard>(keyboard_resource);
3062 if (keyboard->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, keyboard));
3070 GetUserDataAs<Keyboard>(keyboard_resource)));
3071 } 3079 }
3072 3080
3073 const struct zcr_keyboard_configuration_v1_interface 3081 const struct zcr_keyboard_configuration_v1_interface
3074 keyboard_configuration_implementation = { 3082 keyboard_configuration_implementation = {
3075 keyboard_configuration_get_keyboard_device_configuration}; 3083 keyboard_configuration_get_keyboard_device_configuration};
3076 3084
3077 void bind_keyboard_configuration(wl_client* client, 3085 void bind_keyboard_configuration(wl_client* client,
3078 void* data, 3086 void* data,
3079 uint32_t version, 3087 uint32_t version,
3080 uint32_t id) { 3088 uint32_t id) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3120 display_, bind_secure_output); 3128 display_, bind_secure_output);
3121 wl_global_create(wl_display_.get(), &zcr_alpha_compositing_v1_interface, 1, 3129 wl_global_create(wl_display_.get(), &zcr_alpha_compositing_v1_interface, 1,
3122 display_, bind_alpha_compositing); 3130 display_, bind_alpha_compositing);
3123 wl_global_create(wl_display_.get(), &zcr_remote_shell_v1_interface, 3131 wl_global_create(wl_display_.get(), &zcr_remote_shell_v1_interface,
3124 remote_shell_version, display_, bind_remote_shell); 3132 remote_shell_version, display_, bind_remote_shell);
3125 wl_global_create(wl_display_.get(), &zcr_gaming_input_v1_interface, 1, 3133 wl_global_create(wl_display_.get(), &zcr_gaming_input_v1_interface, 1,
3126 display_, bind_gaming_input); 3134 display_, bind_gaming_input);
3127 wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 1, display_, 3135 wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 1, display_,
3128 bind_stylus); 3136 bind_stylus);
3129 wl_global_create(wl_display_.get(), &zcr_keyboard_configuration_v1_interface, 3137 wl_global_create(wl_display_.get(), &zcr_keyboard_configuration_v1_interface,
3130 1, display_, bind_keyboard_configuration); 3138 2, display_, bind_keyboard_configuration);
3131 } 3139 }
3132 3140
3133 Server::~Server() {} 3141 Server::~Server() {}
3134 3142
3135 // static 3143 // static
3136 std::unique_ptr<Server> Server::Create(Display* display) { 3144 std::unique_ptr<Server> Server::Create(Display* display) {
3137 std::unique_ptr<Server> server(new Server(display)); 3145 std::unique_ptr<Server> server(new Server(display));
3138 3146
3139 char* runtime_dir = getenv("XDG_RUNTIME_DIR"); 3147 char* runtime_dir = getenv("XDG_RUNTIME_DIR");
3140 if (!runtime_dir) { 3148 if (!runtime_dir) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
3192 DCHECK(event_loop); 3200 DCHECK(event_loop);
3193 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 3201 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
3194 } 3202 }
3195 3203
3196 void Server::Flush() { 3204 void Server::Flush() {
3197 wl_display_flush_clients(wl_display_.get()); 3205 wl_display_flush_clients(wl_display_.get());
3198 } 3206 }
3199 3207
3200 } // namespace wayland 3208 } // namespace wayland
3201 } // namespace exo 3209 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/keyboard.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698