| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 DEFINE_SURFACE_PROPERTY_KEY(bool, kSurfaceHasViewportKey, false); | 149 DEFINE_SURFACE_PROPERTY_KEY(bool, kSurfaceHasViewportKey, false); |
| 150 | 150 |
| 151 // A property key containing a boolean set to true if a security object is | 151 // A property key containing a boolean set to true if a security object is |
| 152 // associated with window. | 152 // associated with window. |
| 153 DEFINE_SURFACE_PROPERTY_KEY(bool, kSurfaceHasSecurityKey, false); | 153 DEFINE_SURFACE_PROPERTY_KEY(bool, kSurfaceHasSecurityKey, false); |
| 154 | 154 |
| 155 // A property key containing a boolean set to true if a blending object is | 155 // A property key containing a boolean set to true if a blending object is |
| 156 // associated with window. | 156 // associated with window. |
| 157 DEFINE_SURFACE_PROPERTY_KEY(bool, kSurfaceHasBlendingKey, false); | 157 DEFINE_SURFACE_PROPERTY_KEY(bool, kSurfaceHasBlendingKey, false); |
| 158 | 158 |
| 159 #if defined(USE_OZONE) | |
| 160 // A property key containing a boolean set to true if a blending object is | 159 // A property key containing a boolean set to true if a blending object is |
| 161 // associated with window. | 160 // associated with window. |
| 162 DEFINE_SURFACE_PROPERTY_KEY(bool, kSurfaceHasSynchronizationKey, false); | 161 DEFINE_SURFACE_PROPERTY_KEY(bool, kSurfaceHasSynchronizationKey, false); |
| 163 #endif | |
| 164 | 162 |
| 165 wl_resource* GetSurfaceResource(Surface* surface) { | 163 wl_resource* GetSurfaceResource(Surface* surface) { |
| 166 return surface->GetProperty(kSurfaceResourceKey); | 164 return surface->GetProperty(kSurfaceResourceKey); |
| 167 } | 165 } |
| 168 | 166 |
| 169 //////////////////////////////////////////////////////////////////////////////// | 167 //////////////////////////////////////////////////////////////////////////////// |
| 170 // wl_buffer_interface: | 168 // wl_buffer_interface: |
| 171 | 169 |
| 172 void buffer_destroy(wl_client* client, wl_resource* resource) { | 170 void buffer_destroy(wl_client* client, wl_resource* resource) { |
| 173 wl_resource_destroy(resource); | 171 wl_resource_destroy(resource); |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 uint32_t id) { | 760 uint32_t id) { |
| 763 wl_resource* resource = | 761 wl_resource* resource = |
| 764 wl_resource_create(client, &zwp_linux_dmabuf_v1_interface, 1, id); | 762 wl_resource_create(client, &zwp_linux_dmabuf_v1_interface, 1, id); |
| 765 | 763 |
| 766 wl_resource_set_implementation(resource, &linux_dmabuf_implementation, data, | 764 wl_resource_set_implementation(resource, &linux_dmabuf_implementation, data, |
| 767 nullptr); | 765 nullptr); |
| 768 | 766 |
| 769 for (const auto& supported_format : dmabuf_supported_formats) | 767 for (const auto& supported_format : dmabuf_supported_formats) |
| 770 zwp_linux_dmabuf_v1_send_format(resource, supported_format.dmabuf_format); | 768 zwp_linux_dmabuf_v1_send_format(resource, supported_format.dmabuf_format); |
| 771 } | 769 } |
| 770 #endif // defined(USE_OZONE) |
| 772 | 771 |
| 773 //////////////////////////////////////////////////////////////////////////////// | 772 //////////////////////////////////////////////////////////////////////////////// |
| 774 // synchronization interface: | 773 // synchronization interface: |
| 775 | 774 |
| 776 // Implements the synchronization interface to a Surface. A window property | 775 // Implements the synchronization interface to a Surface. A window property |
| 777 // will be set during the lifetime of this class to prevent multiple instances | 776 // will be set during the lifetime of this class to prevent multiple instances |
| 778 // from being created for the same Surface. | 777 // from being created for the same Surface. |
| 779 class Synchronization : public SurfaceObserver { | 778 class Synchronization : public SurfaceObserver { |
| 780 public: | 779 public: |
| 781 explicit Synchronization(Display* display, Surface* surface) | 780 explicit Synchronization(Display* display, Surface* surface) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 | 866 |
| 868 void bind_linux_explicit_synchronization(wl_client* client, | 867 void bind_linux_explicit_synchronization(wl_client* client, |
| 869 void* data, | 868 void* data, |
| 870 uint32_t version, | 869 uint32_t version, |
| 871 uint32_t id) { | 870 uint32_t id) { |
| 872 wl_resource* resource = wl_resource_create( | 871 wl_resource* resource = wl_resource_create( |
| 873 client, &zcr_linux_explicit_synchronization_v1_interface, 1, id); | 872 client, &zcr_linux_explicit_synchronization_v1_interface, 1, id); |
| 874 wl_resource_set_implementation( | 873 wl_resource_set_implementation( |
| 875 resource, &linux_explicit_synchronization_implementation, data, nullptr); | 874 resource, &linux_explicit_synchronization_implementation, data, nullptr); |
| 876 } | 875 } |
| 877 #endif | |
| 878 | 876 |
| 879 //////////////////////////////////////////////////////////////////////////////// | 877 //////////////////////////////////////////////////////////////////////////////// |
| 880 // wl_subsurface_interface: | 878 // wl_subsurface_interface: |
| 881 | 879 |
| 882 void subsurface_destroy(wl_client* client, wl_resource* resource) { | 880 void subsurface_destroy(wl_client* client, wl_resource* resource) { |
| 883 wl_resource_destroy(resource); | 881 wl_resource_destroy(resource); |
| 884 } | 882 } |
| 885 | 883 |
| 886 void subsurface_set_position(wl_client* client, | 884 void subsurface_set_position(wl_client* client, |
| 887 wl_resource* resource, | 885 wl_resource* resource, |
| (...skipping 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3086 Server::Server(Display* display) | 3084 Server::Server(Display* display) |
| 3087 : display_(display), wl_display_(wl_display_create()) { | 3085 : display_(display), wl_display_(wl_display_create()) { |
| 3088 wl_global_create(wl_display_.get(), &wl_compositor_interface, | 3086 wl_global_create(wl_display_.get(), &wl_compositor_interface, |
| 3089 compositor_version, display_, bind_compositor); | 3087 compositor_version, display_, bind_compositor); |
| 3090 wl_global_create(wl_display_.get(), &wl_shm_interface, 1, display_, bind_shm); | 3088 wl_global_create(wl_display_.get(), &wl_shm_interface, 1, display_, bind_shm); |
| 3091 #if defined(USE_OZONE) | 3089 #if defined(USE_OZONE) |
| 3092 wl_global_create(wl_display_.get(), &wl_drm_interface, drm_version, display_, | 3090 wl_global_create(wl_display_.get(), &wl_drm_interface, drm_version, display_, |
| 3093 bind_drm); | 3091 bind_drm); |
| 3094 wl_global_create(wl_display_.get(), &zwp_linux_dmabuf_v1_interface, 1, | 3092 wl_global_create(wl_display_.get(), &zwp_linux_dmabuf_v1_interface, 1, |
| 3095 display_, bind_linux_dmabuf); | 3093 display_, bind_linux_dmabuf); |
| 3094 #endif // defined(USE_OZONE) |
| 3096 wl_global_create(wl_display_.get(), | 3095 wl_global_create(wl_display_.get(), |
| 3097 &zcr_linux_explicit_synchronization_v1_interface, 1, | 3096 &zcr_linux_explicit_synchronization_v1_interface, 1, |
| 3098 display_, bind_linux_explicit_synchronization); | 3097 display_, bind_linux_explicit_synchronization); |
| 3099 #endif | |
| 3100 wl_global_create(wl_display_.get(), &wl_subcompositor_interface, 1, display_, | 3098 wl_global_create(wl_display_.get(), &wl_subcompositor_interface, 1, display_, |
| 3101 bind_subcompositor); | 3099 bind_subcompositor); |
| 3102 wl_global_create(wl_display_.get(), &wl_shell_interface, 1, display_, | 3100 wl_global_create(wl_display_.get(), &wl_shell_interface, 1, display_, |
| 3103 bind_shell); | 3101 bind_shell); |
| 3104 wl_global_create(wl_display_.get(), &wl_output_interface, output_version, | 3102 wl_global_create(wl_display_.get(), &wl_output_interface, output_version, |
| 3105 display_, bind_output); | 3103 display_, bind_output); |
| 3106 wl_global_create(wl_display_.get(), &xdg_shell_interface, 1, display_, | 3104 wl_global_create(wl_display_.get(), &xdg_shell_interface, 1, display_, |
| 3107 bind_xdg_shell); | 3105 bind_xdg_shell); |
| 3108 wl_global_create(wl_display_.get(), &zcr_vsync_feedback_v1_interface, 1, | 3106 wl_global_create(wl_display_.get(), &zcr_vsync_feedback_v1_interface, 1, |
| 3109 display_, bind_vsync_feedback); | 3107 display_, bind_vsync_feedback); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3187 DCHECK(event_loop); | 3185 DCHECK(event_loop); |
| 3188 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3186 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3189 } | 3187 } |
| 3190 | 3188 |
| 3191 void Server::Flush() { | 3189 void Server::Flush() { |
| 3192 wl_display_flush_clients(wl_display_.get()); | 3190 wl_display_flush_clients(wl_display_.get()); |
| 3193 } | 3191 } |
| 3194 | 3192 |
| 3195 } // namespace wayland | 3193 } // namespace wayland |
| 3196 } // namespace exo | 3194 } // namespace exo |
| OLD | NEW |