Rename WindowAdapterSealed to WindowAdapterInternal

This commit is contained in:
Olivier Goffart 2023-06-13 14:43:18 +02:00 committed by Olivier Goffart
parent f4dba7bcfd
commit 23b910725f
9 changed files with 15 additions and 15 deletions

View file

@ -8,7 +8,7 @@ use i_slint_core::platform::{Platform, PlatformError};
use i_slint_core::renderer::Renderer; use i_slint_core::renderer::Renderer;
use i_slint_core::software_renderer::{RepaintBufferType, SoftwareRenderer}; use i_slint_core::software_renderer::{RepaintBufferType, SoftwareRenderer};
use i_slint_core::window::ffi::WindowAdapterRcOpaque; use i_slint_core::window::ffi::WindowAdapterRcOpaque;
use i_slint_core::window::{WindowAdapter, WindowAdapterSealed}; use i_slint_core::window::{WindowAdapter, WindowAdapterInternal};
use raw_window_handle::{RawDisplayHandle, RawWindowHandle}; use raw_window_handle::{RawDisplayHandle, RawWindowHandle};
use std::rc::Rc; use std::rc::Rc;
@ -54,7 +54,7 @@ impl WindowAdapter for CppWindowAdapter {
} }
} }
impl WindowAdapterSealed for CppWindowAdapter { impl WindowAdapterInternal for CppWindowAdapter {
fn show(&self) -> Result<(), PlatformError> { fn show(&self) -> Result<(), PlatformError> {
unsafe { (self.show)(self.user_data) }; unsafe { (self.show)(self.user_data) };
Ok(()) Ok(())

View file

@ -22,7 +22,7 @@ use i_slint_core::lengths::{
LogicalLength, LogicalPoint, LogicalRect, LogicalSize, LogicalVector, PhysicalPx, ScaleFactor, LogicalLength, LogicalPoint, LogicalRect, LogicalSize, LogicalVector, PhysicalPx, ScaleFactor,
}; };
use i_slint_core::platform::{PlatformError, WindowEvent}; use i_slint_core::platform::{PlatformError, WindowEvent};
use i_slint_core::window::{WindowAdapter, WindowAdapterSealed, WindowInner}; use i_slint_core::window::{WindowAdapter, WindowAdapterInternal, WindowInner};
use i_slint_core::{ImageInner, Property, SharedString}; use i_slint_core::{ImageInner, Property, SharedString};
use items::{ImageFit, TextHorizontalAlignment, TextVerticalAlignment}; use items::{ImageFit, TextHorizontalAlignment, TextVerticalAlignment};
@ -1563,7 +1563,7 @@ impl WindowAdapter for QtWindow {
} }
} }
impl WindowAdapterSealed for QtWindow { impl WindowAdapterInternal for QtWindow {
fn show(&self) -> Result<(), PlatformError> { fn show(&self) -> Result<(), PlatformError> {
let component_rc = WindowInner::from_pub(&self.window).component(); let component_rc = WindowInner::from_pub(&self.window).component();
let component = ComponentRc::borrow_pin(&component_rc); let component = ComponentRc::borrow_pin(&component_rc);

View file

@ -8,7 +8,7 @@ use i_slint_core::graphics::euclid::{Point2D, Size2D};
use i_slint_core::graphics::FontRequest; use i_slint_core::graphics::FontRequest;
use i_slint_core::lengths::{LogicalLength, LogicalPoint, LogicalRect, LogicalSize, ScaleFactor}; use i_slint_core::lengths::{LogicalLength, LogicalPoint, LogicalRect, LogicalSize, ScaleFactor};
use i_slint_core::renderer::{Renderer, RendererSealed}; use i_slint_core::renderer::{Renderer, RendererSealed};
use i_slint_core::window::WindowAdapterSealed; use i_slint_core::window::WindowAdapterInternal;
use i_slint_core::window::{InputMethodRequest, WindowAdapter}; use i_slint_core::window::{InputMethodRequest, WindowAdapter};
use std::cell::RefCell; use std::cell::RefCell;
@ -60,7 +60,7 @@ pub struct TestingWindow {
pub ime_requests: RefCell<Vec<InputMethodRequest>>, pub ime_requests: RefCell<Vec<InputMethodRequest>>,
} }
impl WindowAdapterSealed for TestingWindow { impl WindowAdapterInternal for TestingWindow {
fn show(&self) -> Result<(), PlatformError> { fn show(&self) -> Result<(), PlatformError> {
self.shown.set(true); self.shown.set(true);
Ok(()) Ok(())

View file

@ -25,7 +25,7 @@ use corelib::items::MouseCursor;
use corelib::layout::Orientation; use corelib::layout::Orientation;
use corelib::lengths::{LogicalLength, LogicalSize}; use corelib::lengths::{LogicalLength, LogicalSize};
use corelib::platform::{PlatformError, WindowEvent}; use corelib::platform::{PlatformError, WindowEvent};
use corelib::window::{WindowAdapter, WindowAdapterSealed, WindowInner}; use corelib::window::{WindowAdapter, WindowAdapterInternal, WindowInner};
use corelib::Property; use corelib::Property;
use corelib::{graphics::*, Coord}; use corelib::{graphics::*, Coord};
use i_slint_core as corelib; use i_slint_core as corelib;
@ -310,7 +310,7 @@ impl WindowAdapter for WinitWindowAdapter {
} }
} }
impl WindowAdapterSealed for WinitWindowAdapter { impl WindowAdapterInternal for WinitWindowAdapter {
fn request_redraw(&self) { fn request_redraw(&self) {
self.pending_redraw.set(true); self.pending_redraw.set(true);
self.with_window_handle(&mut |window| window.request_redraw()) self.with_window_handle(&mut |window| window.request_redraw())

View file

@ -352,7 +352,7 @@ impl Window {
/// fn size(&self) -> PhysicalSize { unimplemented!() } /// fn size(&self) -> PhysicalSize { unimplemented!() }
/// fn renderer(&self) -> &dyn Renderer { unimplemented!() } /// fn renderer(&self) -> &dyn Renderer { unimplemented!() }
/// } /// }
/// # impl i_slint_core::window::WindowAdapterSealed for MyWindowAdapter { /// # impl i_slint_core::window::WindowAdapterInternal for MyWindowAdapter {
/// # } /// # }
/// ///
/// fn create_window_adapter() -> Rc<dyn WindowAdapter> { /// fn create_window_adapter() -> Rc<dyn WindowAdapter> {

View file

@ -139,7 +139,7 @@ impl<T: Clone> ItemCache<T> {
/// Function that must be called when a component is destroyed. /// Function that must be called when a component is destroyed.
/// ///
/// Usually can be called from [`crate::window::WindowAdapterSealed::unregister_component`] /// Usually can be called from [`crate::window::WindowAdapterInternal::unregister_component`]
pub fn component_destroyed(&self, component: crate::component::ComponentRef) { pub fn component_destroyed(&self, component: crate::component::ComponentRef) {
let component_ptr: *const _ = let component_ptr: *const _ =
crate::component::ComponentRef::as_ptr(component).cast().as_ptr(); crate::component::ComponentRef::as_ptr(component).cast().as_ptr();

View file

@ -2012,7 +2012,7 @@ impl MinimalSoftwareWindow {
} }
} }
impl crate::window::WindowAdapterSealed for MinimalSoftwareWindow { impl crate::window::WindowAdapterInternal for MinimalSoftwareWindow {
fn request_redraw(&self) { fn request_redraw(&self) {
self.needs_redraw.set(true); self.needs_redraw.set(true);
} }

View file

@ -57,7 +57,7 @@ fn input_as_key_event(input: KeyInputEvent, modifiers: KeyboardModifiers) -> Key
/// yourself, but you should use the provided window adapter. Use /// yourself, but you should use the provided window adapter. Use
/// [`MinimalSoftwareWindow`](crate::software_renderer::MinimalSoftwareWindow) when /// [`MinimalSoftwareWindow`](crate::software_renderer::MinimalSoftwareWindow) when
/// implementing your own [`platform`](crate::platform). /// implementing your own [`platform`](crate::platform).
pub trait WindowAdapter: WindowAdapterSealed { pub trait WindowAdapter: WindowAdapterInternal {
/// Returns the window API. /// Returns the window API.
fn window(&self) -> &Window; fn window(&self) -> &Window;
@ -109,7 +109,7 @@ pub trait WindowAdapter: WindowAdapterSealed {
// `#[doc(hidden)] fn internal(&self, InternalToken) -> Option<&WindowAdapterInternal> {None}` // `#[doc(hidden)] fn internal(&self, InternalToken) -> Option<&WindowAdapterInternal> {None}`
// TODO: add events for window receiving and loosing focus // TODO: add events for window receiving and loosing focus
#[doc(hidden)] #[doc(hidden)]
pub trait WindowAdapterSealed { pub trait WindowAdapterInternal {
/// Registers the window with the windowing system. /// Registers the window with the windowing system.
// TODO: make public, consider renaming to set_visible with a bool // TODO: make public, consider renaming to set_visible with a bool
fn show(&self) -> Result<(), PlatformError> { fn show(&self) -> Result<(), PlatformError> {
@ -193,7 +193,7 @@ pub trait WindowAdapterSealed {
} }
} }
/// This is the parameter from [`WindowAdapterSealed::input_method_request()`] which lets the editable text input field /// This is the parameter from [`WindowAdapterInternal::input_method_request()`] which lets the editable text input field
/// communicate with the platform about input methods. /// communicate with the platform about input methods.
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
#[non_exhaustive] #[non_exhaustive]

View file

@ -16,7 +16,7 @@ use i_slint_core::{
platform::PlatformError, platform::PlatformError,
renderer::RendererSealed, renderer::RendererSealed,
software_renderer::{LineBufferProvider, MinimalSoftwareWindow}, software_renderer::{LineBufferProvider, MinimalSoftwareWindow},
window::WindowAdapterSealed, window::WindowAdapterInternal,
}; };
pub struct SwrTestingBackend { pub struct SwrTestingBackend {