Skip to content

Commit e99d59f

Browse files
committed
Reorder window functions to have getter before setter
1 parent 4d9302b commit e99d59f

File tree

1 file changed

+66
-66
lines changed

1 file changed

+66
-66
lines changed

winit-core/src/window.rs

Lines changed: 66 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -850,13 +850,6 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
850850
/// - **iOS / Android / Web / Orbital:** Unsupported.
851851
fn set_surface_resize_increments(&self, increments: Option<Size>);
852852

853-
/// Modifies the title of the window.
854-
///
855-
/// ## Platform-specific
856-
///
857-
/// - **iOS / Android:** Unsupported.
858-
fn set_title(&self, title: &str);
859-
860853
/// Change the window transparency state.
861854
///
862855
/// This is just a hint that may not change anything about
@@ -884,6 +877,17 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
884877
/// - **Wayland:** Only works with org_kde_kwin_blur_manager protocol.
885878
fn set_blur(&self, blur: bool);
886879

880+
/// Gets the window's current visibility state.
881+
///
882+
/// `None` means it couldn't be determined, so it is not recommended to use this to drive your
883+
/// rendering backend.
884+
///
885+
/// ## Platform-specific
886+
///
887+
/// - **X11:** Not implemented.
888+
/// - **Wayland / iOS / Android / Web:** Unsupported.
889+
fn is_visible(&self) -> Option<bool>;
890+
887891
/// Modifies the window's visibility.
888892
///
889893
/// If `false`, this will hide the window. If `true`, this will show the window.
@@ -893,16 +897,13 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
893897
/// - **Android / Wayland / Web:** Unsupported.
894898
fn set_visible(&self, visible: bool);
895899

896-
/// Gets the window's current visibility state.
897-
///
898-
/// `None` means it couldn't be determined, so it is not recommended to use this to drive your
899-
/// rendering backend.
900+
/// Gets the window's current resizable state.
900901
///
901902
/// ## Platform-specific
902903
///
903904
/// - **X11:** Not implemented.
904-
/// - **Wayland / iOS / Android / Web:** Unsupported.
905-
fn is_visible(&self) -> Option<bool>;
905+
/// - **iOS / Android / Web:** Unsupported.
906+
fn is_resizable(&self) -> bool;
906907

907908
/// Sets whether the window is resizable or not.
908909
///
@@ -921,13 +922,13 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
921922
/// [`WindowEvent::SurfaceResized`]: crate::event::WindowEvent::SurfaceResized
922923
fn set_resizable(&self, resizable: bool);
923924

924-
/// Gets the window's current resizable state.
925+
/// Gets the enabled window buttons.
925926
///
926927
/// ## Platform-specific
927928
///
928-
/// - **X11:** Not implemented.
929-
/// - **iOS / Android / Web:** Unsupported.
930-
fn is_resizable(&self) -> bool;
929+
/// - **Wayland / X11 / Orbital:** Not implemented. Always returns [`WindowButtons::all`].
930+
/// - **Web / iOS / Android:** Unsupported. Always returns [`WindowButtons::all`].
931+
fn enabled_buttons(&self) -> WindowButtons;
931932

932933
/// Sets the enabled window buttons.
933934
///
@@ -937,13 +938,19 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
937938
/// - **Web / iOS / Android:** Unsupported.
938939
fn set_enabled_buttons(&self, buttons: WindowButtons);
939940

940-
/// Gets the enabled window buttons.
941+
/// Gets the window's current minimized state.
942+
///
943+
/// `None` will be returned, if the minimized state couldn't be determined.
944+
///
945+
/// ## Note
946+
///
947+
/// - You shouldn't stop rendering for minimized windows, however you could lower the fps.
941948
///
942949
/// ## Platform-specific
943950
///
944-
/// - **Wayland / X11 / Orbital:** Not implemented. Always returns [`WindowButtons::all`].
945-
/// - **Web / iOS / Android:** Unsupported. Always returns [`WindowButtons::all`].
946-
fn enabled_buttons(&self) -> WindowButtons;
951+
/// - **Wayland**: always `None`.
952+
/// - **iOS / Android / Web / Orbital:** Unsupported.
953+
fn is_minimized(&self) -> Option<bool>;
947954

948955
/// Minimize the window, or put it back from the minimized state.
949956
///
@@ -953,19 +960,12 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
953960
/// - **Wayland:** Un-minimize is unsupported.
954961
fn set_minimized(&self, minimized: bool);
955962

956-
/// Gets the window's current minimized state.
957-
///
958-
/// `None` will be returned, if the minimized state couldn't be determined.
959-
///
960-
/// ## Note
961-
///
962-
/// - You shouldn't stop rendering for minimized windows, however you could lower the fps.
963+
/// Gets the window's current maximized state.
963964
///
964965
/// ## Platform-specific
965966
///
966-
/// - **Wayland**: always `None`.
967-
/// - **iOS / Android / Web / Orbital:** Unsupported.
968-
fn is_minimized(&self) -> Option<bool>;
967+
/// - **iOS / Android / Web:** Unsupported.
968+
fn is_maximized(&self) -> bool;
969969

970970
/// Sets the window to maximized or back.
971971
///
@@ -974,12 +974,14 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
974974
/// - **iOS / Android / Web:** Unsupported.
975975
fn set_maximized(&self, maximized: bool);
976976

977-
/// Gets the window's current maximized state.
977+
/// Gets the window's current fullscreen state.
978978
///
979979
/// ## Platform-specific
980980
///
981-
/// - **iOS / Android / Web:** Unsupported.
982-
fn is_maximized(&self) -> bool;
981+
/// - **Android:** Will always return `None`.
982+
/// - **Orbital / Web:** Can only return `None` or `Borderless(None)`.
983+
/// - **Wayland:** Can return `Borderless(None)` when there are no monitors.
984+
fn fullscreen(&self) -> Option<Fullscreen>;
983985

984986
/// Set the window's fullscreen state.
985987
///
@@ -1006,14 +1008,15 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
10061008
/// [`VideoMode`]: crate::monitor::VideoMode
10071009
fn set_fullscreen(&self, fullscreen: Option<Fullscreen>);
10081010

1009-
/// Gets the window's current fullscreen state.
1011+
/// Gets the window's current decorations state.
1012+
///
1013+
/// Returns `true` when windows are decorated (server-side or by Winit).
1014+
/// Also returns `true` when no decorations are required (mobile, Web).
10101015
///
10111016
/// ## Platform-specific
10121017
///
1013-
/// - **Android:** Will always return `None`.
1014-
/// - **Orbital / Web:** Can only return `None` or `Borderless(None)`.
1015-
/// - **Wayland:** Can return `Borderless(None)` when there are no monitors.
1016-
fn fullscreen(&self) -> Option<Fullscreen>;
1018+
/// - **iOS / Android / Web:** Always returns `true`.
1019+
fn is_decorated(&self) -> bool;
10171020

10181021
/// Turn window decorations on or off.
10191022
///
@@ -1026,16 +1029,6 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
10261029
/// - **iOS / Android / Web:** No effect.
10271030
fn set_decorations(&self, decorations: bool);
10281031

1029-
/// Gets the window's current decorations state.
1030-
///
1031-
/// Returns `true` when windows are decorated (server-side or by Winit).
1032-
/// Also returns `true` when no decorations are required (mobile, Web).
1033-
///
1034-
/// ## Platform-specific
1035-
///
1036-
/// - **iOS / Android / Web:** Always returns `true`.
1037-
fn is_decorated(&self) -> bool;
1038-
10391032
/// Change the window level.
10401033
///
10411034
/// This is just a hint to the OS, and the system could ignore it.
@@ -1223,6 +1216,13 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
12231216
/// By default IME is disabled, thus will return `None`.
12241217
fn ime_capabilities(&self) -> Option<ImeCapabilities>;
12251218

1219+
/// Gets whether the window has keyboard focus.
1220+
///
1221+
/// This queries the same state information as [`WindowEvent::Focused`].
1222+
///
1223+
/// [`WindowEvent::Focused`]: crate::event::WindowEvent::Focused
1224+
fn has_focus(&self) -> bool;
1225+
12261226
/// Brings the window to the front and sets input focus. Has no effect if the window is
12271227
/// already in focus, minimized, or not visible.
12281228
///
@@ -1235,13 +1235,6 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
12351235
/// - **iOS / Android / Wayland / Orbital:** Unsupported.
12361236
fn focus_window(&self);
12371237

1238-
/// Gets whether the window has keyboard focus.
1239-
///
1240-
/// This queries the same state information as [`WindowEvent::Focused`].
1241-
///
1242-
/// [`WindowEvent::Focused`]: crate::event::WindowEvent::Focused
1243-
fn has_focus(&self) -> bool;
1244-
12451238
/// Requests user attention to the window, this has no effect if the application
12461239
/// is already focused. How requesting for user attention manifests is platform dependent,
12471240
/// see [`UserAttentionType`] for details.
@@ -1257,6 +1250,16 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
12571250
/// - **Wayland:** Requires `xdg_activation_v1` protocol, `None` has no effect.
12581251
fn request_user_attention(&self, request_type: Option<UserAttentionType>);
12591252

1253+
/// Returns the current window theme.
1254+
///
1255+
/// Returns `None` if it cannot be determined on the current platform.
1256+
///
1257+
/// ## Platform-specific
1258+
///
1259+
/// - **iOS / Android / x11 / Orbital:** Unsupported.
1260+
/// - **Wayland:** Only returns theme overrides.
1261+
fn theme(&self) -> Option<Theme>;
1262+
12601263
/// Set or override the window theme.
12611264
///
12621265
/// Specify `None` to reset the theme to the system default.
@@ -1270,16 +1273,6 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
12701273
/// - **iOS / Android / Web / Orbital:** Unsupported.
12711274
fn set_theme(&self, theme: Option<Theme>);
12721275

1273-
/// Returns the current window theme.
1274-
///
1275-
/// Returns `None` if it cannot be determined on the current platform.
1276-
///
1277-
/// ## Platform-specific
1278-
///
1279-
/// - **iOS / Android / x11 / Orbital:** Unsupported.
1280-
/// - **Wayland:** Only returns theme overrides.
1281-
fn theme(&self) -> Option<Theme>;
1282-
12831276
/// Prevents the window contents from being captured by other apps.
12841277
///
12851278
/// ## Platform-specific
@@ -1298,6 +1291,13 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
12981291
/// - **iOS / Android / x11 / Wayland / Web:** Unsupported. Always returns an empty string.
12991292
fn title(&self) -> String;
13001293

1294+
/// Modifies the title of the window.
1295+
///
1296+
/// ## Platform-specific
1297+
///
1298+
/// - **iOS / Android:** Unsupported.
1299+
fn set_title(&self, title: &str);
1300+
13011301
/// Modifies the cursor icon of the window.
13021302
///
13031303
/// ## Platform-specific

0 commit comments

Comments
 (0)