| 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 <alpha-compositing-unstable-v1-server-protocol.h> | 7 #include <alpha-compositing-unstable-v1-server-protocol.h> |
| 8 #include <gaming-input-unstable-v1-server-protocol.h> | 8 #include <gaming-input-unstable-v1-server-protocol.h> |
| 9 #include <grp.h> | 9 #include <grp.h> |
| 10 #include <keyboard-configuration-unstable-v1-server-protocol.h> | 10 #include <keyboard-configuration-unstable-v1-server-protocol.h> |
| (...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2384 bool CanAcceptTouchEventsForSurface(Surface* surface) const override { | 2384 bool CanAcceptTouchEventsForSurface(Surface* surface) const override { |
| 2385 wl_resource* surface_resource = GetSurfaceResource(surface); | 2385 wl_resource* surface_resource = GetSurfaceResource(surface); |
| 2386 // We can accept events for this surface if the client is the same as the | 2386 // We can accept events for this surface if the client is the same as the |
| 2387 // touch resource. | 2387 // touch resource. |
| 2388 return surface_resource && | 2388 return surface_resource && |
| 2389 wl_resource_get_client(surface_resource) == client(); | 2389 wl_resource_get_client(surface_resource) == client(); |
| 2390 } | 2390 } |
| 2391 void OnTouchDown(Surface* surface, | 2391 void OnTouchDown(Surface* surface, |
| 2392 base::TimeTicks time_stamp, | 2392 base::TimeTicks time_stamp, |
| 2393 int id, | 2393 int id, |
| 2394 const gfx::Point& location) override { | 2394 const gfx::PointF& location) override { |
| 2395 wl_resource* surface_resource = GetSurfaceResource(surface); | 2395 wl_resource* surface_resource = GetSurfaceResource(surface); |
| 2396 DCHECK(surface_resource); | 2396 DCHECK(surface_resource); |
| 2397 wl_touch_send_down(touch_resource_, next_serial(), | 2397 wl_touch_send_down(touch_resource_, next_serial(), |
| 2398 TimeTicksToMilliseconds(time_stamp), surface_resource, | 2398 TimeTicksToMilliseconds(time_stamp), surface_resource, |
| 2399 id, wl_fixed_from_int(location.x()), | 2399 id, wl_fixed_from_double(location.x()), |
| 2400 wl_fixed_from_int(location.y())); | 2400 wl_fixed_from_double(location.y())); |
| 2401 } | 2401 } |
| 2402 void OnTouchUp(base::TimeTicks time_stamp, int id) override { | 2402 void OnTouchUp(base::TimeTicks time_stamp, int id) override { |
| 2403 wl_touch_send_up(touch_resource_, next_serial(), | 2403 wl_touch_send_up(touch_resource_, next_serial(), |
| 2404 TimeTicksToMilliseconds(time_stamp), id); | 2404 TimeTicksToMilliseconds(time_stamp), id); |
| 2405 } | 2405 } |
| 2406 void OnTouchMotion(base::TimeTicks time_stamp, | 2406 void OnTouchMotion(base::TimeTicks time_stamp, |
| 2407 int id, | 2407 int id, |
| 2408 const gfx::Point& location) override { | 2408 const gfx::PointF& location) override { |
| 2409 wl_touch_send_motion(touch_resource_, TimeTicksToMilliseconds(time_stamp), | 2409 wl_touch_send_motion(touch_resource_, TimeTicksToMilliseconds(time_stamp), |
| 2410 id, wl_fixed_from_int(location.x()), | 2410 id, wl_fixed_from_double(location.x()), |
| 2411 wl_fixed_from_int(location.y())); | 2411 wl_fixed_from_double(location.y())); |
| 2412 } | 2412 } |
| 2413 void OnTouchShape(int id, float major, float minor) override { | 2413 void OnTouchShape(int id, float major, float minor) override { |
| 2414 if (wl_resource_get_version(touch_resource_) >= | 2414 if (wl_resource_get_version(touch_resource_) >= |
| 2415 WL_TOUCH_SHAPE_SINCE_VERSION) { | 2415 WL_TOUCH_SHAPE_SINCE_VERSION) { |
| 2416 wl_touch_send_shape(touch_resource_, id, wl_fixed_from_double(major), | 2416 wl_touch_send_shape(touch_resource_, id, wl_fixed_from_double(major), |
| 2417 wl_fixed_from_double(minor)); | 2417 wl_fixed_from_double(minor)); |
| 2418 } | 2418 } |
| 2419 } | 2419 } |
| 2420 void OnTouchFrame() override { | 2420 void OnTouchFrame() override { |
| 2421 if (wl_resource_get_version(touch_resource_) >= | 2421 if (wl_resource_get_version(touch_resource_) >= |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3333 DCHECK(event_loop); | 3333 DCHECK(event_loop); |
| 3334 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3334 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3335 } | 3335 } |
| 3336 | 3336 |
| 3337 void Server::Flush() { | 3337 void Server::Flush() { |
| 3338 wl_display_flush_clients(wl_display_.get()); | 3338 wl_display_flush_clients(wl_display_.get()); |
| 3339 } | 3339 } |
| 3340 | 3340 |
| 3341 } // namespace wayland | 3341 } // namespace wayland |
| 3342 } // namespace exo | 3342 } // namespace exo |
| OLD | NEW |