| OLD | NEW |
| 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 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2387 void OnTouchDown(Surface* surface, | 2387 void OnTouchDown(Surface* surface, |
| 2388 base::TimeTicks time_stamp, | 2388 base::TimeTicks time_stamp, |
| 2389 int id, | 2389 int id, |
| 2390 const gfx::Point& location) override { | 2390 const gfx::Point& location) override { |
| 2391 wl_resource* surface_resource = GetSurfaceResource(surface); | 2391 wl_resource* surface_resource = GetSurfaceResource(surface); |
| 2392 DCHECK(surface_resource); | 2392 DCHECK(surface_resource); |
| 2393 wl_touch_send_down(touch_resource_, next_serial(), | 2393 wl_touch_send_down(touch_resource_, next_serial(), |
| 2394 TimeTicksToMilliseconds(time_stamp), surface_resource, | 2394 TimeTicksToMilliseconds(time_stamp), surface_resource, |
| 2395 id, wl_fixed_from_int(location.x()), | 2395 id, wl_fixed_from_int(location.x()), |
| 2396 wl_fixed_from_int(location.y())); | 2396 wl_fixed_from_int(location.y())); |
| 2397 wl_client_flush(client()); | |
| 2398 } | 2397 } |
| 2399 void OnTouchUp(base::TimeTicks time_stamp, int id) override { | 2398 void OnTouchUp(base::TimeTicks time_stamp, int id) override { |
| 2400 wl_touch_send_up(touch_resource_, next_serial(), | 2399 wl_touch_send_up(touch_resource_, next_serial(), |
| 2401 TimeTicksToMilliseconds(time_stamp), id); | 2400 TimeTicksToMilliseconds(time_stamp), id); |
| 2402 wl_client_flush(client()); | |
| 2403 } | 2401 } |
| 2404 void OnTouchMotion(base::TimeTicks time_stamp, | 2402 void OnTouchMotion(base::TimeTicks time_stamp, |
| 2405 int id, | 2403 int id, |
| 2406 const gfx::Point& location) override { | 2404 const gfx::Point& location) override { |
| 2407 wl_touch_send_motion(touch_resource_, TimeTicksToMilliseconds(time_stamp), | 2405 wl_touch_send_motion(touch_resource_, TimeTicksToMilliseconds(time_stamp), |
| 2408 id, wl_fixed_from_int(location.x()), | 2406 id, wl_fixed_from_int(location.x()), |
| 2409 wl_fixed_from_int(location.y())); | 2407 wl_fixed_from_int(location.y())); |
| 2408 } |
| 2409 void OnTouchShape(int id, float major, float minor) override { |
| 2410 if (wl_resource_get_version(touch_resource_) >= |
| 2411 WL_TOUCH_SHAPE_SINCE_VERSION) { |
| 2412 wl_touch_send_shape(touch_resource_, id, wl_fixed_from_double(major), |
| 2413 wl_fixed_from_double(minor)); |
| 2414 } |
| 2415 } |
| 2416 void OnTouchFrame() override { |
| 2417 if (wl_resource_get_version(touch_resource_) >= |
| 2418 WL_TOUCH_FRAME_SINCE_VERSION) { |
| 2419 wl_touch_send_frame(touch_resource_); |
| 2420 } |
| 2410 wl_client_flush(client()); | 2421 wl_client_flush(client()); |
| 2411 } | 2422 } |
| 2412 void OnTouchCancel() override { | 2423 void OnTouchCancel() override { |
| 2413 wl_touch_send_cancel(touch_resource_); | 2424 wl_touch_send_cancel(touch_resource_); |
| 2414 wl_client_flush(client()); | |
| 2415 } | 2425 } |
| 2416 | 2426 |
| 2417 private: | 2427 private: |
| 2418 // The client who own this touch instance. | 2428 // The client who own this touch instance. |
| 2419 wl_client* client() const { return wl_resource_get_client(touch_resource_); } | 2429 wl_client* client() const { return wl_resource_get_client(touch_resource_); } |
| 2420 | 2430 |
| 2421 // Returns the next serial to use for keyboard events. | 2431 // Returns the next serial to use for keyboard events. |
| 2422 uint32_t next_serial() const { | 2432 uint32_t next_serial() const { |
| 2423 return wl_display_next_serial(wl_client_get_display(client())); | 2433 return wl_display_next_serial(wl_client_get_display(client())); |
| 2424 } | 2434 } |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3200 DCHECK(event_loop); | 3210 DCHECK(event_loop); |
| 3201 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3211 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3202 } | 3212 } |
| 3203 | 3213 |
| 3204 void Server::Flush() { | 3214 void Server::Flush() { |
| 3205 wl_display_flush_clients(wl_display_.get()); | 3215 wl_display_flush_clients(wl_display_.get()); |
| 3206 } | 3216 } |
| 3207 | 3217 |
| 3208 } // namespace wayland | 3218 } // namespace wayland |
| 3209 } // namespace exo | 3219 } // namespace exo |
| OLD | NEW |