Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
{"conversion-timeout" , 1, 0, 245},
{"version-sort" , 0, 0, 246},
{"offset" , 1, 0, 247},
{"center-window-on-resize", 0, 0, 249},
{0, 0, 0, 0}
};
int optch = 0, cmdx = 0;
Expand Down Expand Up @@ -795,6 +796,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
opt.offset_flags = XParseGeometry(optarg, &opt.offset_x,
&opt.offset_y, (unsigned int *)&discard, (unsigned int *)&discard);
break;
case 249:
opt.center_window_on_resize = 1;
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ struct __fehoptions {
double reload;
int sort;
int version_sort;
int center_window_on_resize;
int debug;
int geom_enabled;
int geom_flags;
Expand Down
4 changes: 4 additions & 0 deletions src/winwidget.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,10 @@ void winwidget_resize(winwidget winwid, int w, int h, int force_resize)
winwid->x = tc_x;
winwid->y = tc_y;
XMoveResizeWindow(disp, winwid->win, tc_x, tc_y, winwid->w, winwid->h);
} else if (opt.center_window_on_resize) {
winwid->x = (scr_width - winwid->w) / 2;
winwid->y = (scr_height - winwid->h) / 2;
XMoveResizeWindow(disp, winwid->win, winwid->x, winwid->y, winwid->w, winwid->h);
} else
XResizeWindow(disp, winwid->win, winwid->w, winwid->h);

Expand Down