Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1588)

Unified Diff: ui/ozone/platform/wayland/fake_server.cc

Issue 2639053002: [ozone/wayland] Implement basic keyboard handling support (Closed)
Patch Set: addressed kpschoedel's review Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/wayland/fake_server.h ('k') | ui/ozone/platform/wayland/ozone_platform_wayland.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/wayland/fake_server.cc
diff --git a/ui/ozone/platform/wayland/fake_server.cc b/ui/ozone/platform/wayland/fake_server.cc
index 52424c96365ad96abe238f5ac099b637028945ff..2b84d05b886ec0d19db66dceb1c05d49afcb4f7f 100644
--- a/ui/ozone/platform/wayland/fake_server.cc
+++ b/ui/ozone/platform/wayland/fake_server.cc
@@ -137,13 +137,30 @@ void GetPointer(wl_client* client, wl_resource* resource, uint32_t id) {
seat->pointer.reset(new MockPointer(pointer_resource));
}
+void GetKeyboard(wl_client* client, wl_resource* resource, uint32_t id) {
+ auto seat = static_cast<MockSeat*>(wl_resource_get_user_data(resource));
+ wl_resource* keyboard_resource = wl_resource_create(
+ client, &wl_keyboard_interface, wl_resource_get_version(resource), id);
+ if (!keyboard_resource) {
+ wl_client_post_no_memory(client);
+ return;
+ }
+ seat->keyboard.reset(new MockKeyboard(keyboard_resource));
+}
+
const struct wl_seat_interface seat_impl = {
&GetPointer, // get_pointer
- nullptr, // get_keyboard
+ &GetKeyboard, // get_keyboard
nullptr, // get_touch,
&DestroyResource, // release
};
+// wl_keyboard
+
+const struct wl_keyboard_interface keyboard_impl = {
+ &DestroyResource, // release
+};
+
// wl_pointer
const struct wl_pointer_interface pointer_impl = {
@@ -245,6 +262,13 @@ MockPointer::MockPointer(wl_resource* resource) : ServerObject(resource) {
MockPointer::~MockPointer() {}
+MockKeyboard::MockKeyboard(wl_resource* resource) : ServerObject(resource) {
+ wl_resource_set_implementation(resource, &keyboard_impl, this,
+ &ServerObject::OnResourceDestroyed);
+}
+
+MockKeyboard::~MockKeyboard() {}
+
void GlobalDeleter::operator()(wl_global* global) {
wl_global_destroy(global);
}
« no previous file with comments | « ui/ozone/platform/wayland/fake_server.h ('k') | ui/ozone/platform/wayland/ozone_platform_wayland.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698