OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/ozone/platform/wayland/wayland_connection.h" | 5 #include "ui/ozone/platform/wayland/wayland_connection.h" |
6 | 6 |
7 #include <xdg-shell-unstable-v5-client-protocol.h> | 7 #include <xdg-shell-unstable-v5-client-protocol.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "ui/ozone/platform/wayland/wayland_object.h" | 15 #include "ui/ozone/platform/wayland/wayland_object.h" |
16 #include "ui/ozone/platform/wayland/wayland_window.h" | 16 #include "ui/ozone/platform/wayland/wayland_window.h" |
17 | 17 |
18 static_assert(XDG_SHELL_VERSION_CURRENT == 5, "Unsupported xdg-shell version"); | 18 static_assert(XDG_SHELL_VERSION_CURRENT == 5, "Unsupported xdg-shell version"); |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 namespace { | 21 namespace { |
22 const uint32_t kMaxCompositorVersion = 4; | 22 const uint32_t kMaxCompositorVersion = 4; |
23 const uint32_t kMaxSeatVersion = 4; | 23 const uint32_t kMaxSeatVersion = 4; |
24 const uint32_t kMaxShmVersion = 1; | 24 const uint32_t kMaxShmVersion = 1; |
25 const uint32_t kMaxXdgShellVersion = 1; | 25 const uint32_t kMaxXdgShellVersion = 1; |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 WaylandConnection::WaylandConnection() {} | 28 WaylandConnection::WaylandConnection() : controller_(FROM_HERE) {} |
29 | 29 |
30 WaylandConnection::~WaylandConnection() {} | 30 WaylandConnection::~WaylandConnection() {} |
31 | 31 |
32 bool WaylandConnection::Initialize() { | 32 bool WaylandConnection::Initialize() { |
33 static const wl_registry_listener registry_listener = { | 33 static const wl_registry_listener registry_listener = { |
34 &WaylandConnection::Global, &WaylandConnection::GlobalRemove, | 34 &WaylandConnection::Global, &WaylandConnection::GlobalRemove, |
35 }; | 35 }; |
36 | 36 |
37 display_.reset(wl_display_connect(nullptr)); | 37 display_.reset(wl_display_connect(nullptr)); |
38 if (!display_) { | 38 if (!display_) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 void WaylandConnection::Name(void* data, wl_seat* seat, const char* name) {} | 248 void WaylandConnection::Name(void* data, wl_seat* seat, const char* name) {} |
249 | 249 |
250 // static | 250 // static |
251 void WaylandConnection::Ping(void* data, xdg_shell* shell, uint32_t serial) { | 251 void WaylandConnection::Ping(void* data, xdg_shell* shell, uint32_t serial) { |
252 WaylandConnection* connection = static_cast<WaylandConnection*>(data); | 252 WaylandConnection* connection = static_cast<WaylandConnection*>(data); |
253 xdg_shell_pong(shell, serial); | 253 xdg_shell_pong(shell, serial); |
254 connection->ScheduleFlush(); | 254 connection->ScheduleFlush(); |
255 } | 255 } |
256 | 256 |
257 } // namespace ui | 257 } // namespace ui |
OLD | NEW |