Skip to content

Commit

Permalink
chore: drop v0.30 deprecated APIs
Browse files Browse the repository at this point in the history
Co-authored-by: daxpedda <[email protected]>
  • Loading branch information
kchibisov and daxpedda authored Jul 26, 2024
1 parent 4e2e764 commit facb809
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 54 deletions.
12 changes: 9 additions & 3 deletions src/changelog/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,16 @@ changelog entry.

### Removed

- Remove `EventLoop::run`.
- Remove `EventLoopExtRunOnDemand::run_on_demand`.
- Remove `EventLoopExtPumpEvents::pump_events`.
- Remove `Event`.
- Remove already deprecated APIs:
- `EventLoop::create_window()`
- `EventLoop::run`.
- `EventLoopBuilder::new()`
- `EventLoopExtPumpEvents::pump_events`.
- `EventLoopExtRunOnDemand::run_on_demand`.
- `VideoMode`
- `WindowAttributes::new()`
- `Window::set_cursor_icon()`
- On iOS, remove `platform::ios::EventLoopExtIOS` and related `platform::ios::Idiom` type.

This feature was incomplete, and the equivalent functionality can be trivially achieved outside
Expand Down
27 changes: 0 additions & 27 deletions src/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,6 @@ pub struct EventLoopBuilder {

static EVENT_LOOP_CREATED: AtomicBool = AtomicBool::new(false);

impl EventLoopBuilder {
/// Start building a new event loop.
#[inline]
#[deprecated = "use `EventLoop::builder` instead"]
pub fn new() -> Self {
EventLoop::builder()
}
}

impl EventLoopBuilder {
/// Builds a new event loop.
///
Expand Down Expand Up @@ -278,24 +269,6 @@ impl EventLoop {
self.event_loop.window_target().p.set_control_flow(control_flow)
}

/// Create a window.
///
/// Creating window without event loop running often leads to improper window creation;
/// use [`ActiveEventLoop::create_window`] instead.
#[deprecated = "use `ActiveEventLoop::create_window` instead"]
#[inline]
pub fn create_window(&self, window_attributes: WindowAttributes) -> Result<Window, OsError> {
let _span = tracing::debug_span!(
"winit::EventLoop::create_window",
window_attributes = ?window_attributes
)
.entered();

let window =
platform_impl::Window::new(&self.event_loop.window_target().p, window_attributes)?;
Ok(Window { window })
}

/// Create custom cursor.
pub fn create_custom_cursor(&self, custom_cursor: CustomCursorSource) -> CustomCursor {
self.event_loop.window_target().p.create_custom_cursor(custom_cursor)
Expand Down
4 changes: 0 additions & 4 deletions src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
use crate::dpi::{PhysicalPosition, PhysicalSize};
use crate::platform_impl;

/// Deprecated! Use `VideoModeHandle` instead.
#[deprecated = "Renamed to `VideoModeHandle`"]
pub type VideoMode = VideoModeHandle;

/// Describes a fullscreen video mode of a monitor.
///
/// Can be acquired with [`MonitorHandle::video_modes`].
Expand Down
8 changes: 4 additions & 4 deletions src/platform/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ pub trait EventLoopBuilderExtWindows {
/// Disable process-wide DPI awareness.
///
/// ```
/// use winit::event_loop::EventLoopBuilder;
/// use winit::event_loop::EventLoop;
/// #[cfg(target_os = "windows")]
/// use winit::platform::windows::EventLoopBuilderExtWindows;
///
/// let mut builder = EventLoopBuilder::new();
/// let mut builder = EventLoop::builder();
/// #[cfg(target_os = "windows")]
/// builder.with_dpi_aware(false);
/// # if false { // We can't test this part
Expand All @@ -203,11 +203,11 @@ pub trait EventLoopBuilderExtWindows {
///
/// ```
/// # use windows_sys::Win32::UI::WindowsAndMessaging::{ACCEL, CreateAcceleratorTableW, TranslateAcceleratorW, DispatchMessageW, TranslateMessage, MSG};
/// use winit::event_loop::EventLoopBuilder;
/// use winit::event_loop::EventLoop;
/// #[cfg(target_os = "windows")]
/// use winit::platform::windows::EventLoopBuilderExtWindows;
///
/// let mut builder = EventLoopBuilder::new();
/// let mut builder = EventLoop::builder();
/// #[cfg(target_os = "windows")]
/// builder.with_msg_hook(|msg|{
/// let msg = msg as *const MSG;
Expand Down
16 changes: 0 additions & 16 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,6 @@ unsafe impl Send for SendSyncRawWindowHandle {}
#[cfg(feature = "rwh_06")]
unsafe impl Sync for SendSyncRawWindowHandle {}

impl WindowAttributes {
/// Initializes new attributes with default values.
#[inline]
#[deprecated = "use `Window::default_attributes` instead"]
pub fn new() -> Self {
Default::default()
}
}

impl WindowAttributes {
/// Get the parent window stored on the attributes.
#[cfg(feature = "rwh_06")]
Expand Down Expand Up @@ -1433,13 +1424,6 @@ impl Window {
self.window.maybe_queue_on_main(move |w| w.set_cursor(cursor))
}

/// Deprecated! Use [`Window::set_cursor()`] instead.
#[deprecated = "Renamed to `set_cursor`"]
#[inline]
pub fn set_cursor_icon(&self, icon: CursorIcon) {
self.set_cursor(icon)
}

/// Changes the position of the cursor in window coordinates.
///
/// ```no_run
Expand Down

0 comments on commit facb809

Please sign in to comment.