mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
Support fullscreen for new windows
This commit is contained in:
@@ -230,6 +230,13 @@ impl XdgShellHandler for State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.niri.layout.set_fullscreen(&window, true);
|
self.niri.layout.set_fullscreen(&window, true);
|
||||||
|
} else if let Some(window) = self.niri.unmapped_windows.get(surface.wl_surface()) {
|
||||||
|
if let Some(ws) = self.niri.layout.active_workspace() {
|
||||||
|
window.toplevel().with_pending_state(|state| {
|
||||||
|
state.size = Some(ws.view_size());
|
||||||
|
state.states.set(xdg_toplevel::State::Fullscreen);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,6 +253,13 @@ impl XdgShellHandler for State {
|
|||||||
{
|
{
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
self.niri.layout.set_fullscreen(&window, false);
|
self.niri.layout.set_fullscreen(&window, false);
|
||||||
|
} else if let Some(window) = self.niri.unmapped_windows.get(surface.wl_surface()) {
|
||||||
|
if let Some(ws) = self.niri.layout.active_workspace() {
|
||||||
|
window.toplevel().with_pending_state(|state| {
|
||||||
|
state.size = Some(ws.new_window_size());
|
||||||
|
state.states.unset(xdg_toplevel::State::Fullscreen);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-2
@@ -330,6 +330,10 @@ impl<W: LayoutElement> Workspace<W> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn view_size(&self) -> Size<i32, Logical> {
|
||||||
|
self.view_size
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update_output_scale_transform(&mut self) {
|
pub fn update_output_scale_transform(&mut self) {
|
||||||
let Some(output) = self.output.as_ref() else {
|
let Some(output) = self.output.as_ref() else {
|
||||||
return;
|
return;
|
||||||
@@ -351,7 +355,7 @@ impl<W: LayoutElement> Workspace<W> {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn configure_new_window(&self, window: &Window) {
|
pub fn new_window_size(&self) -> Size<i32, Logical> {
|
||||||
let width = if let Some(width) = self.options.default_width {
|
let width = if let Some(width) = self.options.default_width {
|
||||||
let mut width = width.resolve(&self.options, self.working_area.size.w);
|
let mut width = width.resolve(&self.options, self.working_area.size.w);
|
||||||
if !self.options.border.off {
|
if !self.options.border.off {
|
||||||
@@ -367,8 +371,11 @@ impl<W: LayoutElement> Workspace<W> {
|
|||||||
height -= self.options.border.width as i32 * 2;
|
height -= self.options.border.width as i32 * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
let size = Size::from((width, max(height, 1)));
|
Size::from((width, max(height, 1)))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn configure_new_window(&self, window: &Window) {
|
||||||
|
let size = self.new_window_size();
|
||||||
let bounds = self.toplevel_bounds();
|
let bounds = self.toplevel_bounds();
|
||||||
|
|
||||||
if let Some(output) = self.output.as_ref() {
|
if let Some(output) = self.output.as_ref() {
|
||||||
@@ -1151,8 +1158,14 @@ impl<W: LayoutElement> Column<W> {
|
|||||||
options,
|
options,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let is_pending_fullscreen = window.is_pending_fullscreen();
|
||||||
|
|
||||||
rv.add_window(window);
|
rv.add_window(window);
|
||||||
|
|
||||||
|
if is_pending_fullscreen {
|
||||||
|
rv.set_fullscreen(true);
|
||||||
|
}
|
||||||
|
|
||||||
rv
|
rv
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user