code: Reformat with new rules
This commit is contained in:
parent
4b510412e1
commit
b56d650086
14 changed files with 68 additions and 45 deletions
3
.rustfmt.toml
Normal file
3
.rustfmt.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
format_code_in_doc_comments = true
|
||||||
|
imports_granularity = "Module"
|
||||||
|
wrap_comments = true
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) 2020-2023 Christopher Davis
|
// Copyright (c) 2020-2023 Christopher Davis
|
||||||
// Copyright (c) 2022-2023 Sophie Herold
|
// Copyright (c) 2022-2023 Sophie Herold
|
||||||
// Copyright (c) 2022-2023 Sabri Ünal
|
// Copyright (c) 2022-2023 Sabri Ünal
|
||||||
|
// Copyright (c) 2023 Julian Hofer
|
||||||
// Copyright (c) 2023 Huan Nguyen
|
// Copyright (c) 2023 Huan Nguyen
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright (c) 2023 Sophie Herold
|
// Copyright (c) 2023 Sophie Herold
|
||||||
|
// Copyright (c) 2023 Julian Hofer
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,7 @@ use crate::deps::*;
|
||||||
use arc_swap::ArcSwap;
|
use arc_swap::ArcSwap;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::{BTreeMap, VecDeque};
|
||||||
use std::collections::VecDeque;
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
|
@ -335,8 +334,8 @@ impl TiledImage {
|
||||||
|
|
||||||
/// Viewport within zoom coordinates
|
/// Viewport within zoom coordinates
|
||||||
///
|
///
|
||||||
/// preserve_area: Slightly larger than the viewport, area for which we want tiles
|
/// preserve_area: Slightly larger than the viewport, area for which we want
|
||||||
/// TODO: This is the most buggy function ever
|
/// tiles TODO: This is the most buggy function ever
|
||||||
pub fn cleanup(&mut self, zoom: f64, preserve_area: graphene::Rect) {
|
pub fn cleanup(&mut self, zoom: f64, preserve_area: graphene::Rect) {
|
||||||
let zoom = zoom_normalize(zoom);
|
let zoom = zoom_normalize(zoom);
|
||||||
let mut kept_tiles = Self::default();
|
let mut kept_tiles = Self::default();
|
||||||
|
|
@ -584,7 +583,8 @@ pub trait FrameBufferExt {
|
||||||
fn push_frame(&self, tile: Tile, dimensions: Coordinates, delay: Duration);
|
fn push_frame(&self, tile: Tile, dimensions: Coordinates, delay: Duration);
|
||||||
fn reset(&self);
|
fn reset(&self);
|
||||||
fn get_layer_tiling_or_default(&self, zoom: f64, viewport: graphene::Rect) -> Tiling;
|
fn get_layer_tiling_or_default(&self, zoom: f64, viewport: graphene::Rect) -> Tiling;
|
||||||
/// Return true if the next frame should be shown and removes the outdated frame
|
/// Return true if the next frame should be shown and removes the outdated
|
||||||
|
/// frame
|
||||||
fn frame_timeout(&self, elapsed: Duration) -> bool;
|
fn frame_timeout(&self, elapsed: Duration) -> bool;
|
||||||
/// Returns the number of currently buffered frames
|
/// Returns the number of currently buffered frames
|
||||||
fn n_frames(&self) -> usize;
|
fn n_frames(&self) -> usize;
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ mod imp {
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default)]
|
||||||
pub struct LpFileModel {
|
pub struct LpFileModel {
|
||||||
/// Use and IndexMap such that we can put the elements into an arbitrary order
|
/// Use and IndexMap such that we can put the elements into an arbitrary
|
||||||
/// while still having fast hash access via file URI.
|
/// order while still having fast hash access via file URI.
|
||||||
pub(super) files: RefCell<IndexMap<GString, gio::File>>,
|
pub(super) files: RefCell<IndexMap<GString, gio::File>>,
|
||||||
pub(super) directory: OnceCell<gio::File>,
|
pub(super) directory: OnceCell<gio::File>,
|
||||||
/// Track file changes.
|
/// Track file changes.
|
||||||
|
|
@ -150,7 +150,8 @@ impl LpFileModel {
|
||||||
let mut new_files = new_files?;
|
let mut new_files = new_files?;
|
||||||
|
|
||||||
{
|
{
|
||||||
// Here we use a nested scope so that the mutable borrow only lasts as long as we need it
|
// Here we use a nested scope so that the mutable borrow only lasts as long as
|
||||||
|
// we need it
|
||||||
|
|
||||||
let mut files = self.imp().files.borrow_mut();
|
let mut files = self.imp().files.borrow_mut();
|
||||||
for (uri, file) in files.iter() {
|
for (uri, file) in files.iter() {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,8 @@ Simplified widget arrangement including the most important widgets.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use gettextrs::*;
|
use gettextrs::*;
|
||||||
use gtk::gio::{self, prelude::*};
|
use gtk::gio::prelude::*;
|
||||||
|
use gtk::gio::{self};
|
||||||
|
|
||||||
mod about;
|
mod about;
|
||||||
mod application;
|
mod application;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@ use std::path::{Path, PathBuf};
|
||||||
pub fn datetime_fmt(datetime: &glib::DateTime) -> Option<String> {
|
pub fn datetime_fmt(datetime: &glib::DateTime) -> Option<String> {
|
||||||
// Translators: This is the date and time format we use in metadata output etc.
|
// Translators: This is the date and time format we use in metadata output etc.
|
||||||
// The format has to follow <https://docs.gtk.org/glib/method.DateTime.format.html>
|
// The format has to follow <https://docs.gtk.org/glib/method.DateTime.format.html>
|
||||||
// The default is already translated. Don't change if you are not sure what to use.
|
// The default is already translated. Don't change if you are not sure what to
|
||||||
|
// use.
|
||||||
let datetime_format = gettext("%x %X");
|
let datetime_format = gettext("%x %X");
|
||||||
|
|
||||||
let local_datetime = datetime.to_local();
|
let local_datetime = datetime.to_local();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) 2021-2023 Christopher Davis
|
// Copyright (c) 2021-2023 Christopher Davis
|
||||||
// Copyright (c) 2022-2023 Sophie Herold
|
// Copyright (c) 2022-2023 Sophie Herold
|
||||||
// Copyright (c) 2022 Maximiliano Sandoval R
|
// Copyright (c) 2022 Maximiliano Sandoval R
|
||||||
|
// Copyright (c) 2023 Julian Hofer
|
||||||
// Copyright (c) 2023 Lubosz Sarnecki
|
// Copyright (c) 2023 Lubosz Sarnecki
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
|
@ -36,7 +37,8 @@ use crate::decoder::{self, tiling, Decoder, DecoderUpdate};
|
||||||
use crate::image_metadata::LpImageMetadata;
|
use crate::image_metadata::LpImageMetadata;
|
||||||
use crate::util::Gesture;
|
use crate::util::Gesture;
|
||||||
|
|
||||||
use adw::{prelude::*, subclass::prelude::*};
|
use adw::prelude::*;
|
||||||
|
use adw::subclass::prelude::*;
|
||||||
use arc_swap::ArcSwap;
|
use arc_swap::ArcSwap;
|
||||||
use futures::prelude::*;
|
use futures::prelude::*;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
@ -49,8 +51,8 @@ use std::sync::Arc;
|
||||||
/// `#242424`
|
/// `#242424`
|
||||||
static BACKGROUND_COLOR_DEFAULT: Lazy<gdk::RGBA> =
|
static BACKGROUND_COLOR_DEFAULT: Lazy<gdk::RGBA> =
|
||||||
Lazy::new(|| gdk::RGBA::new(36. / 255., 36. / 255., 36. / 255., 1.));
|
Lazy::new(|| gdk::RGBA::new(36. / 255., 36. / 255., 36. / 255., 1.));
|
||||||
/// Background color if the default does not give enough contrast for transparent images
|
/// Background color if the default does not give enough contrast for
|
||||||
/// `#e8e7e6`
|
/// transparent images `#e8e7e6`
|
||||||
static BACKGROUND_COLOR_ALTERNATE: Lazy<gdk::RGBA> =
|
static BACKGROUND_COLOR_ALTERNATE: Lazy<gdk::RGBA> =
|
||||||
Lazy::new(|| gdk::RGBA::new(232. / 255., 231. / 255., 230. / 255., 1.));
|
Lazy::new(|| gdk::RGBA::new(232. / 255., 231. / 255., 230. / 255., 1.));
|
||||||
|
|
||||||
|
|
@ -61,7 +63,8 @@ static BACKGROUND_COLOR_ALTERNATE_LIGHT_MODE: Lazy<gdk::RGBA> =
|
||||||
|
|
||||||
/// Consider 3.5:1 contrast and worse to be bad contrast for a pixel
|
/// Consider 3.5:1 contrast and worse to be bad contrast for a pixel
|
||||||
static BACKGROUND_GUESS_LOW_CONTRAST_RATIO: f32 = 3.5;
|
static BACKGROUND_GUESS_LOW_CONTRAST_RATIO: f32 = 3.5;
|
||||||
/// Consider transparent images with more than 90% pixels bad contrast as bad contrast
|
/// Consider transparent images with more than 90% pixels bad contrast as bad
|
||||||
|
/// contrast
|
||||||
///
|
///
|
||||||
/// Bad contrast image will use the `BACKGROUND_COLOR_ALTERNATE`.
|
/// Bad contrast image will use the `BACKGROUND_COLOR_ALTERNATE`.
|
||||||
static BACKGROUND_GUESS_LOW_CONTRAST_TRHESHOLD: f64 = 0.90;
|
static BACKGROUND_GUESS_LOW_CONTRAST_TRHESHOLD: f64 = 0.90;
|
||||||
|
|
@ -145,7 +148,8 @@ mod imp {
|
||||||
#[property(get, set = Self::set_zoom, explicit_notify)]
|
#[property(get, set = Self::set_zoom, explicit_notify)]
|
||||||
pub(super) zoom: Cell<f64>,
|
pub(super) zoom: Cell<f64>,
|
||||||
pub(super) zoom_animation: OnceCell<adw::TimedAnimation>,
|
pub(super) zoom_animation: OnceCell<adw::TimedAnimation>,
|
||||||
/// Targeted zoom level, might differ from `zoom` when animation is running
|
/// Targeted zoom level, might differ from `zoom` when animation is
|
||||||
|
/// running
|
||||||
pub(super) zoom_target: Cell<f64>,
|
pub(super) zoom_target: Cell<f64>,
|
||||||
/// Current animation is transitioning from having horizontal scrollbars
|
/// Current animation is transitioning from having horizontal scrollbars
|
||||||
/// to not having them or vice versa.
|
/// to not having them or vice versa.
|
||||||
|
|
@ -730,10 +734,10 @@ mod imp {
|
||||||
let hidpi_scale = self.obj().scale_factor() as f64;
|
let hidpi_scale = self.obj().scale_factor() as f64;
|
||||||
|
|
||||||
let monitor_geometry = monitor.geometry();
|
let monitor_geometry = monitor.geometry();
|
||||||
// TODO: Per documentation those dimensions should not be physical pixels.
|
// TODO: Per documentation those dimensions should not be physical
|
||||||
// But on Wayland they are physical pixels and on X11 not.
|
// pixels. But on Wayland they are physical
|
||||||
// Taking the version that works on Wayland for now.
|
// pixels and on X11 not. Taking the version
|
||||||
// <https://gitlab.gnome.org/GNOME/gtk/-/issues/5391>
|
// that works on Wayland for now. <https://gitlab.gnome.org/GNOME/gtk/-/issues/5391>
|
||||||
let monitor_width = monitor_geometry.width() as f64 - 40.;
|
let monitor_width = monitor_geometry.width() as f64 - 40.;
|
||||||
let monitor_height = monitor_geometry.height() as f64 - 60.;
|
let monitor_height = monitor_geometry.height() as f64 - 60.;
|
||||||
|
|
||||||
|
|
@ -749,8 +753,8 @@ mod imp {
|
||||||
0.3
|
0.3
|
||||||
};
|
};
|
||||||
|
|
||||||
// factor for width and height that will achieve the desired area occupation
|
// factor for width and height that will achieve the desired area
|
||||||
// derived from:
|
// occupation derived from:
|
||||||
// monitor_area * occupy_area_factor ==
|
// monitor_area * occupy_area_factor ==
|
||||||
// (image_width * size_scale) * (image_height * size_scale)
|
// (image_width * size_scale) * (image_height * size_scale)
|
||||||
let size_scale =
|
let size_scale =
|
||||||
|
|
@ -1684,9 +1688,11 @@ impl LpImage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a background color that should give suitable contrast with transparent images
|
/// Returns a background color that should give suitable contrast with
|
||||||
|
/// transparent images
|
||||||
///
|
///
|
||||||
/// For non-transparent images this always returns `BACKGROUND_COLOR_DEFAULT`
|
/// For non-transparent images this always returns
|
||||||
|
/// `BACKGROUND_COLOR_DEFAULT`
|
||||||
pub async fn background_color_guess(&self) -> Option<gdk::RGBA> {
|
pub async fn background_color_guess(&self) -> Option<gdk::RGBA> {
|
||||||
// Shortcut for formats that don't support transparency
|
// Shortcut for formats that don't support transparency
|
||||||
if !self
|
if !self
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright (c) 2022-2023 Sophie Herold
|
// Copyright (c) 2022-2023 Sophie Herold
|
||||||
// Copyright (c) 2022 Christopher Davis
|
// Copyright (c) 2022 Christopher Davis
|
||||||
|
// Copyright (c) 2023 Julian Hofer
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -24,8 +25,7 @@ use crate::deps::*;
|
||||||
use crate::widgets::LpImage;
|
use crate::widgets::LpImage;
|
||||||
|
|
||||||
use adw::subclass::prelude::*;
|
use adw::subclass::prelude::*;
|
||||||
use glib::clone;
|
use glib::{clone, Properties};
|
||||||
use glib::Properties;
|
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use gtk::CompositeTemplate;
|
use gtk::CompositeTemplate;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
// Copyright (c) 2020-2023 Christopher Davis
|
// Copyright (c) 2020-2023 Christopher Davis
|
||||||
// Copyright (c) 2022-2023 Sophie Herold
|
// Copyright (c) 2022-2023 Sophie Herold
|
||||||
// Copyright (c) 2022 Elton A Rodrigues
|
|
||||||
// Copyright (c) 2022 Maximiliano Sandoval R
|
// Copyright (c) 2022 Maximiliano Sandoval R
|
||||||
|
// Copyright (c) 2023 Julian Hofer
|
||||||
|
// Copyright (c) 2023 Starccy
|
||||||
// Copyright (c) 2023 FineFindus
|
// Copyright (c) 2023 FineFindus
|
||||||
// Copyright (c) 2023 Huan Nguyen
|
// Copyright (c) 2023 Huan Nguyen
|
||||||
// Copyright (c) 2023 Philipp Kiemle
|
// Copyright (c) 2023 Philipp Kiemle
|
||||||
|
|
@ -39,15 +40,13 @@ use adw::prelude::*;
|
||||||
use adw::subclass::prelude::*;
|
use adw::subclass::prelude::*;
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use ashpd::desktop::{wallpaper, ResponseError};
|
use ashpd::desktop::{wallpaper, ResponseError};
|
||||||
use ashpd::Error;
|
use ashpd::{Error, WindowIdentifier};
|
||||||
use ashpd::WindowIdentifier;
|
|
||||||
use glib::clone;
|
|
||||||
use glib::translate::IntoGlib;
|
use glib::translate::IntoGlib;
|
||||||
use glib::Properties;
|
use glib::{clone, Properties};
|
||||||
use gtk::CompositeTemplate;
|
use gtk::CompositeTemplate;
|
||||||
|
|
||||||
use std::cell::{Cell, RefCell};
|
use std::cell::{Cell, OnceCell, RefCell};
|
||||||
use std::{cell::OnceCell, marker::PhantomData};
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
// The number of pages we want to buffer
|
// The number of pages we want to buffer
|
||||||
// on either side of the current page.
|
// on either side of the current page.
|
||||||
|
|
@ -208,7 +207,8 @@ mod imp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WidgetImpl for LpImageView {
|
impl WidgetImpl for LpImageView {
|
||||||
/// This manual implementation makes sure left an right overlay both fit into the window
|
/// This manual implementation makes sure left an right overlay both fit
|
||||||
|
/// into the window
|
||||||
fn measure(&self, orientation: gtk::Orientation, for_size: i32) -> (i32, i32, i32, i32) {
|
fn measure(&self, orientation: gtk::Orientation, for_size: i32) -> (i32, i32, i32, i32) {
|
||||||
// Measure child of AdwBin
|
// Measure child of AdwBin
|
||||||
let (child_min, child_natural, _, _) = self.bin_child.measure(orientation, for_size);
|
let (child_min, child_natural, _, _) = self.bin_child.measure(orientation, for_size);
|
||||||
|
|
@ -670,7 +670,8 @@ impl LpImageView {
|
||||||
"win.show-toast",
|
"win.show-toast",
|
||||||
Some(
|
Some(
|
||||||
&(
|
&(
|
||||||
// Translators: This is a toast notification, informing the user that an image has been set as background.
|
// Translators: This is a toast notification, informing the user that
|
||||||
|
// an image has been set as background.
|
||||||
gettext("Set as background."),
|
gettext("Set as background."),
|
||||||
adw::ToastPriority::High.into_glib(),
|
adw::ToastPriority::High.into_glib(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
// Copyright (c) 2023 Sophie Herold
|
// Copyright (c) 2023 Sophie Herold
|
||||||
|
// Copyright (c) 2023 Julian Hofer
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -63,8 +64,8 @@ enum Status {
|
||||||
|
|
||||||
/// Scope guard for non user ui changes
|
/// Scope guard for non user ui changes
|
||||||
///
|
///
|
||||||
/// Creates a context in which other signals know that changes are not user input.
|
/// Creates a context in which other signals know that changes are not user
|
||||||
/// This avoids things like loops between value change signals.
|
/// input. This avoids things like loops between value change signals.
|
||||||
#[derive(Default, Clone, Debug)]
|
#[derive(Default, Clone, Debug)]
|
||||||
struct UiUpdates {
|
struct UiUpdates {
|
||||||
disabled: Rc<Cell<bool>>,
|
disabled: Rc<Cell<bool>>,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// Copyright (c) 2022-2023 Sophie Herold
|
// Copyright (c) 2022-2023 Sophie Herold
|
||||||
// Copyright (c) 2022-2023 Christopher Davis
|
// Copyright (c) 2022-2023 Christopher Davis
|
||||||
|
// Copyright (c) 2023 Julian Hofer
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -297,7 +298,8 @@ impl LpPropertiesView {
|
||||||
fn folder_name(&self, file: Option<gio::File>) -> String {
|
fn folder_name(&self, file: Option<gio::File>) -> String {
|
||||||
file.and_then(|f| f.parent()) // If the file exists, get the parent
|
file.and_then(|f| f.parent()) // If the file exists, get the parent
|
||||||
.and_then(|p| util::get_file_display_name(&p)) // if that exists, the display name
|
.and_then(|p| util::get_file_display_name(&p)) // if that exists, the display name
|
||||||
.unwrap_or_else(|| FALLBACK.to_owned()) // and if we get nothing, use `FALLBACK`
|
.unwrap_or_else(|| FALLBACK.to_owned()) // and if we get nothing,
|
||||||
|
// use `FALLBACK`
|
||||||
}
|
}
|
||||||
|
|
||||||
#[template_callback]
|
#[template_callback]
|
||||||
|
|
|
||||||
|
|
@ -457,8 +457,8 @@ impl LpSlidingView {
|
||||||
|
|
||||||
/// Sets position shift to correct page insert or removal
|
/// Sets position shift to correct page insert or removal
|
||||||
///
|
///
|
||||||
/// Takes the old position of the current page and calculates and sets the shift
|
/// Takes the old position of the current page and calculates and sets the
|
||||||
/// to keep the current page optically at the same position.
|
/// shift to keep the current page optically at the same position.
|
||||||
fn shift_position(&self, old_index: Option<usize>) {
|
fn shift_position(&self, old_index: Option<usize>) {
|
||||||
if let (Some(old_index), Some(new_index)) = (old_index, self.current_index()) {
|
if let (Some(old_index), Some(new_index)) = (old_index, self.current_index()) {
|
||||||
let shift = new_index as f64 - old_index as f64;
|
let shift = new_index as f64 - old_index as f64;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// Copyright (c) 2022-2023 Sophie Herold
|
// Copyright (c) 2022-2023 Sophie Herold
|
||||||
// Copyright (c) 2022 Elton A Rodrigues
|
// Copyright (c) 2022 Elton A Rodrigues
|
||||||
// Copyright (c) 2022 Maximiliano Sandoval R
|
// Copyright (c) 2022 Maximiliano Sandoval R
|
||||||
|
// Copyright (c) 2023 Julian Hofer
|
||||||
// Copyright (c) 2023 FineFindus
|
// Copyright (c) 2023 FineFindus
|
||||||
// Copyright (c) 2023 qwel
|
// Copyright (c) 2023 qwel
|
||||||
// Copyright (c) 2023 Huan Thieu Nguyen
|
// Copyright (c) 2023 Huan Thieu Nguyen
|
||||||
|
|
@ -819,7 +820,8 @@ impl LpWindow {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Queue a fade animation to play after `HIDE_CONTROLS_IDLE_TIMEOUT` of inactivity
|
/// Queue a fade animation to play after `HIDE_CONTROLS_IDLE_TIMEOUT` of
|
||||||
|
/// inactivity
|
||||||
fn queue_hide_controls(&self) {
|
fn queue_hide_controls(&self) {
|
||||||
self.dequeue_hide_controls();
|
self.dequeue_hide_controls();
|
||||||
|
|
||||||
|
|
@ -895,7 +897,9 @@ impl LpWindow {
|
||||||
.image_view
|
.image_view
|
||||||
.current_file()
|
.current_file()
|
||||||
.and_then(|f| util::get_file_display_name(&f)) // If the file exists, get display name
|
.and_then(|f| util::get_file_display_name(&f)) // If the file exists, get display name
|
||||||
.unwrap_or_else(|| gettext("Image Viewer")) // Return that or the default if there's nothing
|
.unwrap_or_else(|| gettext("Image Viewer")) // Return that or
|
||||||
|
// the default if
|
||||||
|
// there's nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -912,9 +916,9 @@ impl LpWindow {
|
||||||
fn on_motion(&self, pointer_position: (f64, f64)) {
|
fn on_motion(&self, pointer_position: (f64, f64)) {
|
||||||
let imp = self.imp();
|
let imp = self.imp();
|
||||||
|
|
||||||
// Check if position really changed since swipe gesture sends change event with same position.
|
// Check if position really changed since swipe gesture sends change event with
|
||||||
// Also, don't connect this to "leave" because swipe also sends fake "leave" events when
|
// same position. Also, don't connect this to "leave" because swipe also
|
||||||
// the widget under the cursor changes.
|
// sends fake "leave" events when the widget under the cursor changes.
|
||||||
if imp.pointer_position.get() == pointer_position {
|
if imp.pointer_position.get() == pointer_position {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -929,7 +933,8 @@ impl LpWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Only hide controls if cursor not over controls and there is an image shown
|
/// Only hide controls if cursor not over controls and there is an image
|
||||||
|
/// shown
|
||||||
fn can_hide_controls(&self) -> bool {
|
fn can_hide_controls(&self) -> bool {
|
||||||
!self
|
!self
|
||||||
.image_view()
|
.image_view()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue