| 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 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2950 pointer_stylus_destroy}; | 2950 pointer_stylus_destroy}; |
| 2951 | 2951 |
| 2952 //////////////////////////////////////////////////////////////////////////////// | 2952 //////////////////////////////////////////////////////////////////////////////// |
| 2953 // stylus interface: | 2953 // stylus interface: |
| 2954 | 2954 |
| 2955 void stylus_get_pointer_stylus(wl_client* client, | 2955 void stylus_get_pointer_stylus(wl_client* client, |
| 2956 wl_resource* resource, | 2956 wl_resource* resource, |
| 2957 uint32_t id, | 2957 uint32_t id, |
| 2958 wl_resource* pointer_resource) { | 2958 wl_resource* pointer_resource) { |
| 2959 Pointer* pointer = GetUserDataAs<Pointer>(pointer_resource); | 2959 Pointer* pointer = GetUserDataAs<Pointer>(pointer_resource); |
| 2960 if (pointer->HasStylusDelegate()) { |
| 2961 wl_resource_post_error( |
| 2962 resource, ZCR_STYLUS_V1_ERROR_POINTER_STYLUS_EXISTS, |
| 2963 "pointer has already been associated with a stylus object"); |
| 2964 return; |
| 2965 } |
| 2960 | 2966 |
| 2961 wl_resource* stylus_resource = | 2967 wl_resource* stylus_resource = |
| 2962 wl_resource_create(client, &zcr_pointer_stylus_v1_interface, 1, id); | 2968 wl_resource_create(client, &zcr_pointer_stylus_v1_interface, 1, id); |
| 2963 | 2969 |
| 2964 SetImplementation( | 2970 SetImplementation( |
| 2965 stylus_resource, &pointer_stylus_implementation, | 2971 stylus_resource, &pointer_stylus_implementation, |
| 2966 base::MakeUnique<WaylandPointerStylusDelegate>(stylus_resource, pointer)); | 2972 base::MakeUnique<WaylandPointerStylusDelegate>(stylus_resource, pointer)); |
| 2967 } | 2973 } |
| 2968 | 2974 |
| 2969 const struct zcr_stylus_v1_interface stylus_implementation = { | 2975 const struct zcr_stylus_v1_interface stylus_implementation = { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3009 wl_global_create(wl_display_.get(), &wp_viewporter_interface, 1, display_, | 3015 wl_global_create(wl_display_.get(), &wp_viewporter_interface, 1, display_, |
| 3010 bind_viewporter); | 3016 bind_viewporter); |
| 3011 wl_global_create(wl_display_.get(), &zcr_secure_output_v1_interface, 1, | 3017 wl_global_create(wl_display_.get(), &zcr_secure_output_v1_interface, 1, |
| 3012 display_, bind_secure_output); | 3018 display_, bind_secure_output); |
| 3013 wl_global_create(wl_display_.get(), &zcr_alpha_compositing_v1_interface, 1, | 3019 wl_global_create(wl_display_.get(), &zcr_alpha_compositing_v1_interface, 1, |
| 3014 display_, bind_alpha_compositing); | 3020 display_, bind_alpha_compositing); |
| 3015 wl_global_create(wl_display_.get(), &zcr_remote_shell_v1_interface, | 3021 wl_global_create(wl_display_.get(), &zcr_remote_shell_v1_interface, |
| 3016 remote_shell_version, display_, bind_remote_shell); | 3022 remote_shell_version, display_, bind_remote_shell); |
| 3017 wl_global_create(wl_display_.get(), &zcr_gaming_input_v1_interface, 1, | 3023 wl_global_create(wl_display_.get(), &zcr_gaming_input_v1_interface, 1, |
| 3018 display_, bind_gaming_input); | 3024 display_, bind_gaming_input); |
| 3019 wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 1, display_, | 3025 wl_global_create(wl_display_.get(), &zcr_stylus_v1_interface, 2, display_, |
| 3020 bind_stylus); | 3026 bind_stylus); |
| 3021 } | 3027 } |
| 3022 | 3028 |
| 3023 Server::~Server() {} | 3029 Server::~Server() {} |
| 3024 | 3030 |
| 3025 // static | 3031 // static |
| 3026 std::unique_ptr<Server> Server::Create(Display* display) { | 3032 std::unique_ptr<Server> Server::Create(Display* display) { |
| 3027 std::unique_ptr<Server> server(new Server(display)); | 3033 std::unique_ptr<Server> server(new Server(display)); |
| 3028 | 3034 |
| 3029 char* runtime_dir = getenv("XDG_RUNTIME_DIR"); | 3035 char* runtime_dir = getenv("XDG_RUNTIME_DIR"); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3082 DCHECK(event_loop); | 3088 DCHECK(event_loop); |
| 3083 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3089 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3084 } | 3090 } |
| 3085 | 3091 |
| 3086 void Server::Flush() { | 3092 void Server::Flush() { |
| 3087 wl_display_flush_clients(wl_display_.get()); | 3093 wl_display_flush_clients(wl_display_.get()); |
| 3088 } | 3094 } |
| 3089 | 3095 |
| 3090 } // namespace wayland | 3096 } // namespace wayland |
| 3091 } // namespace exo | 3097 } // namespace exo |
| OLD | NEW |