| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "components/exo/sub_surface.h" | 57 #include "components/exo/sub_surface.h" |
| 58 #include "components/exo/surface.h" | 58 #include "components/exo/surface.h" |
| 59 #include "components/exo/surface_property.h" | 59 #include "components/exo/surface_property.h" |
| 60 #include "components/exo/touch.h" | 60 #include "components/exo/touch.h" |
| 61 #include "components/exo/touch_delegate.h" | 61 #include "components/exo/touch_delegate.h" |
| 62 #include "components/exo/wm_helper.h" | 62 #include "components/exo/wm_helper.h" |
| 63 #include "ipc/unix_domain_socket_util.h" | 63 #include "ipc/unix_domain_socket_util.h" |
| 64 #include "third_party/skia/include/core/SkRegion.h" | 64 #include "third_party/skia/include/core/SkRegion.h" |
| 65 #include "ui/aura/window_property.h" | 65 #include "ui/aura/window_property.h" |
| 66 #include "ui/base/hit_test.h" | 66 #include "ui/base/hit_test.h" |
| 67 #include "ui/base/ui_features.h" |
| 67 #include "ui/compositor/compositor_vsync_manager.h" | 68 #include "ui/compositor/compositor_vsync_manager.h" |
| 68 #include "ui/display/display_observer.h" | 69 #include "ui/display/display_observer.h" |
| 69 #include "ui/display/manager/managed_display_info.h" | 70 #include "ui/display/manager/managed_display_info.h" |
| 70 #include "ui/display/screen.h" | 71 #include "ui/display/screen.h" |
| 71 #include "ui/events/keycodes/dom/keycode_converter.h" | 72 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 72 #include "ui/gfx/buffer_format_util.h" | 73 #include "ui/gfx/buffer_format_util.h" |
| 73 #include "ui/gfx/buffer_types.h" | 74 #include "ui/gfx/buffer_types.h" |
| 74 #include "ui/views/widget/widget.h" | 75 #include "ui/views/widget/widget.h" |
| 75 #include "ui/views/widget/widget_observer.h" | 76 #include "ui/views/widget/widget_observer.h" |
| 76 | 77 |
| 77 #if defined(USE_OZONE) | 78 #if defined(USE_OZONE) |
| 78 #include <drm_fourcc.h> | 79 #include <drm_fourcc.h> |
| 79 #include <linux-dmabuf-unstable-v1-server-protocol.h> | 80 #include <linux-dmabuf-unstable-v1-server-protocol.h> |
| 80 #include <wayland-drm-server-protocol.h> | 81 #include <wayland-drm-server-protocol.h> |
| 81 #endif | 82 #endif |
| 82 | 83 |
| 83 #if defined(USE_XKBCOMMON) | 84 #if BUILDFLAG(USE_XKBCOMMON) |
| 84 #include <xkbcommon/xkbcommon.h> | 85 #include <xkbcommon/xkbcommon.h> |
| 85 #include "ui/events/keycodes/scoped_xkb.h" // nogncheck | 86 #include "ui/events/keycodes/scoped_xkb.h" // nogncheck |
| 86 #endif | 87 #endif |
| 87 | 88 |
| 88 DECLARE_SURFACE_PROPERTY_TYPE(wl_resource*); | 89 DECLARE_SURFACE_PROPERTY_TYPE(wl_resource*); |
| 89 DECLARE_SURFACE_PROPERTY_TYPE(bool); | 90 DECLARE_SURFACE_PROPERTY_TYPE(bool); |
| 90 | 91 |
| 91 namespace exo { | 92 namespace exo { |
| 92 namespace wayland { | 93 namespace wayland { |
| 93 namespace { | 94 namespace { |
| (...skipping 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2165 gfx::Point(hotspot_x, hotspot_y)); | 2166 gfx::Point(hotspot_x, hotspot_y)); |
| 2166 } | 2167 } |
| 2167 | 2168 |
| 2168 void pointer_release(wl_client* client, wl_resource* resource) { | 2169 void pointer_release(wl_client* client, wl_resource* resource) { |
| 2169 wl_resource_destroy(resource); | 2170 wl_resource_destroy(resource); |
| 2170 } | 2171 } |
| 2171 | 2172 |
| 2172 const struct wl_pointer_interface pointer_implementation = {pointer_set_cursor, | 2173 const struct wl_pointer_interface pointer_implementation = {pointer_set_cursor, |
| 2173 pointer_release}; | 2174 pointer_release}; |
| 2174 | 2175 |
| 2175 #if defined(USE_XKBCOMMON) | 2176 #if BUILDFLAG(USE_XKBCOMMON) |
| 2176 | 2177 |
| 2177 //////////////////////////////////////////////////////////////////////////////// | 2178 //////////////////////////////////////////////////////////////////////////////// |
| 2178 // wl_keyboard_interface: | 2179 // wl_keyboard_interface: |
| 2179 | 2180 |
| 2180 // Keyboard delegate class that accepts events for surfaces owned by the same | 2181 // Keyboard delegate class that accepts events for surfaces owned by the same |
| 2181 // client as a keyboard resource. | 2182 // client as a keyboard resource. |
| 2182 class WaylandKeyboardDelegate : public KeyboardDelegate { | 2183 class WaylandKeyboardDelegate : public KeyboardDelegate { |
| 2183 public: | 2184 public: |
| 2184 explicit WaylandKeyboardDelegate(wl_resource* keyboard_resource) | 2185 explicit WaylandKeyboardDelegate(wl_resource* keyboard_resource) |
| 2185 : keyboard_resource_(keyboard_resource), | 2186 : keyboard_resource_(keyboard_resource), |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2400 void seat_get_pointer(wl_client* client, wl_resource* resource, uint32_t id) { | 2401 void seat_get_pointer(wl_client* client, wl_resource* resource, uint32_t id) { |
| 2401 wl_resource* pointer_resource = wl_resource_create( | 2402 wl_resource* pointer_resource = wl_resource_create( |
| 2402 client, &wl_pointer_interface, wl_resource_get_version(resource), id); | 2403 client, &wl_pointer_interface, wl_resource_get_version(resource), id); |
| 2403 | 2404 |
| 2404 SetImplementation( | 2405 SetImplementation( |
| 2405 pointer_resource, &pointer_implementation, | 2406 pointer_resource, &pointer_implementation, |
| 2406 base::MakeUnique<Pointer>(new WaylandPointerDelegate(pointer_resource))); | 2407 base::MakeUnique<Pointer>(new WaylandPointerDelegate(pointer_resource))); |
| 2407 } | 2408 } |
| 2408 | 2409 |
| 2409 void seat_get_keyboard(wl_client* client, wl_resource* resource, uint32_t id) { | 2410 void seat_get_keyboard(wl_client* client, wl_resource* resource, uint32_t id) { |
| 2410 #if defined(USE_XKBCOMMON) | 2411 #if BUILDFLAG(USE_XKBCOMMON) |
| 2411 uint32_t version = wl_resource_get_version(resource); | 2412 uint32_t version = wl_resource_get_version(resource); |
| 2412 wl_resource* keyboard_resource = | 2413 wl_resource* keyboard_resource = |
| 2413 wl_resource_create(client, &wl_keyboard_interface, version, id); | 2414 wl_resource_create(client, &wl_keyboard_interface, version, id); |
| 2414 | 2415 |
| 2415 SetImplementation(keyboard_resource, &keyboard_implementation, | 2416 SetImplementation(keyboard_resource, &keyboard_implementation, |
| 2416 base::MakeUnique<Keyboard>( | 2417 base::MakeUnique<Keyboard>( |
| 2417 new WaylandKeyboardDelegate(keyboard_resource))); | 2418 new WaylandKeyboardDelegate(keyboard_resource))); |
| 2418 | 2419 |
| 2419 // TODO(reveman): Keep repeat info synchronized with chromium and the host OS. | 2420 // TODO(reveman): Keep repeat info synchronized with chromium and the host OS. |
| 2420 if (version >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) | 2421 if (version >= WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2445 void bind_seat(wl_client* client, void* data, uint32_t version, uint32_t id) { | 2446 void bind_seat(wl_client* client, void* data, uint32_t version, uint32_t id) { |
| 2446 wl_resource* resource = wl_resource_create( | 2447 wl_resource* resource = wl_resource_create( |
| 2447 client, &wl_seat_interface, std::min(version, seat_version), id); | 2448 client, &wl_seat_interface, std::min(version, seat_version), id); |
| 2448 | 2449 |
| 2449 wl_resource_set_implementation(resource, &seat_implementation, data, nullptr); | 2450 wl_resource_set_implementation(resource, &seat_implementation, data, nullptr); |
| 2450 | 2451 |
| 2451 if (version >= WL_SEAT_NAME_SINCE_VERSION) | 2452 if (version >= WL_SEAT_NAME_SINCE_VERSION) |
| 2452 wl_seat_send_name(resource, "default"); | 2453 wl_seat_send_name(resource, "default"); |
| 2453 | 2454 |
| 2454 uint32_t capabilities = WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_TOUCH; | 2455 uint32_t capabilities = WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_TOUCH; |
| 2455 #if defined(USE_XKBCOMMON) | 2456 #if BUILDFLAG(USE_XKBCOMMON) |
| 2456 capabilities |= WL_SEAT_CAPABILITY_KEYBOARD; | 2457 capabilities |= WL_SEAT_CAPABILITY_KEYBOARD; |
| 2457 #endif | 2458 #endif |
| 2458 wl_seat_send_capabilities(resource, capabilities); | 2459 wl_seat_send_capabilities(resource, capabilities); |
| 2459 } | 2460 } |
| 2460 | 2461 |
| 2461 //////////////////////////////////////////////////////////////////////////////// | 2462 //////////////////////////////////////////////////////////////////////////////// |
| 2462 // wp_viewport_interface: | 2463 // wp_viewport_interface: |
| 2463 | 2464 |
| 2464 // Implements the viewport interface to a Surface. The "viewport"-state is set | 2465 // Implements the viewport interface to a Surface. The "viewport"-state is set |
| 2465 // to null upon destruction. A window property will be set during the lifetime | 2466 // to null upon destruction. A window property will be set during the lifetime |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 DCHECK(event_loop); | 3073 DCHECK(event_loop); |
| 3073 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3074 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3074 } | 3075 } |
| 3075 | 3076 |
| 3076 void Server::Flush() { | 3077 void Server::Flush() { |
| 3077 wl_display_flush_clients(wl_display_.get()); | 3078 wl_display_flush_clients(wl_display_.get()); |
| 3078 } | 3079 } |
| 3079 | 3080 |
| 3080 } // namespace wayland | 3081 } // namespace wayland |
| 3081 } // namespace exo | 3082 } // namespace exo |
| OLD | NEW |