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 <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 2968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2979 const struct zcr_pointer_stylus_v1_interface pointer_stylus_implementation = { | 2979 const struct zcr_pointer_stylus_v1_interface pointer_stylus_implementation = { |
2980 pointer_stylus_destroy}; | 2980 pointer_stylus_destroy}; |
2981 | 2981 |
2982 //////////////////////////////////////////////////////////////////////////////// | 2982 //////////////////////////////////////////////////////////////////////////////// |
2983 // stylus interface: | 2983 // stylus interface: |
2984 | 2984 |
2985 void stylus_get_pointer_stylus(wl_client* client, | 2985 void stylus_get_pointer_stylus(wl_client* client, |
2986 wl_resource* resource, | 2986 wl_resource* resource, |
2987 uint32_t id, | 2987 uint32_t id, |
2988 wl_resource* pointer_resource) { | 2988 wl_resource* pointer_resource) { |
2989 // TODO(yhanada): Produce an erorr if a delegate already exists. | |
2990 Pointer* pointer = GetUserDataAs<Pointer>(pointer_resource); | 2989 Pointer* pointer = GetUserDataAs<Pointer>(pointer_resource); |
| 2990 if (pointer->HasStylusDelegate()) { |
| 2991 wl_resource_post_error( |
| 2992 resource, ZCR_STYLUS_V1_ERROR_POINTER_STYLUS_EXISTS, |
| 2993 "pointer has already been associated with a stylus object"); |
| 2994 return; |
| 2995 } |
2991 | 2996 |
2992 wl_resource* stylus_resource = | 2997 wl_resource* stylus_resource = |
2993 wl_resource_create(client, &zcr_pointer_stylus_v1_interface, 1, id); | 2998 wl_resource_create(client, &zcr_pointer_stylus_v1_interface, 1, id); |
2994 | 2999 |
2995 SetImplementation( | 3000 SetImplementation( |
2996 stylus_resource, &pointer_stylus_implementation, | 3001 stylus_resource, &pointer_stylus_implementation, |
2997 base::MakeUnique<WaylandPointerStylusDelegate>(stylus_resource, pointer)); | 3002 base::MakeUnique<WaylandPointerStylusDelegate>(stylus_resource, pointer)); |
2998 } | 3003 } |
2999 | 3004 |
3000 const struct zcr_stylus_v1_interface stylus_implementation = { | 3005 const struct zcr_stylus_v1_interface stylus_implementation = { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3125 wl_global_create(wl_display_.get(), &wp_viewporter_interface, 1, display_, | 3130 wl_global_create(wl_display_.get(), &wp_viewporter_interface, 1, display_, |
3126 bind_viewporter); | 3131 bind_viewporter); |
3127 wl_global_create(wl_display_.get(), &zcr_secure_output_v1_interface, 1, | 3132 wl_global_create(wl_display_.get(), &zcr_secure_output_v1_interface, 1, |
3128 display_, bind_secure_output); | 3133 display_, bind_secure_output); |
3129 wl_global_create(wl_display_.get(), &zcr_alpha_compositing_v1_interface, 1, | 3134 wl_global_create(wl_display_.get(), &zcr_alpha_compositing_v1_interface, 1, |
3130 display_, bind_alpha_compositing); | 3135 display_, bind_alpha_compositing); |
3131 wl_global_create(wl_display_.get(), &zcr_remote_shell_v1_interface, | 3136 wl_global_create(wl_display_.get(), &zcr_remote_shell_v1_interface, |
3132 remote_shell_version, display_, bind_remote_shell); | 3137 remote_shell_version, display_, bind_remote_shell); |
3133 wl_global_create(wl_display_.get(), &zcr_gaming_input_v1_interface, 1, | 3138 wl_global_create(wl_display_.get(), &zcr_gaming_input_v1_interface, 1, |
3134 display_, bind_gaming_input); | 3139 display_, bind_gaming_input); |
3135 wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 1, display_, | 3140 wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 2, display_, |
3136 bind_stylus); | 3141 bind_stylus); |
3137 wl_global_create(wl_display_.get(), &zcr_keyboard_configuration_v1_interface, | 3142 wl_global_create(wl_display_.get(), &zcr_keyboard_configuration_v1_interface, |
3138 2, display_, bind_keyboard_configuration); | 3143 2, display_, bind_keyboard_configuration); |
3139 } | 3144 } |
3140 | 3145 |
3141 Server::~Server() {} | 3146 Server::~Server() {} |
3142 | 3147 |
3143 // static | 3148 // static |
3144 std::unique_ptr<Server> Server::Create(Display* display) { | 3149 std::unique_ptr<Server> Server::Create(Display* display) { |
3145 std::unique_ptr<Server> server(new Server(display)); | 3150 std::unique_ptr<Server> server(new Server(display)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3200 DCHECK(event_loop); | 3205 DCHECK(event_loop); |
3201 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3206 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
3202 } | 3207 } |
3203 | 3208 |
3204 void Server::Flush() { | 3209 void Server::Flush() { |
3205 wl_display_flush_clients(wl_display_.get()); | 3210 wl_display_flush_clients(wl_display_.get()); |
3206 } | 3211 } |
3207 | 3212 |
3208 } // namespace wayland | 3213 } // namespace wayland |
3209 } // namespace exo | 3214 } // namespace exo |
OLD | NEW |