Remove functionality already exposed through raw-window-handle

Nothing changed from the user point of view, other than they should
use the `raw-window-handle`, which is objectively better, given that
it reduces the amount of `cfg` guards in downstream code.
This commit is contained in:
Mads Marquart 2023-08-05 20:56:22 +02:00 committed by GitHub
parent 8a7e18aaf0
commit 3c3a863cc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 27 additions and 250 deletions

View file

@ -2,7 +2,6 @@
use std::{
collections::VecDeque,
ffi::c_void,
ops::{Deref, DerefMut},
};
@ -511,16 +510,6 @@ impl Window {
// WindowExtIOS
impl Inner {
pub fn ui_window(&self) -> *mut c_void {
Id::as_ptr(&self.window) as *mut c_void
}
pub fn ui_view_controller(&self) -> *mut c_void {
Id::as_ptr(&self.view_controller) as *mut c_void
}
pub fn ui_view(&self) -> *mut c_void {
Id::as_ptr(&self.view) as *mut c_void
}
pub fn set_scale_factor(&self, scale_factor: f64) {
assert!(
dpi::validate_scale_factor(scale_factor),

View file

@ -606,11 +606,6 @@ impl Window {
self.window_state.lock().unwrap().set_ime_purpose(purpose);
}
#[inline]
pub fn display(&self) -> &WlDisplay {
&self.display
}
#[inline]
pub fn surface(&self) -> &WlSurface {
self.window.wl_surface()

View file

@ -1395,21 +1395,11 @@ impl UnownedWindow {
self.xconn.display as _
}
#[inline]
pub fn xlib_screen_id(&self) -> c_int {
self.screen_id
}
#[inline]
pub fn xlib_window(&self) -> c_ulong {
self.xwindow as ffi::Window
}
#[inline]
pub fn xcb_connection(&self) -> *mut c_void {
self.xconn.xcb_connection().get_raw_xcb_connection()
}
#[inline]
pub fn set_cursor_icon(&self, cursor: CursorIcon) {
let old_cursor = replace(&mut *self.cursor.lock().unwrap(), cursor);

View file

@ -1250,8 +1250,8 @@ impl WinitWindow {
#[inline]
pub fn raw_window_handle(&self) -> RawWindowHandle {
let mut window_handle = AppKitWindowHandle::empty();
window_handle.ns_window = self.ns_window();
window_handle.ns_view = self.ns_view();
window_handle.ns_window = self as *const Self as *mut _;
window_handle.ns_view = Id::as_ptr(&self.contentView()) as *mut _;
RawWindowHandle::AppKit(window_handle)
}
@ -1303,16 +1303,6 @@ impl WinitWindow {
}
impl WindowExtMacOS for WinitWindow {
#[inline]
fn ns_window(&self) -> *mut c_void {
self as *const Self as *mut _
}
#[inline]
fn ns_view(&self) -> *mut c_void {
Id::as_ptr(&self.contentView()) as *mut _
}
#[inline]
fn simple_fullscreen(&self) -> bool {
self.lock_shared_state("simple_fullscreen")

View file

@ -14,8 +14,7 @@ use std::{
use windows_sys::Win32::{
Foundation::{
HMODULE, HWND, LPARAM, OLE_E_WRONGCOMPOBJ, POINT, POINTS, RECT, RPC_E_CHANGED_MODE, S_OK,
WPARAM,
HWND, LPARAM, OLE_E_WRONGCOMPOBJ, POINT, POINTS, RECT, RPC_E_CHANGED_MODE, S_OK, WPARAM,
},
Graphics::{
Dwm::{DwmEnableBlurBehindWindow, DWM_BB_BLURREGION, DWM_BB_ENABLE, DWM_BLURBEHIND},
@ -322,16 +321,12 @@ impl Window {
self.window.0
}
#[inline]
pub fn hinstance(&self) -> HMODULE {
unsafe { super::get_window_long(self.hwnd(), GWLP_HINSTANCE) }
}
#[inline]
pub fn raw_window_handle(&self) -> RawWindowHandle {
let mut window_handle = Win32WindowHandle::empty();
window_handle.hwnd = self.window.0 as *mut _;
window_handle.hinstance = self.hinstance() as *mut _;
let hinstance = unsafe { super::get_window_long(self.hwnd(), GWLP_HINSTANCE) };
window_handle.hinstance = hinstance as *mut _;
RawWindowHandle::Win32(window_handle)
}