From 60e9d6f61aa9e12cbbbde8e1d9de3b9455aa1e44 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Mon, 9 Nov 2015 23:56:07 +0000 Subject: Add an option for auto-centering images --- main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 2b73f8c..ddb6b4f 100644 --- a/main.c +++ b/main.c @@ -35,7 +35,8 @@ struct { int autoscale; int fullscreen; int stdin; -} g_options = {0,0,0}; + int center; +} g_options = {0,0,0,0}; struct { double scale; @@ -423,6 +424,7 @@ void print_usage(const char* name) " -i: Read paths from stdin. One path per line.\n" " -f: Start in fullscreen mode\n" " -s: Auto scale images to fit window\n" + " -c: Center images in the window\n" " -h: Print this help\n" "\n" "Mouse:\n" @@ -454,6 +456,7 @@ void parse_arg(const char* name, const char* arg) switch(*o) { case 'f': g_options.fullscreen = 1; break; case 's': g_options.autoscale = 1; break; + case 'c': g_options.center = 1; break; case 'i': g_options.stdin = 1; break; case 'h': print_usage(name); exit(0); break; default: @@ -594,6 +597,9 @@ int main(int argc, char** argv) if(g_options.autoscale) { scale_to_window(); } + if(g_options.center) { + center_view(); + } } if(g_img.playing) { -- cgit v1.2.3