Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to winit 0.29 #3649

Merged
merged 51 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
fc7d37e
Update to winit 0.29
fornwall Nov 27, 2023
c863714
Use 0.29.4 also in eframe and egui-wgpu
fornwall Nov 27, 2023
fc43372
Revert accidental change
fornwall Nov 27, 2023
12a27ce
Fix accidental change
fornwall Nov 27, 2023
7746482
Revert empty line removal
fornwall Nov 27, 2023
3eb6d91
Fix accidental commit reversal
fornwall Nov 27, 2023
e5d5076
Fix accidental commit reversal
fornwall Nov 27, 2023
258e49f
Revert accidental change
fornwall Nov 27, 2023
2191a3b
Fix accidental reversal
fornwall Nov 27, 2023
fc2c142
Fix accidental reversal
fornwall Nov 27, 2023
3e55b1e
Update links in docs
fornwall Nov 28, 2023
a8e3c95
Merge branch 'master' into winit-0.29
emilk Nov 28, 2023
8c8f2f6
Update to cocoa 0.25.0
emilk Nov 28, 2023
3dc23de
Update to smithay-clipboard 0.7.0
emilk Nov 28, 2023
0d822c9
Updating plist v1.5.0 -> v1.5.1
emilk Nov 28, 2023
7c89b67
Simplify egui_extras dependency list for the svg feature
emilk Nov 28, 2023
0dbd597
Update deny.toml
emilk Nov 28, 2023
b4e6246
Fix svg-related build problem
emilk Nov 28, 2023
bb5e077
Return errors when creating event loop
emilk Nov 28, 2023
fefa5af
Move warning comment
emilk Nov 28, 2023
1df781d
Remove noop responses to ScaleFactorChanged
emilk Nov 28, 2023
6b714a7
Remove `Prefence` typo exception
emilk Nov 28, 2023
87870b3
Rename `ViewportCommand::IMEPosition` to `IMERect`
emilk Nov 28, 2023
fca3690
Log result of request_inner_size
emilk Nov 28, 2023
b5fcda1
Fix event loop and improve trace logging
emilk Nov 28, 2023
5914871
Code cleanup
emilk Nov 28, 2023
d7c57d4
Clean up modifiers code
emilk Nov 28, 2023
9b997a5
Fix IME output
emilk Nov 28, 2023
98ae3ef
Fix typo
emilk Nov 28, 2023
9d0037f
Don't treat `cmd+C` etc as text input on Mac
emilk Nov 28, 2023
dc1a95e
Output logical keys from winit, and document that fact
emilk Nov 28, 2023
054cedc
Fix Windows build
emilk Nov 28, 2023
4cfa02a
Fix windows build for real
emilk Nov 28, 2023
9805317
No really, fix the Windows issue
emilk Nov 28, 2023
dfa6676
Remove outdated(?) windows hack
emilk Nov 28, 2023
666e099
Add `wgpu` feature to `multiple_viewports` example
emilk Nov 28, 2023
b74bfd9
Code cleanup and better logging
emilk Nov 28, 2023
9976c7b
Fix secondary viewports with glow backend
emilk Nov 28, 2023
9cb45f1
Clean up code around window creation
emilk Nov 28, 2023
43b18ce
Add warning when failing to create transparent window
emilk Nov 28, 2023
58a9621
Add `Key::from_name` helper
emilk Nov 28, 2023
edaf2a3
Add keys: period, comma, colon, semicolon
emilk Nov 28, 2023
70ed053
Improve docstring
emilk Nov 28, 2023
a624f74
Ignore text on key release and when ctrl is down
emilk Nov 30, 2023
3dd8604
Merge branch 'master' into winit-0.29
emilk Nov 30, 2023
d076bdc
Only register printable text
emilk Dec 1, 2023
bc5c6d1
Merge branch 'master' into winit-0.29
emilk Dec 6, 2023
a13959a
Fix modifiers on Linux
emilk Dec 6, 2023
68ff3ec
Merge branch 'master' into winit-0.29
emilk Dec 18, 2023
d63deb7
Update deny.toml
emilk Dec 18, 2023
1c14bd9
Merge branch 'master' into winit-0.29
emilk Dec 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
628 changes: 379 additions & 249 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions crates/eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ image = { version = "0.24", default-features = false, features = [
"png",
] } # Needed for app icon
raw-window-handle.workspace = true
winit = { version = "0.28.1", default-features = false }
winit = { version = "0.29.4", default-features = false, features = ["rwh_05"] }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we using raw-window-handle 0.5 instead of 0.6?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to upgrade raw-window-handle as a separate PR, to limit scope (and do we need to await glutin updating to rwh 0.6 as well)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glutin hasn't upgraded yet: rust-windowing/glutin#1582


# optional native:
directories-next = { version = "2", optional = true }
Expand All @@ -142,14 +142,14 @@ pollster = { version = "0.3", optional = true } # needed for wgpu

# we can expose these to user so that they can select which backends they want to enable to avoid compiling useless deps.
# this can be done at the same time we expose x11/wayland features of winit crate.
glutin = { version = "0.30", optional = true }
glutin-winit = { version = "0.3.0", optional = true }
glutin = { version = "0.31", optional = true }
glutin-winit = { version = "0.4", optional = true }
puffin = { workspace = true, optional = true }
wgpu = { workspace = true, optional = true }

# mac:
[target.'cfg(any(target_os = "macos"))'.dependencies]
cocoa = "0.24.1" # Stuck on old version until we update to winit 0.29
cocoa = "0.25.0"
objc = "0.2.7"

# windows:
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ pub struct NativeOptions {
///
/// This feature was introduced in <https://github.com/emilk/egui/pull/1889>.
///
/// When `true`, [`winit::platform::run_return::EventLoopExtRunReturn::run_return`] is used.
/// When `true`, [`winit::platform::run_on_demand::EventLoopExtRunOnDemand`] is used.
/// When `false`, [`winit::event_loop::EventLoop::run`] is used.
pub run_and_return: bool,

Expand Down
5 changes: 5 additions & 0 deletions crates/eframe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ pub enum Error {
#[error("winit error: {0}")]
Winit(#[from] winit::error::OsError),

/// An error from [`winit::event_loop::EventLoop`].
#[cfg(not(target_arch = "wasm32"))]
#[error("winit EventLoopError: {0}")]
WinitEventLoop(#[from] winit::error::EventLoopError),

/// An error from [`glutin`] when using [`glow`].
#[cfg(all(feature = "glow", not(target_arch = "wasm32")))]
#[error("glutin error: {0}")]
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/native/epi_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl EpiIntegration {

pub fn on_window_event(
&mut self,
event: &winit::event::WindowEvent<'_>,
event: &winit::event::WindowEvent,
egui_winit: &mut egui_winit::State,
) -> EventResponse {
crate::profile_function!(egui_winit::short_window_event_description(event));
Expand Down
30 changes: 14 additions & 16 deletions crates/eframe/src/native/glow_integration.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
//! Note that this file contains code very similar to [`wgpu_integration`].
//! When making changes to one you often also want to apply it to the other.
//!
//! This is also very complex code, and not very pretty.
//! There is a bunch of improvements we could do,
//! like removing a bunch of `unwraps`.

use std::{cell::RefCell, rc::Rc, sync::Arc, time::Instant};

use glutin::{
context::NotCurrentGlContext,
display::GetGlDisplay,
prelude::{GlDisplay, NotCurrentGlContextSurfaceAccessor, PossiblyCurrentGlContext},
prelude::{GlDisplay, PossiblyCurrentGlContext},
surface::GlSurface,
};
use raw_window_handle::{HasRawDisplayHandle as _, HasRawWindowHandle as _};
Expand Down Expand Up @@ -403,7 +411,7 @@ impl WinitApp for GlowWinitApp {
fn on_event(
&mut self,
event_loop: &EventLoopWindowTarget<UserEvent>,
event: &winit::event::Event<'_, UserEvent>,
event: &winit::event::Event<UserEvent>,
) -> Result<EventResult> {
crate::profile_function!(winit_integration::short_event_description(event));

Expand Down Expand Up @@ -435,15 +443,6 @@ impl WinitApp for GlowWinitApp {
EventResult::Wait
}

winit::event::Event::MainEventsCleared => {
if let Some(running) = &self.running {
if let Err(err) = running.glutin.borrow_mut().on_resume(event_loop) {
log::warn!("on_resume failed {err}");
}
}
EventResult::Wait
}

winit::event::Event::WindowEvent { event, window_id } => {
if let Some(running) = &mut self.running {
running.on_window_event(*window_id, event)
Expand Down Expand Up @@ -665,7 +664,7 @@ impl GlowWinitRunning {
fn on_window_event(
&mut self,
window_id: WindowId,
event: &winit::event::WindowEvent<'_>,
event: &winit::event::WindowEvent,
) -> EventResult {
crate::profile_function!(egui_winit::short_window_event_description(event));

Expand Down Expand Up @@ -704,10 +703,9 @@ impl GlowWinitRunning {
}
}

winit::event::WindowEvent::ScaleFactorChanged { new_inner_size, .. } => {
if let Some(viewport_id) = viewport_id {
winit::event::WindowEvent::ScaleFactorChanged { .. } => {
if viewport_id.is_some() {
repaint_asap = true;
glutin.resize(viewport_id, **new_inner_size);
}
}

Expand Down Expand Up @@ -822,7 +820,7 @@ impl GlutinWindowContext {
// Create GL display. This may probably create a window too on most platforms. Definitely on `MS windows`. Never on Android.
let display_builder = glutin_winit::DisplayBuilder::new()
// we might want to expose this option to users in the future. maybe using an env var or using native_options.
.with_preference(glutin_winit::ApiPrefence::FallbackEgl) // https://github.com/emilk/egui/issues/2520#issuecomment-1367841150
.with_preference(glutin_winit::ApiPreference::FallbackEgl) // https://github.com/emilk/egui/issues/2520#issuecomment-1367841150
.with_window_builder(Some(create_winit_window_builder(
egui_ctx,
event_loop,
Expand Down
Loading
Loading