mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
Update to to winit 0.28 (#2654)
* Update to winit 0.28 Mac trackpads pinch gestures will now generate `egui::Event::Zoom` * Update accesskit_winit * Try to get Android CI green * Fix wayland compilation * Add comment about android-activity * Update changelogs * Fix call to register_xlib_error_hook
This commit is contained in:
@@ -25,16 +25,6 @@ pub use window_settings::WindowSettings;
|
||||
|
||||
use winit::event_loop::EventLoopWindowTarget;
|
||||
|
||||
#[cfg(feature = "wayland")]
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "dragonfly",
|
||||
target_os = "freebsd",
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd"
|
||||
))]
|
||||
use winit::platform::unix::EventLoopWindowTargetExtUnix;
|
||||
|
||||
pub fn native_pixels_per_point(window: &winit::window::Window) -> f32 {
|
||||
window.scale_factor() as f32
|
||||
}
|
||||
@@ -377,8 +367,9 @@ impl State {
|
||||
consumed: false,
|
||||
}
|
||||
}
|
||||
WindowEvent::AxisMotion { .. }
|
||||
| WindowEvent::CloseRequested
|
||||
|
||||
// Things that may require repaint:
|
||||
WindowEvent::CloseRequested
|
||||
| WindowEvent::CursorEntered { .. }
|
||||
| WindowEvent::Destroyed
|
||||
| WindowEvent::Occluded(_)
|
||||
@@ -388,10 +379,26 @@ impl State {
|
||||
repaint: true,
|
||||
consumed: false,
|
||||
},
|
||||
WindowEvent::Moved(_) => EventResponse {
|
||||
repaint: false, // moving a window doesn't warrant a repaint
|
||||
|
||||
// Things we completely ignore:
|
||||
WindowEvent::AxisMotion { .. }
|
||||
| WindowEvent::Moved(_)
|
||||
| WindowEvent::SmartMagnify { .. }
|
||||
| WindowEvent::TouchpadRotate { .. } => EventResponse {
|
||||
repaint: false,
|
||||
consumed: false,
|
||||
},
|
||||
|
||||
WindowEvent::TouchpadMagnify { delta, .. } => {
|
||||
// Positive delta values indicate magnification (zooming in).
|
||||
// Negative delta values indicate shrinking (zooming out).
|
||||
let zoom_factor = (*delta as f32).exp();
|
||||
self.egui_input.events.push(egui::Event::Zoom(zoom_factor));
|
||||
EventResponse {
|
||||
repaint: true,
|
||||
consumed: egui_ctx.wants_pointer_input(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -871,6 +878,7 @@ fn wayland_display<T>(_event_loop: &EventLoopWindowTarget<T>) -> Option<*mut c_v
|
||||
target_os = "openbsd"
|
||||
))]
|
||||
{
|
||||
use winit::platform::wayland::EventLoopWindowTargetExtWayland as _;
|
||||
return _event_loop.wayland_display();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user