aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHarry Jeffery <harry@exec64.co.uk>2015-11-11 16:45:33 +0000
committerHarry Jeffery <harry@exec64.co.uk>2015-11-11 16:45:33 +0000
commit08947b293b12069790d01d0b0db71f1ff6ff241d (patch)
tree144a10465bf4e4ca740c660232196686c46b9e1e /src
parent506dd25de52c5e26ce3160a16980d9f13bb523e1 (diff)
downloadimv-08947b293b12069790d01d0b0db71f1ff6ff241d.tar.gz
Add -a flag and update usage
Diffstat (limited to 'src')
-rw-r--r--src/main.c12
-rw-r--r--src/viewport.c2
2 files changed, 7 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index a956293..7cb146f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,8 +30,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
struct {
int fullscreen;
int stdin;
- int center;
int recursive;
+ int actual;
} g_options = {0,0,0,0};
void print_usage(const char* name)
@@ -43,7 +43,7 @@ void print_usage(const char* name)
" -i: Read paths from stdin. One path per line.\n"
" -r: Recursively search input paths.\n"
" -f: Start in fullscreen mode\n"
- " -c: Center images in the window\n"
+ " -a: Default to images' actual size\n"
" -h: Print this help\n"
"\n"
"Mouse:\n"
@@ -61,8 +61,8 @@ void print_usage(const char* name)
" 'k': Pan up\n"
" 'l': Pan right\n"
" 'r': Reset view\n"
+ " 'a': Show image actual size\n"
" 'c': Center view\n"
- " 's': Scale image to fit window\n"
" 'x': Close current image\n"
" 'f': Toggle fullscreen\n"
" ' ': Toggle gif playback\n"
@@ -75,9 +75,9 @@ void parse_arg(const char* name, const char* arg)
for(const char *o = arg; *o != 0; ++o) {
switch(*o) {
case 'f': g_options.fullscreen = 1; break;
- case 'c': g_options.center = 1; break;
case 'i': g_options.stdin = 1; break;
case 'r': g_options.recursive = 1; break;
+ case 'a': g_options.actual = 1; break;
case 'h': print_usage(name); exit(0); break;
default:
fprintf(stderr, "Unknown argument '%c'. Aborting.\n", *o);
@@ -241,8 +241,8 @@ int main(int argc, char** argv)
imv_viewport_set_title(&view, title);
imv_viewport_scale_to_window(&view, &img);
}
- if(g_options.center) {
- imv_viewport_center(&view, &img);
+ if(g_options.actual) {
+ imv_viewport_scale_to_actual(&view, &img);
}
}
diff --git a/src/viewport.c b/src/viewport.c
index d97d97b..bb2e92e 100644
--- a/src/viewport.c
+++ b/src/viewport.c
@@ -90,7 +90,7 @@ void imv_viewport_center(struct imv_viewport *view, const struct imv_image* img)
view->x = (ww - img->width * view->scale) / 2;
view->y = (wh - img->height * view->scale) / 2;
- view->locked = 0;
+ view->locked = 1;
view->redraw = 1;
}