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

Unified 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 side-by-side diff with in-line comments
Download patch
« components/exo/keyboard.cc ('K') | « components/exo/keyboard.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/wayland/server.cc
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc
index f3fc2aff506e731fc7b296ae5bcf848fd4040196..fbca1f4cd96f5b87a46eed99759f118e966bf3c9 100644
--- a/components/exo/wayland/server.cc
+++ b/components/exo/wayland/server.cc
@@ -3058,7 +3058,16 @@ void keyboard_configuration_get_keyboard_device_configuration(
wl_resource* resource,
uint32_t id,
wl_resource* keyboard_resource) {
- // TODO(yhanada): Produce an error if a delegate already exists.
+ 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.
+ ->HasDeviceConfigurationDelegate()) {
+ wl_resource_post_error(
+ resource,
+ ZCR_KEYBOARD_CONFIGURATION_V1_ERROR_DEVICE_CONFIGURATION_EXISTS,
+ "keyboard has already been associated with a device configuration "
+ "object");
+ return;
+ }
+
wl_resource* keyboard_device_configuration_resource = wl_resource_create(
client, &zcr_keyboard_device_configuration_v1_interface, 1, id);
@@ -3127,7 +3136,7 @@ Server::Server(Display* display)
wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 1, display_,
bind_stylus);
wl_global_create(wl_display_.get(), &zcr_keyboard_configuration_v1_interface,
- 1, display_, bind_keyboard_configuration);
+ 2, display_, bind_keyboard_configuration);
}
Server::~Server() {}
« 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