| 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 2635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2646 double x_value = offset.x() * kAxisStepDistance; | 2646 double x_value = offset.x() * kAxisStepDistance; |
| 2647 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), | 2647 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), |
| 2648 WL_POINTER_AXIS_HORIZONTAL_SCROLL, | 2648 WL_POINTER_AXIS_HORIZONTAL_SCROLL, |
| 2649 wl_fixed_from_double(-x_value)); | 2649 wl_fixed_from_double(-x_value)); |
| 2650 | 2650 |
| 2651 double y_value = offset.y() * kAxisStepDistance; | 2651 double y_value = offset.y() * kAxisStepDistance; |
| 2652 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), | 2652 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), |
| 2653 WL_POINTER_AXIS_VERTICAL_SCROLL, | 2653 WL_POINTER_AXIS_VERTICAL_SCROLL, |
| 2654 wl_fixed_from_double(-y_value)); | 2654 wl_fixed_from_double(-y_value)); |
| 2655 } | 2655 } |
| 2656 void OnPointerScrollCancel(base::TimeTicks time_stamp) override { | |
| 2657 // Wayland doesn't know the concept of a canceling kinetic scrolling. | |
| 2658 // But we can send a 0 distance scroll to emulate this behavior. | |
| 2659 OnPointerScroll(time_stamp, gfx::Vector2dF(0, 0), false); | |
| 2660 OnPointerScrollStop(time_stamp); | |
| 2661 } | |
| 2662 void OnPointerScrollStop(base::TimeTicks time_stamp) override { | 2656 void OnPointerScrollStop(base::TimeTicks time_stamp) override { |
| 2663 if (wl_resource_get_version(pointer_resource_) >= | 2657 if (wl_resource_get_version(pointer_resource_) >= |
| 2664 WL_POINTER_AXIS_STOP_SINCE_VERSION) { | 2658 WL_POINTER_AXIS_STOP_SINCE_VERSION) { |
| 2665 wl_pointer_send_axis_stop(pointer_resource_, | 2659 wl_pointer_send_axis_stop(pointer_resource_, |
| 2666 TimeTicksToMilliseconds(time_stamp), | 2660 TimeTicksToMilliseconds(time_stamp), |
| 2667 WL_POINTER_AXIS_HORIZONTAL_SCROLL); | 2661 WL_POINTER_AXIS_HORIZONTAL_SCROLL); |
| 2668 wl_pointer_send_axis_stop(pointer_resource_, | 2662 wl_pointer_send_axis_stop(pointer_resource_, |
| 2669 TimeTicksToMilliseconds(time_stamp), | 2663 TimeTicksToMilliseconds(time_stamp), |
| 2670 WL_POINTER_AXIS_VERTICAL_SCROLL); | 2664 WL_POINTER_AXIS_VERTICAL_SCROLL); |
| 2671 } | 2665 } |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3948 DCHECK(event_loop); | 3942 DCHECK(event_loop); |
| 3949 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3943 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3950 } | 3944 } |
| 3951 | 3945 |
| 3952 void Server::Flush() { | 3946 void Server::Flush() { |
| 3953 wl_display_flush_clients(wl_display_.get()); | 3947 wl_display_flush_clients(wl_display_.get()); |
| 3954 } | 3948 } |
| 3955 | 3949 |
| 3956 } // namespace wayland | 3950 } // namespace wayland |
| 3957 } // namespace exo | 3951 } // namespace exo |
| OLD | NEW |