Skip to content

Commit dbb7ec4

Browse files
committed
fix examples not compiling
1 parent 2779ba5 commit dbb7ec4

File tree

9 files changed

+25
-25
lines changed

9 files changed

+25
-25
lines changed

examples/application.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use winit::platform::web::{ActiveEventLoopExtWeb, WindowAttributesWeb};
4141
use winit::platform::x11::{ActiveEventLoopExtX11, WindowAttributesX11};
4242
use winit::window::{
4343
CursorGrabMode, ImeCapabilities, ImeEnableRequest, ImePurpose, ImeRequestData, ResizeDirection,
44-
SurfaceId, Theme, Window, WindowAttributes,
44+
WindowId, Theme, Window, WindowAttributes,
4545
};
4646
use winit_core::application::macos::ApplicationHandlerExtMacOS;
4747
use winit_core::window::ImeRequest;
@@ -95,7 +95,7 @@ struct Application {
9595
custom_cursors: Result<Vec<CustomCursor>, RequestError>,
9696
/// Application icon.
9797
icon: Icon,
98-
windows: HashMap<SurfaceId, WindowState>,
98+
windows: HashMap<WindowId, WindowState>,
9999
/// Drawing context.
100100
///
101101
/// With OpenGL it could be EGLDisplay.
@@ -147,7 +147,7 @@ impl Application {
147147
&mut self,
148148
event_loop: &dyn ActiveEventLoop,
149149
_tab_id: Option<String>,
150-
) -> Result<SurfaceId, Box<dyn Error>> {
150+
) -> Result<WindowId, Box<dyn Error>> {
151151
// TODO read-out activation token.
152152

153153
#[allow(unused_mut)]
@@ -213,7 +213,7 @@ impl Application {
213213
fn handle_action_with_window(
214214
&mut self,
215215
event_loop: &dyn ActiveEventLoop,
216-
window_id: SurfaceId,
216+
window_id: WindowId,
217217
action: Action,
218218
) {
219219
// let cursor_position = self.cursor_position;
@@ -415,7 +415,7 @@ impl ApplicationHandler for Application {
415415
fn window_event(
416416
&mut self,
417417
event_loop: &dyn ActiveEventLoop,
418-
window_id: SurfaceId,
418+
window_id: WindowId,
419419
event: WindowEvent,
420420
) {
421421
let window = match self.windows.get_mut(&window_id) {
@@ -601,7 +601,7 @@ impl ApplicationHandlerExtMacOS for Application {
601601
fn standard_key_binding(
602602
&mut self,
603603
_event_loop: &dyn ActiveEventLoop,
604-
window_id: SurfaceId,
604+
window_id: WindowId,
605605
action: &str,
606606
) {
607607
info!(?window_id, ?action, "macOS standard key binding");

examples/child_window.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn main() -> Result<(), impl std::error::Error> {
88
use winit::event::{ElementState, KeyEvent, WindowEvent};
99
use winit::event_loop::{ActiveEventLoop, EventLoop};
1010
use winit::raw_window_handle::HasRawWindowHandle;
11-
use winit::window::{SurfaceId, Window, WindowAttributes};
11+
use winit::window::{WindowId, Window, WindowAttributes};
1212

1313
#[path = "util/fill.rs"]
1414
mod fill;
@@ -27,8 +27,8 @@ fn main() -> Result<(), impl std::error::Error> {
2727

2828
#[derive(Default, Debug)]
2929
struct Application {
30-
parent_window_id: Option<SurfaceId>,
31-
windows: HashMap<SurfaceId, WindowData>,
30+
parent_window_id: Option<WindowId>,
31+
windows: HashMap<WindowId, WindowData>,
3232
}
3333

3434
impl ApplicationHandler for Application {
@@ -47,7 +47,7 @@ fn main() -> Result<(), impl std::error::Error> {
4747
fn window_event(
4848
&mut self,
4949
event_loop: &dyn ActiveEventLoop,
50-
window_id: winit::window::SurfaceId,
50+
window_id: winit::window::WindowId,
5151
event: WindowEvent,
5252
) {
5353
match event {

examples/control_flow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use winit::application::ApplicationHandler;
1111
use winit::event::{ElementState, KeyEvent, StartCause, WindowEvent};
1212
use winit::event_loop::{ActiveEventLoop, ControlFlow, EventLoop};
1313
use winit::keyboard::{Key, NamedKey};
14-
use winit::window::{SurfaceId, Window, WindowAttributes};
14+
use winit::window::{WindowId, Window, WindowAttributes};
1515

1616
#[path = "util/fill.rs"]
1717
mod fill;
@@ -75,7 +75,7 @@ impl ApplicationHandler for ControlFlowDemo {
7575
fn window_event(
7676
&mut self,
7777
_event_loop: &dyn ActiveEventLoop,
78-
_window_id: SurfaceId,
78+
_window_id: WindowId,
7979
event: WindowEvent,
8080
) {
8181
info!("{event:?}");

examples/dnd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::error::Error;
33
use winit::application::ApplicationHandler;
44
use winit::event::WindowEvent;
55
use winit::event_loop::{ActiveEventLoop, EventLoop};
6-
use winit::window::{SurfaceId, Window, WindowAttributes};
6+
use winit::window::{WindowId, Window, WindowAttributes};
77

88
#[path = "util/fill.rs"]
99
mod fill;
@@ -41,7 +41,7 @@ impl ApplicationHandler for Application {
4141
fn window_event(
4242
&mut self,
4343
event_loop: &dyn ActiveEventLoop,
44-
_window_id: SurfaceId,
44+
_window_id: WindowId,
4545
event: WindowEvent,
4646
) {
4747
match event {

examples/pump_events.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fn main() -> std::process::ExitCode {
1111
use winit::event::WindowEvent;
1212
use winit::event_loop::pump_events::{EventLoopExtPumpEvents, PumpStatus};
1313
use winit::event_loop::{ActiveEventLoop, EventLoop};
14-
use winit::window::{SurfaceId, Window, WindowAttributes};
14+
use winit::window::{WindowId, Window, WindowAttributes};
1515

1616
#[path = "util/fill.rs"]
1717
mod fill;
@@ -30,7 +30,7 @@ fn main() -> std::process::ExitCode {
3030
fn window_event(
3131
&mut self,
3232
event_loop: &dyn ActiveEventLoop,
33-
_window_id: SurfaceId,
33+
_window_id: WindowId,
3434
event: WindowEvent,
3535
) {
3636
println!("{event:?}");

examples/run_on_demand.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
99
use winit::event::WindowEvent;
1010
use winit::event_loop::run_on_demand::EventLoopExtRunOnDemand;
1111
use winit::event_loop::{ActiveEventLoop, EventLoop};
12-
use winit::window::{SurfaceId, Window, WindowAttributes};
12+
use winit::window::{WindowId, Window, WindowAttributes};
1313

1414
#[path = "util/fill.rs"]
1515
mod fill;
1616

1717
#[derive(Default, Debug)]
1818
struct App {
1919
idx: usize,
20-
window_id: Option<SurfaceId>,
20+
window_id: Option<WindowId>,
2121
window: Option<Box<dyn Window>>,
2222
}
2323

@@ -40,7 +40,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
4040
fn window_event(
4141
&mut self,
4242
event_loop: &dyn ActiveEventLoop,
43-
window_id: SurfaceId,
43+
window_id: WindowId,
4444
event: WindowEvent,
4545
) {
4646
if event == WindowEvent::Destroyed && self.window_id == Some(window_id) {

examples/util/fill.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mod platform {
2929
use softbuffer::{Context, Surface};
3030
#[cfg(all(web_platform, not(android_platform)))]
3131
use web_time::Instant;
32-
use winit::window::{SurfaceId, Window};
32+
use winit::window::{WindowId, Window};
3333

3434
thread_local! {
3535
// NOTE: You should never do things like that, create context and drop it before
@@ -46,7 +46,7 @@ mod platform {
4646
context: RefCell<Context<&'static dyn Window>>,
4747

4848
/// The hash map of window IDs to surfaces.
49-
surfaces: HashMap<SurfaceId, Surface<&'static dyn Window, &'static dyn Window>>,
49+
surfaces: HashMap<WindowId, Surface<&'static dyn Window, &'static dyn Window>>,
5050
}
5151

5252
impl GraphicsContext {

examples/window.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use winit::event::WindowEvent;
77
use winit::event_loop::{ActiveEventLoop, EventLoop};
88
#[cfg(web_platform)]
99
use winit::platform::web::WindowAttributesWeb;
10-
use winit::window::{SurfaceId, Window, WindowAttributes};
10+
use winit::window::{WindowId, Window, WindowAttributes};
1111

1212
#[path = "util/fill.rs"]
1313
mod fill;
@@ -36,7 +36,7 @@ impl ApplicationHandler for App {
3636
}
3737
}
3838

39-
fn window_event(&mut self, event_loop: &dyn ActiveEventLoop, _: SurfaceId, event: WindowEvent) {
39+
fn window_event(&mut self, event_loop: &dyn ActiveEventLoop, _: WindowId, event: WindowEvent) {
4040
println!("{event:?}");
4141
match event {
4242
WindowEvent::CloseRequested => {

examples/x11_embed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ fn main() -> Result<(), Box<dyn Error>> {
77
use winit::event::WindowEvent;
88
use winit::event_loop::{ActiveEventLoop, EventLoop};
99
use winit::platform::x11::WindowAttributesX11;
10-
use winit::window::{SurfaceId, Window, WindowAttributes};
10+
use winit::window::{WindowId, Window, WindowAttributes};
1111

1212
#[path = "util/fill.rs"]
1313
mod fill;
@@ -33,7 +33,7 @@ fn main() -> Result<(), Box<dyn Error>> {
3333
fn window_event(
3434
&mut self,
3535
event_loop: &dyn ActiveEventLoop,
36-
_window_id: SurfaceId,
36+
_window_id: WindowId,
3737
event: WindowEvent,
3838
) {
3939
let window = self.window.as_ref().unwrap();

0 commit comments

Comments
 (0)