From 7105992228e58566cfacb6a1d6e10ec60fb05ecf Mon Sep 17 00:00:00 2001
From: dtzxporter <dtzxporter@users.noreply.github.com>
Date: Fri, 19 Jan 2024 14:48:14 -0500
Subject: Re-implement against latest iced master. Rename FetchNativeHandle.

---
 winit/src/application.rs  |  9 +++++++++
 winit/src/multi_window.rs | 12 ++++++++++++
 2 files changed, 21 insertions(+)

(limited to 'winit')

diff --git a/winit/src/application.rs b/winit/src/application.rs
index 24c98d46..f28aca32 100644
--- a/winit/src/application.rs
+++ b/winit/src/application.rs
@@ -23,6 +23,8 @@ use crate::{Clipboard, Error, Proxy, Settings};
 
 use futures::channel::mpsc;
 
+use winit::raw_window_handle::HasWindowHandle;
+
 use std::mem::ManuallyDrop;
 use std::sync::Arc;
 
@@ -783,6 +785,13 @@ pub fn run_command<A, C, E>(
                         .send_event(tag(window.id().into()))
                         .expect("Send message to event loop");
                 }
+                window::Action::FetchNativeHandle(_id, tag) => {
+                    proxy
+                        .send_event(tag(&window
+                            .window_handle()
+                            .expect("Missing window handle")))
+                        .expect("Send message to event loop");
+                }
                 window::Action::Screenshot(_id, tag) => {
                     let bytes = compositor.screenshot(
                         renderer,
diff --git a/winit/src/multi_window.rs b/winit/src/multi_window.rs
index 662adf5b..1b5fe375 100644
--- a/winit/src/multi_window.rs
+++ b/winit/src/multi_window.rs
@@ -22,6 +22,8 @@ use crate::runtime::Debug;
 use crate::style::application::StyleSheet;
 use crate::{Clipboard, Error, Proxy, Settings};
 
+use winit::raw_window_handle::HasWindowHandle;
+
 use std::collections::HashMap;
 use std::mem::ManuallyDrop;
 use std::sync::Arc;
@@ -1037,6 +1039,16 @@ fn run_command<A, C, E>(
                             .expect("Event loop doesn't exist.");
                     }
                 }
+                window::Action::FetchNativeHandle(id, tag) => {
+                    if let Some(window) = window_manager.get_mut(id) {
+                        proxy
+                            .send_event(tag(&window
+                                .raw
+                                .window_handle()
+                                .expect("Missing window handle.")))
+                            .expect("Event loop doesn't exist.");
+                    }
+                }
                 window::Action::Screenshot(id, tag) => {
                     if let Some(window) = window_manager.get_mut(id) {
                         let bytes = compositor.screenshot(
-- 
cgit