Skip to content

Commit

Permalink
Revert "Add option to disable scaling on window resize"
Browse files Browse the repository at this point in the history
Reverts commit b0426a3.

Relates to #188.

Signed-off-by: Artem Senichev <[email protected]>
  • Loading branch information
artemsen committed Sep 29, 2024
1 parent 3dba5be commit 40e03a4
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 13 deletions.
2 changes: 0 additions & 2 deletions extra/swayimgrc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ transparency = grid
scale = optimal
# Fix position of the image on the window surface (yes/no)
fixed = yes
# Reset position and scale on window resize
resize_reset = yes
# Anti-aliasing (yes/no)
antialiasing = no
# Run slideshow at startup (yes/no)
Expand Down
3 changes: 0 additions & 3 deletions extra/swayimgrc.5
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ Default image scale, valid modes are:
.IP "\fBfixed\fR = \fI[yes|no]\fR"
Fix position of the image on the window surface, \fIyes\fR by default.
.\" ----------------------------------------------------------------------------
.IP "\fBresize_reset\fR = \fI[yes|no]\fR"
Reset position and scale on window resize, \fIyes\fR by default.
.\" ----------------------------------------------------------------------------
.IP "\fBantialiasing\fR = \fI[yes|no]\fR"
Enable or disable antialising (better quality, but slow rendering), \fIno\fR by default.
.\" ----------------------------------------------------------------------------
Expand Down
8 changes: 1 addition & 7 deletions src/viewer.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#define CFG_TRANSPARENCY_DEF GRID_NAME
#define CFG_SCALE_DEF "optimal"
#define CFG_FIXED_DEF true
#define CFG_RESETRSZ_DEF true
#define CFG_ANTIALIASING_DEF false
#define CFG_SLIDESHOW_DEF false
#define CFG_SLIDESHOW_TIME_DEF 3
Expand Down Expand Up @@ -71,7 +70,6 @@ struct viewer {
argb_t window_bkg; ///< Window background mode/color
bool antialiasing; ///< Anti-aliasing mode on/off
bool fixed; ///< Fix image position
bool resize_reset; ///< Reset position and scale in window resize

enum fixed_scale scale_init; ///< Initial scale
float scale; ///< Current scale factor of the image
Expand Down Expand Up @@ -550,9 +548,7 @@ static void redraw(void)
static void on_resize(void)
{
fixup_position(false);
if (ctx.resize_reset || ctx.scale == 0) {
reset_state();
}
reset_state();
}

/**
Expand Down Expand Up @@ -666,8 +662,6 @@ void viewer_init(struct config* cfg, struct image* image)

ctx.fixed =
config_get_bool(cfg, VIEWER_SECTION, VIEWER_FIXED, CFG_FIXED_DEF);
ctx.resize_reset =
config_get_bool(cfg, VIEWER_SECTION, VIEWER_RESETRSZ, CFG_RESETRSZ_DEF);
ctx.antialiasing = config_get_bool(cfg, VIEWER_SECTION, VIEWER_ANTIALIASING,
CFG_ANTIALIASING_DEF);
ctx.window_bkg =
Expand Down
1 change: 0 additions & 1 deletion src/viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#define VIEWER_TRANSPARENCY "transparency"
#define VIEWER_SCALE "scale"
#define VIEWER_FIXED "fixed"
#define VIEWER_RESETRSZ "resize_reset"
#define VIEWER_ANTIALIASING "antialiasing"
#define VIEWER_SLIDESHOW "slideshow"
#define VIEWER_SLIDESHOW_TIME "slideshow_time"
Expand Down

0 comments on commit 40e03a4

Please sign in to comment.