fix(app): conditionally set context drawer padding
This fixes the cosmic-term terminal_box becoming cropped when opening a context drawer.
This commit is contained in:
parent
6dfd9d7dd5
commit
3c5a2d9340
2 changed files with 31 additions and 34 deletions
|
|
@ -792,11 +792,18 @@ impl<App: Application> ApplicationExt for App {
|
||||||
// TODO: More granularity might be needed for different resize border
|
// TODO: More granularity might be needed for different resize border
|
||||||
// and window border handling of maximized and tiled windows
|
// and window border handling of maximized and tiled windows
|
||||||
let sharp_corners = core.window.sharp_corners;
|
let sharp_corners = core.window.sharp_corners;
|
||||||
|
let content_container = core.window.content_container;
|
||||||
|
let nav_bar_active = core.nav_bar_active();
|
||||||
let focused = core
|
let focused = core
|
||||||
.focused_window()
|
.focused_window()
|
||||||
.is_some_and(|i| Some(i) == self.core().main_window_id());
|
.is_some_and(|i| Some(i) == self.core().main_window_id());
|
||||||
let main_content_padding = if core.window.content_container {
|
|
||||||
[0, 8, 8, 8]
|
let main_content_padding = if content_container {
|
||||||
|
if nav_bar_active {
|
||||||
|
[0, 8, 8, 0]
|
||||||
|
} else {
|
||||||
|
[0, 8, 8, 8]
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
[0, 0, 0, 0]
|
[0, 0, 0, 0]
|
||||||
};
|
};
|
||||||
|
|
@ -837,7 +844,11 @@ impl<App: Application> ApplicationExt for App {
|
||||||
))
|
))
|
||||||
})
|
})
|
||||||
.apply(container)
|
.apply(container)
|
||||||
.padding([0, 8, 8, 0])
|
.padding(if content_container {
|
||||||
|
[0, 8, 8, 0]
|
||||||
|
} else {
|
||||||
|
[0, 0, 0, 0]
|
||||||
|
})
|
||||||
.into(),
|
.into(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -867,7 +878,11 @@ impl<App: Application> ApplicationExt for App {
|
||||||
))
|
))
|
||||||
})
|
})
|
||||||
.apply(container)
|
.apply(container)
|
||||||
.padding([0, 8, 8, 0])
|
.padding(if content_container {
|
||||||
|
[0, 8, 8, 0]
|
||||||
|
} else {
|
||||||
|
[0, 0, 0, 0]
|
||||||
|
})
|
||||||
.into(),
|
.into(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -880,8 +895,6 @@ impl<App: Application> ApplicationExt for App {
|
||||||
widgets
|
widgets
|
||||||
});
|
});
|
||||||
let content_col = crate::widget::column::with_capacity(2)
|
let content_col = crate::widget::column::with_capacity(2)
|
||||||
//TODO: Add back when the `resize_border` is moved to not cover window content
|
|
||||||
//.spacing(8)
|
|
||||||
.push(content_row)
|
.push(content_row)
|
||||||
.push_maybe(
|
.push_maybe(
|
||||||
self.footer()
|
self.footer()
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@ use iced_core::event::{self, Event};
|
||||||
use iced_core::widget::{Operation, Tree};
|
use iced_core::widget::{Operation, Tree};
|
||||||
use iced_core::Alignment;
|
use iced_core::Alignment;
|
||||||
use iced_core::{
|
use iced_core::{
|
||||||
layout, mouse, overlay as iced_overlay, renderer, Clipboard, Layout, Length, Padding,
|
layout, mouse, overlay as iced_overlay, renderer, Clipboard, Layout, Length, Rectangle, Shell,
|
||||||
Rectangle, Shell, Vector, Widget,
|
Vector, Widget,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
|
|
@ -34,46 +34,30 @@ impl<'a, Message: Clone + 'static> ContextDrawer<'a, Message> {
|
||||||
where
|
where
|
||||||
Drawer: Into<Element<'a, Message>>,
|
Drawer: Into<Element<'a, Message>>,
|
||||||
{
|
{
|
||||||
|
let cosmic_theme::Spacing {
|
||||||
|
space_m, space_l, ..
|
||||||
|
} = crate::theme::active().cosmic().spacing;
|
||||||
|
|
||||||
let header = row::with_capacity(3)
|
let header = row::with_capacity(3)
|
||||||
.padding(Padding {
|
.padding([space_m, space_l])
|
||||||
top: 0.0,
|
|
||||||
bottom: 0.0,
|
|
||||||
left: 32.0,
|
|
||||||
right: 32.0,
|
|
||||||
})
|
|
||||||
.push(Space::new(Length::FillPortion(1), Length::Fixed(0.0)))
|
.push(Space::new(Length::FillPortion(1), Length::Fixed(0.0)))
|
||||||
.push(
|
.push(text::heading(header).width(Length::FillPortion(1)).center())
|
||||||
text::heading(header)
|
|
||||||
.width(Length::FillPortion(1))
|
|
||||||
.height(Length::Fill)
|
|
||||||
.align_x(Alignment::Center)
|
|
||||||
.align_y(Alignment::Center),
|
|
||||||
)
|
|
||||||
.push(
|
.push(
|
||||||
button::text("Close")
|
button::text("Close")
|
||||||
.trailing_icon(icon::from_name("go-next-symbolic"))
|
.trailing_icon(icon::from_name("go-next-symbolic"))
|
||||||
.on_press(on_close)
|
.on_press(on_close)
|
||||||
.apply(container)
|
.apply(container)
|
||||||
.width(Length::FillPortion(1))
|
.width(Length::FillPortion(1))
|
||||||
.align_x(Alignment::End)
|
.align_x(Alignment::End),
|
||||||
.center_y(Length::Fill),
|
|
||||||
)
|
)
|
||||||
// XXX must be done after pushing elements or it may be overwritten by size hints from contents
|
// XXX must be done after pushing elements or it may be overwritten by size hints from contents
|
||||||
.height(Length::Fixed(80.0))
|
|
||||||
.width(Length::Fixed(480.0));
|
.width(Length::Fixed(480.0));
|
||||||
|
|
||||||
let pane = column::with_capacity(2)
|
let pane = column::with_capacity(2).push(header).push(
|
||||||
.push(header.height(Length::Fixed(80.)))
|
scrollable(container(drawer.into()).padding([0, space_l, space_l, space_l]))
|
||||||
.push(
|
|
||||||
scrollable(container(drawer.into()).padding(Padding {
|
|
||||||
top: 0.0,
|
|
||||||
left: 32.0,
|
|
||||||
right: 32.0,
|
|
||||||
bottom: 32.0,
|
|
||||||
}))
|
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.width(Length::Shrink),
|
.width(Length::Shrink),
|
||||||
);
|
);
|
||||||
|
|
||||||
// XXX new limits do not exactly handle the max width well for containers
|
// XXX new limits do not exactly handle the max width well for containers
|
||||||
// XXX this is a hack to get around that
|
// XXX this is a hack to get around that
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue