diff --git a/README.md b/README.md index 14b0d31..90f464e 100644 --- a/README.md +++ b/README.md @@ -169,7 +169,7 @@ zoom-factor = 1.1 text-move-length = 50.0 # experimental feature (0.20.1): Scale factor on the input image when it was taken (e.g. DPI scale on the monitor it was recorded from). # This may be more useful to set via the command line. -# Note, this is ignored with explicit resize. +# Note, before NEXTRELEASE this is ignored with explicit resize. input-scale = 2.0 # experimental feature (NEXTRELEASE): set window title title = "Satty" @@ -308,11 +308,11 @@ Options: --text-move-length Experimental feature (0.20.1): The length to move the text when using the arrow keys. defaults to 50.0 --input-scale - Experimental feature (0.20.1): Scale the default window size to fit different displays. Note that this is ignored with explicit resize + Experimental feature (0.20.1): Scale the default window size to fit different displays. Note that before NEXTRELEASE this is ignored with explicit resize --title Experimental feature (NEXTRELEASE): Set window title --app-id <APP_ID> - Experimental feature (NEXTRELEASE): Set toplevel app_id. Note that this applies gtk format expectations + Experimental feature (NEXTRELEASE): Set toplevel app_id. Note that this has to match D-Bus well known name format, otherwise GTK does not accept it --right-click-copy Right click to copy. Preferably use the `action_on_right_click` option instead --action-on-enter <ACTION_ON_ENTER> diff --git a/cli/src/command_line.rs b/cli/src/command_line.rs index af4aaaf..f889603 100644 --- a/cli/src/command_line.rs +++ b/cli/src/command_line.rs @@ -151,7 +151,7 @@ pub struct CommandLine { #[arg(long)] pub text_move_length: Option<f32>, - /// Experimental feature (0.20.1): Scale the default window size to fit different displays. Note that this is ignored with explicit resize. + /// Experimental feature (0.20.1): Scale the default window size to fit different displays. Note that before NEXTRELEASE this is ignored with explicit resize. #[arg(long)] pub input_scale: Option<f32>, diff --git a/src/configuration.rs b/src/configuration.rs index 9948762..f1fccf2 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -68,7 +68,7 @@ pub struct Configuration { zoom_factor: f32, pan_step_size: f32, text_move_length: f32, - input_scale: f32, + input_scale: Option<f32>, title: Option<String>, app_id: Option<String>, } @@ -352,7 +352,7 @@ impl Configuration { self.text_move_length = v; } if let Some(v) = general.input_scale { - self.input_scale = v; + self.input_scale = Some(v); } if let Some(v) = general.title { self.title = Some(v); @@ -488,7 +488,7 @@ impl Configuration { self.text_move_length = v; } if let Some(v) = command_line.input_scale { - self.input_scale = v; + self.input_scale = Some(v); } if let Some(v) = command_line.title { self.title = Some(v); @@ -643,7 +643,7 @@ impl Configuration { self.text_move_length } - pub fn input_scale(&self) -> f32 { + pub fn input_scale(&self) -> Option<f32> { self.input_scale } @@ -691,7 +691,7 @@ impl Default for Configuration { zoom_factor: 1.1, pan_step_size: 50., text_move_length: 50.0, - input_scale: 1.0, + input_scale: None, title: None, app_id: None, } diff --git a/src/femtovg_area/imp.rs b/src/femtovg_area/imp.rs index f33fa1f..cfcdddb 100644 --- a/src/femtovg_area/imp.rs +++ b/src/femtovg_area/imp.rs @@ -162,6 +162,7 @@ impl FemtoVGArea { active_tool: Rc<RefCell<dyn Tool>>, background_image: Pixbuf, ) { + let initial_scale = APP_CONFIG.read().input_scale().unwrap_or(0.0); self.inner().replace(FemtoVgAreaMut { background_image, background_image_id: None, @@ -172,11 +173,11 @@ impl FemtoVGArea { offset: Vec2D::zero(), drawables: Vec::new(), redo_stack: Vec::new(), - zoom_scale: 0.0, + zoom_scale: initial_scale, pointer_offset: Vec2D::zero(), last_offset: Vec2D::zero(), drag_offset: Vec2D::zero(), - last_scale: 0.0, + last_scale: initial_scale, is_drag: false, is_reset: false, }); diff --git a/src/main.rs b/src/main.rs index 114c599..cedd464 100644 --- a/src/main.rs +++ b/src/main.rs @@ -90,10 +90,11 @@ impl App { } fn resize_window_initial(&self, root: &Window, sender: ComponentSender<Self>) { - let scale = APP_CONFIG.read().input_scale(); - let fullscreen = APP_CONFIG.read().fullscreen(); - let resize = APP_CONFIG.read().resize(); - let floating_hack = APP_CONFIG.read().floating_hack(); + let config = APP_CONFIG.read(); + let scale = config.input_scale().unwrap_or(1.0); + let fullscreen = config.fullscreen(); + let resize = config.resize(); + let floating_hack = config.floating_hack(); let image_width = (self.image_dimensions.0 as f32 / scale) as f64; let image_height = (self.image_dimensions.1 as f32 / scale) as f64;