mirror of https://github.com/wayvr-org/wayvr.git
wvr_server: fix scrolling in some esoteric apps
This commit is contained in:
parent
ac93d3176c
commit
c6117d99de
|
|
@ -674,10 +674,6 @@ impl WvrServerState {
|
|||
hover_window: window::WindowHandle,
|
||||
delta: WheelDelta,
|
||||
) {
|
||||
// Do not respect mouse_freeze here. A scroll event should still update focus.
|
||||
self.manager
|
||||
.send_mouse_move_to_surface(surface, global_pos, surface_origin);
|
||||
|
||||
self.wm.mouse = Some(window::MouseState {
|
||||
hover_window,
|
||||
x: global_pos.x.max(0.0) as u32,
|
||||
|
|
@ -693,12 +689,6 @@ impl WvrServerState {
|
|||
pos: Vec2,
|
||||
delta: WheelDelta,
|
||||
) {
|
||||
if let Some(window) = self.wm.windows.get_mut(&handle) {
|
||||
window.send_mouse_move(&mut self.manager, pos.x as u32, pos.y as u32);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
self.wm.mouse = Some(window::MouseState {
|
||||
hover_window: handle,
|
||||
x: pos.x.max(0.0) as u32,
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ pub struct WvrWindowBackend {
|
|||
mouse_transform: Affine2,
|
||||
uv_range: RangeInclusive<f32>,
|
||||
panel_hovered: bool,
|
||||
scrolling: bool,
|
||||
}
|
||||
|
||||
impl WvrWindowBackend {
|
||||
|
|
@ -261,6 +262,7 @@ impl WvrWindowBackend {
|
|||
mouse_transform: Affine2::ZERO,
|
||||
uv_range: 0.0..=1.0,
|
||||
panel_hovered: false,
|
||||
scrolling: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -580,7 +582,9 @@ impl OverlayBackend for WvrWindowBackend {
|
|||
});
|
||||
|
||||
let dirty = self.mouse != mouse || rendered_surfaces_dirty(&self.popups, &popups);
|
||||
self.mouse = mouse;
|
||||
if !self.scrolling {
|
||||
self.mouse = mouse;
|
||||
}
|
||||
self.popups = popups;
|
||||
self.meta = Some(meta);
|
||||
|
||||
|
|
@ -697,6 +701,14 @@ impl OverlayBackend for WvrWindowBackend {
|
|||
}
|
||||
|
||||
fn on_hover(&mut self, app: &mut state::AppState, hit: &input::PointerHit) -> HoverResult {
|
||||
if std::mem::take(&mut self.scrolling) {
|
||||
// we scrolled on previous frame so don't send mouse move events in case the user wants to scroll on this frame as well
|
||||
return HoverResult {
|
||||
haptics: None,
|
||||
consume: true,
|
||||
};
|
||||
}
|
||||
|
||||
match self.hit_target(hit) {
|
||||
Some(WvrHitTarget::Panel(hit2)) => {
|
||||
self.panel_hovered = true;
|
||||
|
|
@ -859,6 +871,7 @@ impl OverlayBackend for WvrWindowBackend {
|
|||
|
||||
fn on_scroll(&mut self, app: &mut state::AppState, hit: &input::PointerHit, delta: WheelDelta) {
|
||||
let target = self.hit_target(hit);
|
||||
self.scrolling = true;
|
||||
|
||||
match target {
|
||||
Some(WvrHitTarget::Panel(hit2)) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue