fix(app): draggable windows on X11 systems using winit
This commit is contained in:
parent
6457481ae5
commit
6927220325
3 changed files with 7 additions and 9 deletions
|
|
@ -10,4 +10,4 @@ tracing-subscriber = "0.3.17"
|
||||||
[dependencies.libcosmic]
|
[dependencies.libcosmic]
|
||||||
path = "../../"
|
path = "../../"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["debug", "wayland", "tokio"]
|
features = ["debug", "winit", "tokio"]
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
.antialiasing(true)
|
.antialiasing(true)
|
||||||
.client_decorations(true)
|
.client_decorations(true)
|
||||||
.debug(false)
|
.debug(false)
|
||||||
.default_icon_theme(Some("Pop".into()))
|
.default_icon_theme("Pop")
|
||||||
.default_text_size(16.0)
|
.default_text_size(16.0)
|
||||||
.scale_factor(1.0)
|
.scale_factor(1.0)
|
||||||
.size((1024, 768))
|
.size((1024, 768))
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@ use iced_runtime::command::platform_specific::wayland::Action as WaylandAction;
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
use iced_runtime::command::platform_specific::Action as PlatformAction;
|
use iced_runtime::command::platform_specific::Action as PlatformAction;
|
||||||
use iced_runtime::command::Action;
|
use iced_runtime::command::Action;
|
||||||
#[cfg(not(feature = "wayland"))]
|
|
||||||
use iced_runtime::window::Action as WindowAction;
|
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
|
|
||||||
/// Yields a command which contains a batch of commands.
|
/// Yields a command which contains a batch of commands.
|
||||||
|
|
@ -42,7 +40,7 @@ pub fn drag<M>() -> Command<M> {
|
||||||
/// Initiates a window drag.
|
/// Initiates a window drag.
|
||||||
#[cfg(not(feature = "wayland"))]
|
#[cfg(not(feature = "wayland"))]
|
||||||
pub fn drag<M>() -> Command<M> {
|
pub fn drag<M>() -> Command<M> {
|
||||||
iced::Command::none()
|
iced_runtime::window::drag()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Fullscreens the window.
|
/// Fullscreens the window.
|
||||||
|
|
@ -54,7 +52,7 @@ pub fn fullscreen<M>() -> Command<M> {
|
||||||
/// Fullscreens the window.
|
/// Fullscreens the window.
|
||||||
#[cfg(not(feature = "wayland"))]
|
#[cfg(not(feature = "wayland"))]
|
||||||
pub fn fullscreen<M>() -> Command<M> {
|
pub fn fullscreen<M>() -> Command<M> {
|
||||||
iced::Command::single(Action::Window(WindowAction::ChangeMode(Mode::Fullscreen)))
|
iced_runtime::window::change_mode(Mode::Fullscreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Minimizes the window.
|
/// Minimizes the window.
|
||||||
|
|
@ -66,7 +64,7 @@ pub fn minimize<M>() -> Command<M> {
|
||||||
/// Minimizes the window.
|
/// Minimizes the window.
|
||||||
#[cfg(not(feature = "wayland"))]
|
#[cfg(not(feature = "wayland"))]
|
||||||
pub fn minimize<M>() -> Command<M> {
|
pub fn minimize<M>() -> Command<M> {
|
||||||
iced::Command::single(Action::Window(WindowAction::ChangeMode(Mode::Hidden)))
|
iced_runtime::window::minimize(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the title of a window.
|
/// Sets the title of a window.
|
||||||
|
|
@ -94,7 +92,7 @@ pub fn set_windowed<M>() -> Command<M> {
|
||||||
/// Sets the window mode to windowed.
|
/// Sets the window mode to windowed.
|
||||||
#[cfg(not(feature = "wayland"))]
|
#[cfg(not(feature = "wayland"))]
|
||||||
pub fn set_windowed<M>() -> Command<M> {
|
pub fn set_windowed<M>() -> Command<M> {
|
||||||
iced::Command::single(Action::Window(WindowAction::ChangeMode(Mode::Windowed)))
|
iced_runtime::window::change_mode(Mode::Windowed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Toggles the windows' maximization state.
|
/// Toggles the windows' maximization state.
|
||||||
|
|
@ -106,7 +104,7 @@ pub fn toggle_fullscreen<M>() -> Command<M> {
|
||||||
/// Toggles the windows' maximization state.
|
/// Toggles the windows' maximization state.
|
||||||
#[cfg(not(feature = "wayland"))]
|
#[cfg(not(feature = "wayland"))]
|
||||||
pub fn toggle_fullscreen<M>() -> Command<M> {
|
pub fn toggle_fullscreen<M>() -> Command<M> {
|
||||||
iced::Command::single(Action::Window(WindowAction::ToggleMaximize))
|
iced_runtime::window::toggle_maximize()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a command to apply an action to a window.
|
/// Creates a command to apply an action to a window.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue