summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--examples/integration_opengl/src/main.rs4
-rw-r--r--glutin/Cargo.toml4
-rw-r--r--glutin/src/application.rs6
-rw-r--r--glutin/src/multi_window.rs38
4 files changed, 29 insertions, 23 deletions
diff --git a/examples/integration_opengl/src/main.rs b/examples/integration_opengl/src/main.rs
index 56470190..a9e9c732 100644
--- a/examples/integration_opengl/src/main.rs
+++ b/examples/integration_opengl/src/main.rs
@@ -31,7 +31,7 @@ pub fn main() {
.unwrap();
unsafe {
- let windowed_context = windowed_context.make_current().unwrap();
+ let windowed_context = windowed_context.make_current(todo!("derezzedex")).unwrap();
let gl = glow::Context::from_loader_function(|s| {
windowed_context.get_proc_address(s) as *const _
@@ -181,7 +181,7 @@ pub fn main() {
),
);
- windowed_context.swap_buffers().unwrap();
+ windowed_context.swap_buffers(todo!("derezzedex")).unwrap();
}
_ => (),
}
diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml
index 2960a0bd..75a38d22 100644
--- a/glutin/Cargo.toml
+++ b/glutin/Cargo.toml
@@ -21,8 +21,8 @@ version = "0.4"
[dependencies.glutin]
version = "0.29"
-git = "https://github.com/iced-rs/glutin"
-rev = "da8d291486b4c9bec12487a46c119c4b1d386abf"
+git = "https://github.com/derezzedex/glutin"
+rev = "e72ea919f95106cfdfdce3e7dcfdbf71a432840a"
[dependencies.iced_native]
version = "0.7"
diff --git a/glutin/src/application.rs b/glutin/src/application.rs
index 108d7ffa..7ff6216e 100644
--- a/glutin/src/application.rs
+++ b/glutin/src/application.rs
@@ -120,7 +120,7 @@ where
#[allow(unsafe_code)]
unsafe {
- context.make_current().expect("Make OpenGL context current")
+ context.make_current(todo!()).expect("Make OpenGL context current")
}
};
@@ -359,7 +359,7 @@ async fn run_instance<A, E, C>(
unsafe {
if !context.is_current() {
context = context
- .make_current()
+ .make_current(todo!())
.expect("Make OpenGL context current");
}
}
@@ -415,7 +415,7 @@ async fn run_instance<A, E, C>(
&debug.overlay(),
);
- context.swap_buffers().expect("Swap buffers");
+ context.swap_buffers(todo!()).expect("Swap buffers");
debug.render_finished();
diff --git a/glutin/src/multi_window.rs b/glutin/src/multi_window.rs
index 4949219f..ce34aa31 100644
--- a/glutin/src/multi_window.rs
+++ b/glutin/src/multi_window.rs
@@ -58,7 +58,7 @@ where
runtime.enter(|| A::new(flags))
};
- let context = {
+ let (context, window) = {
let builder = settings.window.into_builder(
&application.title(),
event_loop.primary_monitor(),
@@ -115,7 +115,14 @@ where
#[allow(unsafe_code)]
unsafe {
- context.make_current().expect("Make OpenGL context current")
+ let (context, window) = context.split();
+
+ (
+ context
+ .make_current(&window)
+ .expect("Make OpenGL context current"),
+ window,
+ )
}
};
@@ -137,6 +144,7 @@ where
debug,
receiver,
context,
+ window,
init_command,
settings.exit_on_close_request,
));
@@ -205,7 +213,8 @@ async fn run_instance<A, E, C>(
mut receiver: mpsc::UnboundedReceiver<
glutin::event::Event<'_, Event<A::Message>>,
>,
- context: glutin::ContextWrapper<glutin::PossiblyCurrent, Window>,
+ mut context: glutin::RawContext<glutin::PossiblyCurrent>,
+ window: Window,
init_command: Command<A::Message>,
_exit_on_close_request: bool,
) where
@@ -217,9 +226,9 @@ async fn run_instance<A, E, C>(
use glutin::event;
use iced_winit::futures::stream::StreamExt;
- let mut clipboard = Clipboard::connect(context.window());
+ let mut clipboard = Clipboard::connect(&window);
let mut cache = user_interface::Cache::default();
- let state = State::new(&application, context.window());
+ let state = State::new(&application, &window);
let user_interface = multi_window::build_user_interface(
&application,
user_interface::Cache::default(),
@@ -229,9 +238,7 @@ async fn run_instance<A, E, C>(
window::Id::MAIN,
);
- #[allow(unsafe_code)]
- let (mut context, window) = unsafe { context.split() };
-
+ let mut current_context_window = window.id();
let mut window_ids = HashMap::from([(window.id(), window::Id::MAIN)]);
let mut windows = HashMap::from([(window::Id::MAIN, window)]);
let mut states = HashMap::from([(window::Id::MAIN, state)]);
@@ -445,15 +452,19 @@ async fn run_instance<A, E, C>(
.get(&id)
.and_then(|id| states.get_mut(id))
.unwrap();
+ let window =
+ window_ids.get(&id).and_then(|id| windows.get(id)).unwrap();
debug.render_started();
#[allow(unsafe_code)]
unsafe {
- if !context.is_current() {
+ if current_context_window != id {
context = context
- .make_current()
+ .make_current(window)
.expect("Make OpenGL context current");
+
+ current_context_window = id;
}
}
@@ -483,11 +494,6 @@ async fn run_instance<A, E, C>(
debug.draw_finished();
if new_mouse_interaction != mouse_interaction {
- let window = window_ids
- .get(&id)
- .and_then(|id| windows.get_mut(id))
- .unwrap();
-
window.set_cursor_icon(conversion::mouse_interaction(
new_mouse_interaction,
));
@@ -513,7 +519,7 @@ async fn run_instance<A, E, C>(
&debug.overlay(),
);
- context.swap_buffers().expect("Swap buffers");
+ context.swap_buffers(window).expect("Swap buffers");
debug.render_finished();