Skip to content

Commit

Permalink
[vent-window] add resizable toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Jul 4, 2024
1 parent 1be5dad commit a1e97ca
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 2 additions & 0 deletions crates/vent-window/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub struct WindowAttribs {
mode: WindowMode,
min_size: Option<(u32, u32)>,
max_size: Option<(u32, u32)>,
resizable: bool,
}

impl WindowAttribs {
Expand All @@ -66,6 +67,7 @@ impl Default for WindowAttribs {
mode: WindowMode::Default,
max_size: None,
min_size: None,
resizable: false,
}
}
}
Expand Down
11 changes: 9 additions & 2 deletions crates/vent-window/src/platform/wayland/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ impl WaylandWindow {
let window = &self.window;
let attribs = &self.attribs;
window.set_title(attribs.title.clone());
// TODO WindowMode
match attribs.mode {
crate::WindowMode::Default => {}
crate::WindowMode::FullScreen => window.set_fullscreen(None),
crate::WindowMode::Maximized => window.set_maximized(),
crate::WindowMode::Minimized => window.set_minimized(),
}
window.set_app_id(attribs.app_id.clone());
window.set_max_size(attribs.max_size);
window.set_min_size(attribs.min_size);
Expand Down Expand Up @@ -145,7 +150,9 @@ impl WaylandWindow {
ResizeEdge::BottomRight => XdgResizeEdge::BottomRight,
_ => return,
};
self.window.resize(seat, serial, edge);
if self.attribs.resizable {
self.window.resize(seat, serial, edge);
}
}
FrameAction::Move => self.window.move_(seat, serial),
_ => (),
Expand Down
9 changes: 0 additions & 9 deletions test/runtime-sandbox/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
use vent_common::project::VentApplicationProject;
use vent_runtime::VentApplication;

fn main() {
let project = VentApplicationProject {
name: env!("CARGO_PKG_NAME").to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
};

project
.deserialize(env!("CARGO_MANIFEST_DIR"))
.expect("Failed to write Vent Project");
VentApplication::default();
}

0 comments on commit a1e97ca

Please sign in to comment.