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 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 double x_value = offset.x() * kAxisStepDistance; | 2105 double x_value = offset.x() * kAxisStepDistance; |
2106 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), | 2106 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), |
2107 WL_POINTER_AXIS_HORIZONTAL_SCROLL, | 2107 WL_POINTER_AXIS_HORIZONTAL_SCROLL, |
2108 wl_fixed_from_double(-x_value)); | 2108 wl_fixed_from_double(-x_value)); |
2109 | 2109 |
2110 double y_value = offset.y() * kAxisStepDistance; | 2110 double y_value = offset.y() * kAxisStepDistance; |
2111 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), | 2111 wl_pointer_send_axis(pointer_resource_, TimeTicksToMilliseconds(time_stamp), |
2112 WL_POINTER_AXIS_VERTICAL_SCROLL, | 2112 WL_POINTER_AXIS_VERTICAL_SCROLL, |
2113 wl_fixed_from_double(-y_value)); | 2113 wl_fixed_from_double(-y_value)); |
2114 } | 2114 } |
2115 void OnPointerScrollCancel(base::TimeTicks time_stamp) override { | |
2116 // Wayland doesn't know the concept of a canceling kinetic scrolling. | |
2117 // But we can send a 0 distance scroll to emulate this behavior. | |
2118 OnPointerScroll(time_stamp, gfx::Vector2dF(0, 0), false); | |
2119 OnPointerScrollStop(time_stamp); | |
2120 } | |
2121 void OnPointerScrollStop(base::TimeTicks time_stamp) override { | 2115 void OnPointerScrollStop(base::TimeTicks time_stamp) override { |
2122 if (wl_resource_get_version(pointer_resource_) >= | 2116 if (wl_resource_get_version(pointer_resource_) >= |
2123 WL_POINTER_AXIS_STOP_SINCE_VERSION) { | 2117 WL_POINTER_AXIS_STOP_SINCE_VERSION) { |
2124 wl_pointer_send_axis_stop(pointer_resource_, | 2118 wl_pointer_send_axis_stop(pointer_resource_, |
2125 TimeTicksToMilliseconds(time_stamp), | 2119 TimeTicksToMilliseconds(time_stamp), |
2126 WL_POINTER_AXIS_HORIZONTAL_SCROLL); | 2120 WL_POINTER_AXIS_HORIZONTAL_SCROLL); |
2127 wl_pointer_send_axis_stop(pointer_resource_, | 2121 wl_pointer_send_axis_stop(pointer_resource_, |
2128 TimeTicksToMilliseconds(time_stamp), | 2122 TimeTicksToMilliseconds(time_stamp), |
2129 WL_POINTER_AXIS_VERTICAL_SCROLL); | 2123 WL_POINTER_AXIS_VERTICAL_SCROLL); |
2130 } | 2124 } |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3072 DCHECK(event_loop); | 3066 DCHECK(event_loop); |
3073 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3067 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
3074 } | 3068 } |
3075 | 3069 |
3076 void Server::Flush() { | 3070 void Server::Flush() { |
3077 wl_display_flush_clients(wl_display_.get()); | 3071 wl_display_flush_clients(wl_display_.get()); |
3078 } | 3072 } |
3079 | 3073 |
3080 } // namespace wayland | 3074 } // namespace wayland |
3081 } // namespace exo | 3075 } // namespace exo |
OLD | NEW |