mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-03 07:10:05 -04:00
macOS: resample deferred macOS surface resize events
This commit is contained in:
committed by
GitHub
parent
9107acecbf
commit
aa6410de30
@@ -6,7 +6,7 @@ use std::rc::Rc;
|
||||
use dpi::{LogicalPosition, PhysicalSize};
|
||||
use objc2::rc::Retained;
|
||||
use objc2::runtime::{AnyObject, Sel};
|
||||
use objc2::{AnyThread, DefinedClass, MainThreadMarker, define_class, msg_send};
|
||||
use objc2::{AnyThread, DefinedClass, MainThreadMarker, Message, define_class, msg_send};
|
||||
use objc2_app_kit::{
|
||||
NSApplication, NSCursor, NSDragOperation, NSDraggingSession, NSEvent, NSEventPhase,
|
||||
NSResponder, NSTextInputClient, NSTrackingArea, NSTrackingAreaOptions, NSView,
|
||||
@@ -904,13 +904,14 @@ impl WinitView {
|
||||
});
|
||||
}
|
||||
|
||||
fn surface_resized(&self) {
|
||||
pub(super) fn surface_resized(&self) {
|
||||
let Some(window) = (**self).window() else {
|
||||
return;
|
||||
};
|
||||
let size = self.surface_size();
|
||||
let window_id = window_id(&window);
|
||||
let view = self.retain();
|
||||
self.ivars().app_state.maybe_queue_with_handler(move |app, event_loop| {
|
||||
let size = view.surface_size();
|
||||
app.window_event(event_loop, window_id, WindowEvent::SurfaceResized(size));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1119,7 +1119,7 @@ impl WindowDelegate {
|
||||
let size = NSSize::new(logical_size.width, logical_size.height);
|
||||
window.setContentSize(size);
|
||||
}
|
||||
self.queue_event(WindowEvent::SurfaceResized(physical_size));
|
||||
self.view().surface_resized();
|
||||
}
|
||||
|
||||
fn emit_move_event(&self) {
|
||||
|
||||
@@ -122,6 +122,8 @@ changelog entry.
|
||||
- On macOS, fix borderless game presentation options not sticking after switching spaces.
|
||||
- On macOS, fix IME being locked on (regardless of requests to disable) after being enabled once.
|
||||
- On macOS, fix a panic and incorrect cursor position in Ime::Preedit when the preedit string contains special characters (ie. emojis) caused by incorrect UTF-16 to UTF-8 offset conversion.
|
||||
- On macOS, prevent an older deferred surface resize from overriding newer sizes after AppKit
|
||||
transitions.
|
||||
- On Wayland, fix a protocol error when setting a custom cursor on compositors with `wl_surface` version below 3.
|
||||
- On Redox, fix `run_app_on_demand` exiting immediately after a previous `run_app_on_demand` called `exit`.
|
||||
- On Redox, fill in logical key for keyboard events rather than emitting a separate fake IME event.
|
||||
|
||||
Reference in New Issue
Block a user