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" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 wl_seat* seat, | 186 wl_seat* seat, |
187 uint32_t capabilities) { | 187 uint32_t capabilities) { |
188 WaylandConnection* connection = static_cast<WaylandConnection*>(data); | 188 WaylandConnection* connection = static_cast<WaylandConnection*>(data); |
189 if (capabilities & WL_SEAT_CAPABILITY_POINTER) { | 189 if (capabilities & WL_SEAT_CAPABILITY_POINTER) { |
190 if (!connection->pointer_) { | 190 if (!connection->pointer_) { |
191 wl_pointer* pointer = wl_seat_get_pointer(connection->seat_.get()); | 191 wl_pointer* pointer = wl_seat_get_pointer(connection->seat_.get()); |
192 if (!pointer) { | 192 if (!pointer) { |
193 LOG(ERROR) << "Failed to get wl_pointer from seat"; | 193 LOG(ERROR) << "Failed to get wl_pointer from seat"; |
194 return; | 194 return; |
195 } | 195 } |
196 connection->pointer_ = base::WrapUnique(new WaylandPointer( | 196 connection->pointer_ = base::MakeUnique<WaylandPointer>( |
197 pointer, base::Bind(&WaylandConnection::DispatchUiEvent, | 197 pointer, base::Bind(&WaylandConnection::DispatchUiEvent, |
198 base::Unretained(connection)))); | 198 base::Unretained(connection))); |
199 } | 199 } |
200 } else if (connection->pointer_) { | 200 } else if (connection->pointer_) { |
201 connection->pointer_.reset(); | 201 connection->pointer_.reset(); |
202 } | 202 } |
203 connection->ScheduleFlush(); | 203 connection->ScheduleFlush(); |
204 } | 204 } |
205 | 205 |
206 // static | 206 // static |
207 void WaylandConnection::Name(void* data, wl_seat* seat, const char* name) {} | 207 void WaylandConnection::Name(void* data, wl_seat* seat, const char* name) {} |
208 | 208 |
209 // static | 209 // static |
210 void WaylandConnection::Ping(void* data, xdg_shell* shell, uint32_t serial) { | 210 void WaylandConnection::Ping(void* data, xdg_shell* shell, uint32_t serial) { |
211 WaylandConnection* connection = static_cast<WaylandConnection*>(data); | 211 WaylandConnection* connection = static_cast<WaylandConnection*>(data); |
212 xdg_shell_pong(shell, serial); | 212 xdg_shell_pong(shell, serial); |
213 connection->ScheduleFlush(); | 213 connection->ScheduleFlush(); |
214 } | 214 } |
215 | 215 |
216 } // namespace ui | 216 } // namespace ui |
OLD | NEW |