| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 LOG(ERROR) << "Failed to get wl_pointer from seat"; | 220 LOG(ERROR) << "Failed to get wl_pointer from seat"; |
| 221 return; | 221 return; |
| 222 } | 222 } |
| 223 connection->pointer_ = base::MakeUnique<WaylandPointer>( | 223 connection->pointer_ = base::MakeUnique<WaylandPointer>( |
| 224 pointer, base::Bind(&WaylandConnection::DispatchUiEvent, | 224 pointer, base::Bind(&WaylandConnection::DispatchUiEvent, |
| 225 base::Unretained(connection))); | 225 base::Unretained(connection))); |
| 226 } | 226 } |
| 227 } else if (connection->pointer_) { | 227 } else if (connection->pointer_) { |
| 228 connection->pointer_.reset(); | 228 connection->pointer_.reset(); |
| 229 } | 229 } |
| 230 if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD) { |
| 231 if (!connection->keyboard_) { |
| 232 wl_keyboard* keyboard = wl_seat_get_keyboard(connection->seat_.get()); |
| 233 if (!keyboard) { |
| 234 LOG(ERROR) << "Failed to get wl_keyboard from seat"; |
| 235 return; |
| 236 } |
| 237 connection->keyboard_ = base::MakeUnique<WaylandKeyboard>( |
| 238 keyboard, base::Bind(&WaylandConnection::DispatchUiEvent, |
| 239 base::Unretained(connection))); |
| 240 } |
| 241 } else if (connection->keyboard_) { |
| 242 connection->keyboard_.reset(); |
| 243 } |
| 230 connection->ScheduleFlush(); | 244 connection->ScheduleFlush(); |
| 231 } | 245 } |
| 232 | 246 |
| 233 // static | 247 // static |
| 234 void WaylandConnection::Name(void* data, wl_seat* seat, const char* name) {} | 248 void WaylandConnection::Name(void* data, wl_seat* seat, const char* name) {} |
| 235 | 249 |
| 236 // static | 250 // static |
| 237 void WaylandConnection::Ping(void* data, xdg_shell* shell, uint32_t serial) { | 251 void WaylandConnection::Ping(void* data, xdg_shell* shell, uint32_t serial) { |
| 238 WaylandConnection* connection = static_cast<WaylandConnection*>(data); | 252 WaylandConnection* connection = static_cast<WaylandConnection*>(data); |
| 239 xdg_shell_pong(shell, serial); | 253 xdg_shell_pong(shell, serial); |
| 240 connection->ScheduleFlush(); | 254 connection->ScheduleFlush(); |
| 241 } | 255 } |
| 242 | 256 |
| 243 } // namespace ui | 257 } // namespace ui |
| OLD | NEW |