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

Side by Side Diff: components/exo/wayland/server.cc

Issue 2560633002: exo: Implement v6 of touch protocol including shape and frame event (Closed)
Patch Set: extend event_generator to test touch radius Created 4 years 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 unified diff | Download patch
OLDNEW
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 <grp.h> 7 #include <grp.h>
8 #include <linux/input.h> 8 #include <linux/input.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 void OnTouchDown(Surface* surface, 2379 void OnTouchDown(Surface* surface,
2380 base::TimeTicks time_stamp, 2380 base::TimeTicks time_stamp,
2381 int id, 2381 int id,
2382 const gfx::Point& location) override { 2382 const gfx::Point& location) override {
2383 wl_resource* surface_resource = GetSurfaceResource(surface); 2383 wl_resource* surface_resource = GetSurfaceResource(surface);
2384 DCHECK(surface_resource); 2384 DCHECK(surface_resource);
2385 wl_touch_send_down(touch_resource_, next_serial(), 2385 wl_touch_send_down(touch_resource_, next_serial(),
2386 TimeTicksToMilliseconds(time_stamp), surface_resource, 2386 TimeTicksToMilliseconds(time_stamp), surface_resource,
2387 id, wl_fixed_from_int(location.x()), 2387 id, wl_fixed_from_int(location.x()),
2388 wl_fixed_from_int(location.y())); 2388 wl_fixed_from_int(location.y()));
2389 wl_client_flush(client());
2390 } 2389 }
2391 void OnTouchUp(base::TimeTicks time_stamp, int id) override { 2390 void OnTouchUp(base::TimeTicks time_stamp, int id) override {
2392 wl_touch_send_up(touch_resource_, next_serial(), 2391 wl_touch_send_up(touch_resource_, next_serial(),
2393 TimeTicksToMilliseconds(time_stamp), id); 2392 TimeTicksToMilliseconds(time_stamp), id);
2394 wl_client_flush(client());
2395 } 2393 }
2396 void OnTouchMotion(base::TimeTicks time_stamp, 2394 void OnTouchMotion(base::TimeTicks time_stamp,
2397 int id, 2395 int id,
2398 const gfx::Point& location) override { 2396 const gfx::Point& location) override {
2399 wl_touch_send_motion(touch_resource_, TimeTicksToMilliseconds(time_stamp), 2397 wl_touch_send_motion(touch_resource_, TimeTicksToMilliseconds(time_stamp),
2400 id, wl_fixed_from_int(location.x()), 2398 id, wl_fixed_from_int(location.x()),
2401 wl_fixed_from_int(location.y())); 2399 wl_fixed_from_int(location.y()));
2400 }
2401 void OnTouchShape(int id, float major, float minor) override {
2402 if (wl_resource_get_version(touch_resource_) >=
2403 WL_TOUCH_SHAPE_SINCE_VERSION) {
2404 wl_touch_send_shape(touch_resource_, id, wl_fixed_from_double(major),
2405 wl_fixed_from_double(minor));
2406 }
2407 }
2408 void OnTouchFrame() override {
2409 if (wl_resource_get_version(touch_resource_) >=
2410 WL_TOUCH_FRAME_SINCE_VERSION) {
2411 wl_touch_send_frame(touch_resource_);
2412 }
2402 wl_client_flush(client()); 2413 wl_client_flush(client());
2403 } 2414 }
2404 void OnTouchCancel() override { 2415 void OnTouchCancel() override {
2405 wl_touch_send_cancel(touch_resource_); 2416 wl_touch_send_cancel(touch_resource_);
2406 wl_client_flush(client());
2407 } 2417 }
2408 2418
2409 private: 2419 private:
2410 // The client who own this touch instance. 2420 // The client who own this touch instance.
2411 wl_client* client() const { return wl_resource_get_client(touch_resource_); } 2421 wl_client* client() const { return wl_resource_get_client(touch_resource_); }
2412 2422
2413 // Returns the next serial to use for keyboard events. 2423 // Returns the next serial to use for keyboard events.
2414 uint32_t next_serial() const { 2424 uint32_t next_serial() const {
2415 return wl_display_next_serial(wl_client_get_display(client())); 2425 return wl_display_next_serial(wl_client_get_display(client()));
2416 } 2426 }
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 DCHECK(event_loop); 3114 DCHECK(event_loop);
3105 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); 3115 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds());
3106 } 3116 }
3107 3117
3108 void Server::Flush() { 3118 void Server::Flush() {
3109 wl_display_flush_clients(wl_display_.get()); 3119 wl_display_flush_clients(wl_display_.get());
3110 } 3120 }
3111 3121
3112 } // namespace wayland 3122 } // namespace wayland
3113 } // namespace exo 3123 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698