Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 11 additions & 4 deletions winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ repository = "https://github.com/hecrj/iced"
documentation = "https://docs.rs/iced_winit"
keywords = ["gui", "ui", "graphics", "interface", "widgets"]
categories = ["gui"]
resolver = "2"

[features]
debug = ["iced_native/debug"]
mainline_winit = ["winit_mainline"]
forked_winit = ["winit_fork"]
default = ["mainline_winit"]

[dependencies]
window_clipboard = "0.2"
log = "0.4"
thiserror = "1.0"

[dependencies.winit]
version = "0.26"
git = "https://github.com/iced-rs/winit"
rev = "02a12380960cec2f351c09a33d6a7cc2789d96a6"
[dependencies.winit_mainline]
path = "./winit_mainline"
optional = true

[dependencies.winit_fork]
path = "./winit_fork"
optional = true

[dependencies.iced_native]
version = "0.4"
Expand Down
2 changes: 2 additions & 0 deletions winit/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
Color, Command, Debug, Error, Executor, Mode, Proxy, Runtime, Settings,
Size, Subscription,
};
use crate::winit;

use iced_futures::futures;
use iced_futures::futures::channel::mpsc;
Expand Down Expand Up @@ -333,6 +334,7 @@ async fn run_instance<A, E, C>(

window.request_redraw();
}
#[cfg(feature = "forked_winit")]
event::Event::PlatformSpecific(event::PlatformSpecific::MacOS(
event::MacOS::ReceivedUrl(url),
)) => {
Expand Down
1 change: 1 addition & 0 deletions winit/src/application/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::conversion;
use crate::{Application, Color, Debug, Mode, Point, Size, Viewport};

use std::marker::PhantomData;
use crate::winit;
use winit::event::{Touch, WindowEvent};
use winit::window::Window;

Expand Down
1 change: 1 addition & 0 deletions winit/src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pub use iced_native::clipboard::Action;

use crate::command::{self, Command};
use crate::winit;

/// A buffer for short-term storage and transfer within and between
/// applications.
Expand Down
2 changes: 1 addition & 1 deletion winit/src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::keyboard;
use crate::mouse;
use crate::touch;
use crate::window;
use crate::{Event, Mode, Point, Position};
use crate::{Event, Mode, Point, Position, winit};

/// Converts a winit window event into an iced event.
pub fn window_event(
Expand Down
1 change: 1 addition & 0 deletions winit/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use iced_futures::futures;
use crate::winit;

/// An error that occurred while running an application.
#[derive(Debug, thiserror::Error)]
Expand Down
8 changes: 7 additions & 1 deletion winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@

#[doc(no_inline)]
pub use iced_native::*;
pub use winit;

// #[cfg(all(feature = ""))]

#[cfg(feature = "mainline_winit")]
pub use winit_mainline::winit as winit;
#[cfg(feature = "forked_winit")]
pub use winit_fork::winit as winit;

pub mod application;
pub mod clipboard;
Expand Down
1 change: 1 addition & 0 deletions winit/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use iced_native::futures::{
Sink,
};
use std::pin::Pin;
use crate::winit;

/// An event loop proxy that implements `Sink`.
#[derive(Debug)]
Expand Down
3 changes: 2 additions & 1 deletion winit/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub use platform::PlatformSpecific;

use crate::conversion;
use crate::{Mode, Position};
use crate::winit;
use winit::monitor::MonitorHandle;
use winit::window::WindowBuilder;

Expand Down Expand Up @@ -123,7 +124,7 @@ impl Window {
target_os = "openbsd"
))]
{
use ::winit::platform::unix::WindowBuilderExtUnix;
use winit::platform::unix::WindowBuilderExtUnix;

if let Some(id) = _id {
window_builder = window_builder.with_app_id(id);
Expand Down
11 changes: 11 additions & 0 deletions winit/winit_fork/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "winit_fork"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies.winit]
version = "0.26"
git = "https://github.com/iced-rs/winit"
rev = "02a12380960cec2f351c09a33d6a7cc2789d96a6"
1 change: 1 addition & 0 deletions winit/winit_fork/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub use winit;
9 changes: 9 additions & 0 deletions winit/winit_mainline/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "winit_mainline"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
winit = "0.26"
1 change: 1 addition & 0 deletions winit/winit_mainline/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub use winit;