image_view: Make space for always on scrollbars
Increase the margin of the overlay if scrollbars are set to always visible. Fixes #528
This commit is contained in:
parent
89b4e7a082
commit
f2dbee5ef8
6 changed files with 34 additions and 19 deletions
|
|
@ -290,7 +290,6 @@ mod imp {
|
|||
} else {
|
||||
LpOrientation::Landscape
|
||||
};
|
||||
dbg!("setting to", orientation);
|
||||
let res = self
|
||||
.obj()
|
||||
.activate_action("edit-crop.orientation", Some(&orientation.to_variant()));
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
//!
|
||||
//! This widget also handles showing the context menu.
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use adw::subclass::prelude::*;
|
||||
use glib::{Properties, clone};
|
||||
use gtk::CompositeTemplate;
|
||||
|
|
@ -33,8 +35,6 @@ use crate::util::gettext::*;
|
|||
use crate::widgets::LpImage;
|
||||
|
||||
mod imp {
|
||||
use std::time::Duration;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Default, CompositeTemplate, Properties)]
|
||||
|
|
@ -85,15 +85,8 @@ mod imp {
|
|||
}
|
||||
}
|
||||
|
||||
#[glib::derived_properties]
|
||||
impl ObjectImpl for LpImagePage {
|
||||
fn properties() -> &'static [glib::ParamSpec] {
|
||||
Self::derived_properties()
|
||||
}
|
||||
|
||||
fn property(&self, id: usize, pspec: &glib::ParamSpec) -> glib::Value {
|
||||
self.derived_property(id, pspec)
|
||||
}
|
||||
|
||||
fn constructed(&self) {
|
||||
let obj = self.obj();
|
||||
|
||||
|
|
|
|||
|
|
@ -329,6 +329,15 @@ mod imp {
|
|||
}
|
||||
));
|
||||
|
||||
// Adjust overlays margins to always visible scrollbars
|
||||
obj.update_scrollbar_styles();
|
||||
obj.settings()
|
||||
.connect_gtk_overlay_scrolling_notify(glib::clone!(
|
||||
#[weak]
|
||||
obj,
|
||||
move |_| obj.update_scrollbar_styles()
|
||||
));
|
||||
|
||||
obj.add_controller(self.drag_source.clone());
|
||||
}
|
||||
}
|
||||
|
|
@ -912,4 +921,12 @@ impl LpImageView {
|
|||
|
||||
value.parse::<f64>().ok().map(|x| x / 100.)
|
||||
}
|
||||
|
||||
fn update_scrollbar_styles(&self) {
|
||||
if self.settings().is_gtk_overlay_scrolling() {
|
||||
self.remove_css_class("always-show-scrollbars");
|
||||
} else {
|
||||
self.add_css_class("always-show-scrollbars");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,10 +14,6 @@
|
|||
<object class="GtkBox" id="controls_box_start">
|
||||
<property name="valign">end</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="margin-start">18</property>
|
||||
<property name="margin-end">18</property>
|
||||
<property name="margin-top">18</property>
|
||||
<property name="margin-bottom">18</property>
|
||||
<property name="spacing">6</property>
|
||||
<style>
|
||||
<class name="osd-box" />
|
||||
|
|
@ -52,10 +48,6 @@
|
|||
<object class="GtkBox" id="controls_box_end">
|
||||
<property name="valign">end</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="margin-start">18</property>
|
||||
<property name="margin-end">18</property>
|
||||
<property name="margin-top">18</property>
|
||||
<property name="margin-bottom">18</property>
|
||||
<style>
|
||||
<class name="osd-box" />
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue