window: fix sidebar snap-collapse when dragged narrow
Remove shrink-start-child: false so the paned divider can actually be dragged below the sidebar's natural minimum width. Defer the snap-close via idle_add_local_once so widget visibility is not changed mid-drag.
This commit is contained in:
parent
6d6d928733
commit
d75c63a8ce
2 changed files with 8 additions and 3 deletions
|
|
@ -9,7 +9,6 @@ template $FeedTheMonkeyWindow : Adw.ApplicationWindow {
|
|||
Adw.ToastOverlay toast_overlay {
|
||||
Paned paned {
|
||||
focusable: false;
|
||||
shrink-start-child: false;
|
||||
resize-start-child: false;
|
||||
|
||||
start-child: Adw.ToolbarView sidebar_toolbar {
|
||||
|
|
|
|||
|
|
@ -176,8 +176,14 @@ pub mod imp {
|
|||
let imp = win.imp();
|
||||
if !imp.sidebar_toolbar.is_visible() { return; }
|
||||
let pos = paned.position();
|
||||
if pos < 120 {
|
||||
imp.set_sidebar_visible(false);
|
||||
if pos < 150 {
|
||||
// Defer so we don't change widget visibility mid-drag.
|
||||
let win_weak2 = win_weak.clone();
|
||||
glib::idle_add_local_once(move || {
|
||||
if let Some(win) = win_weak2.upgrade() {
|
||||
win.imp().set_sidebar_visible(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
s2.set_int("sidebar-width", pos).ok();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue