| 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 <gaming-input-unstable-v2-server-protocol.h> | 9 #include <gaming-input-unstable-v2-server-protocol.h> |
| 10 #include <grp.h> | 10 #include <grp.h> |
| (...skipping 2643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2654 double x_value = offset.x() * kAxisStepDistance; | 2654 double x_value = offset.x() * kAxisStepDistance; |
| 2655 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), | 2655 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), |
| 2656 WL_POINTER_AXIS_HORIZONTAL_SCROLL, | 2656 WL_POINTER_AXIS_HORIZONTAL_SCROLL, |
| 2657 wl_fixed_from_double(-x_value)); | 2657 wl_fixed_from_double(-x_value)); |
| 2658 | 2658 |
| 2659 double y_value = offset.y() * kAxisStepDistance; | 2659 double y_value = offset.y() * kAxisStepDistance; |
| 2660 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), | 2660 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), |
| 2661 WL_POINTER_AXIS_VERTICAL_SCROLL, | 2661 WL_POINTER_AXIS_VERTICAL_SCROLL, |
| 2662 wl_fixed_from_double(-y_value)); | 2662 wl_fixed_from_double(-y_value)); |
| 2663 } | 2663 } |
| 2664 void OnPointerScrollCancel(base::TimeTicks time_stamp) override { | |
| 2665 // Wayland doesn't know the concept of a canceling kinetic scrolling. | |
| 2666 // But we can send a 0 distance scroll to emulate this behavior. | |
| 2667 OnPointerScroll(time_stamp, gfx::Vector2dF(0, 0), false); | |
| 2668 OnPointerScrollStop(time_stamp); | |
| 2669 } | |
| 2670 void OnPointerScrollStop(base::TimeTicks time_stamp) override { | 2664 void OnPointerScrollStop(base::TimeTicks time_stamp) override { |
| 2671 if (wl_resource_get_version(pointer_resource_) >= | 2665 if (wl_resource_get_version(pointer_resource_) >= |
| 2672 WL_POINTER_AXIS_STOP_SINCE_VERSION) { | 2666 WL_POINTER_AXIS_STOP_SINCE_VERSION) { |
| 2673 wl_pointer_send_axis_stop(pointer_resource_, | 2667 wl_pointer_send_axis_stop(pointer_resource_, |
| 2674 TimeTicksToMilliseconds(time_stamp), | 2668 TimeTicksToMilliseconds(time_stamp), |
| 2675 WL_POINTER_AXIS_HORIZONTAL_SCROLL); | 2669 WL_POINTER_AXIS_HORIZONTAL_SCROLL); |
| 2676 wl_pointer_send_axis_stop(pointer_resource_, | 2670 wl_pointer_send_axis_stop(pointer_resource_, |
| 2677 TimeTicksToMilliseconds(time_stamp), | 2671 TimeTicksToMilliseconds(time_stamp), |
| 2678 WL_POINTER_AXIS_VERTICAL_SCROLL); | 2672 WL_POINTER_AXIS_VERTICAL_SCROLL); |
| 2679 } | 2673 } |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3956 DCHECK(event_loop); | 3950 DCHECK(event_loop); |
| 3957 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3951 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3958 } | 3952 } |
| 3959 | 3953 |
| 3960 void Server::Flush() { | 3954 void Server::Flush() { |
| 3961 wl_display_flush_clients(wl_display_.get()); | 3955 wl_display_flush_clients(wl_display_.get()); |
| 3962 } | 3956 } |
| 3963 | 3957 |
| 3964 } // namespace wayland | 3958 } // namespace wayland |
| 3965 } // namespace exo | 3959 } // namespace exo |
| OLD | NEW |