diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2015-11-09 23:56:07 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2015-11-09 23:56:07 +0000 |
commit | 60e9d6f61aa9e12cbbbde8e1d9de3b9455aa1e44 (patch) | |
tree | a2ae656e701307c39fdf31ce11eabc940382e90c | |
parent | cedaf52814022806b37500ec9a19a487a4f0d33a (diff) | |
download | imv-60e9d6f61aa9e12cbbbde8e1d9de3b9455aa1e44.tar.gz |
Add an option for auto-centering images
-rw-r--r-- | main.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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) { |