| 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 <alpha-compositing-unstable-v1-server-protocol.h> | 7 #include <alpha-compositing-unstable-v1-server-protocol.h> |
| 8 #include <gaming-input-unstable-v1-server-protocol.h> | 8 #include <gaming-input-unstable-v1-server-protocol.h> |
| 9 #include <gaming-input-unstable-v2-server-protocol.h> | 9 #include <gaming-input-unstable-v2-server-protocol.h> |
| 10 #include <grp.h> | 10 #include <grp.h> |
| (...skipping 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3556 wl_resource* resource, | 3556 wl_resource* resource, |
| 3557 uint32_t id, | 3557 uint32_t id, |
| 3558 wl_resource* seat) { | 3558 wl_resource* seat) { |
| 3559 wl_resource* gaming_seat_resource = | 3559 wl_resource* gaming_seat_resource = |
| 3560 wl_resource_create(client, &zcr_gaming_seat_v2_interface, | 3560 wl_resource_create(client, &zcr_gaming_seat_v2_interface, |
| 3561 wl_resource_get_version(resource), id); | 3561 wl_resource_get_version(resource), id); |
| 3562 | 3562 |
| 3563 base::Thread* gaming_input_thread = GetUserDataAs<base::Thread>(resource); | 3563 base::Thread* gaming_input_thread = GetUserDataAs<base::Thread>(resource); |
| 3564 | 3564 |
| 3565 SetImplementation(gaming_seat_resource, &gaming_seat_implementation, | 3565 SetImplementation(gaming_seat_resource, &gaming_seat_implementation, |
| 3566 base::MakeUnique<GamingSeat>( | 3566 std::unique_ptr<GamingSeat>(GamingSeat::CreateGamingSeat( |
| 3567 new WaylandGamingSeatDelegate(gaming_seat_resource), | 3567 new WaylandGamingSeatDelegate(gaming_seat_resource), |
| 3568 gaming_input_thread->task_runner().get())); | 3568 gaming_input_thread))); |
| 3569 } | 3569 } |
| 3570 | 3570 |
| 3571 void gaming_input_destroy(wl_client* client, wl_resource* resource) { | 3571 void gaming_input_destroy(wl_client* client, wl_resource* resource) { |
| 3572 wl_resource_destroy(resource); | 3572 wl_resource_destroy(resource); |
| 3573 } | 3573 } |
| 3574 | 3574 |
| 3575 const struct zcr_gaming_input_v2_interface gaming_input_implementation = { | 3575 const struct zcr_gaming_input_v2_interface gaming_input_implementation = { |
| 3576 gaming_input_get_gaming_seat, gaming_input_destroy}; | 3576 gaming_input_get_gaming_seat, gaming_input_destroy}; |
| 3577 | 3577 |
| 3578 void bind_gaming_input(wl_client* client, | 3578 void bind_gaming_input(wl_client* client, |
| 3579 void* data, | 3579 void* data, |
| 3580 uint32_t version, | 3580 uint32_t version, |
| 3581 uint32_t id) { | 3581 uint32_t id) { |
| 3582 wl_resource* resource = | 3582 wl_resource* resource = |
| 3583 wl_resource_create(client, &zcr_gaming_input_v2_interface, version, id); | 3583 wl_resource_create(client, &zcr_gaming_input_v2_interface, version, id); |
| 3584 | 3584 |
| 3585 std::unique_ptr<base::Thread> gaming_input_thread( | 3585 SetImplementation( |
| 3586 new base::Thread("Exo gaming input polling thread.")); | 3586 resource, &gaming_input_implementation, |
| 3587 gaming_input_thread->StartWithOptions( | 3587 std::unique_ptr<base::Thread>(GamingSeat::CreatePollingThreadIfNeeded())); |
| 3588 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); | |
| 3589 | |
| 3590 SetImplementation(resource, &gaming_input_implementation, | |
| 3591 std::move(gaming_input_thread)); | |
| 3592 } | 3588 } |
| 3593 | 3589 |
| 3594 //////////////////////////////////////////////////////////////////////////////// | 3590 //////////////////////////////////////////////////////////////////////////////// |
| 3595 // dummy interface for gaming_input_v1: | 3591 // dummy interface for gaming_input_v1: |
| 3596 /* Following is a dummy interface for gaming_input_v1. | 3592 /* Following is a dummy interface for gaming_input_v1. |
| 3597 * It makes sure the "old" android with v1 interface won't break. However, "old" | 3593 * It makes sure the "old" android with v1 interface won't break. However, "old" |
| 3598 * android will not receive any gamepad input. This interface implementation | 3594 * android will not receive any gamepad input. This interface implementation |
| 3599 * should be removed once android is updated. | 3595 * should be removed once android is updated. |
| 3600 */ | 3596 */ |
| 3601 // TODO(jkwang): Remove the following interface function once android updated. | 3597 // TODO(jkwang): Remove the following interface function once android updated. |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4043 DCHECK(event_loop); | 4039 DCHECK(event_loop); |
| 4044 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 4040 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 4045 } | 4041 } |
| 4046 | 4042 |
| 4047 void Server::Flush() { | 4043 void Server::Flush() { |
| 4048 wl_display_flush_clients(wl_display_.get()); | 4044 wl_display_flush_clients(wl_display_.get()); |
| 4049 } | 4045 } |
| 4050 | 4046 |
| 4051 } // namespace wayland | 4047 } // namespace wayland |
| 4052 } // namespace exo | 4048 } // namespace exo |
| OLD | NEW |