This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 4540ef1616bab69a59098b040f5cbe302e2eaeea
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Sun Apr 20 16:45:28 2025 +0200

    imlib2_view: Scale image when resizing window
    
    And let 'R' reset scaling.
---
 src/bin/imlib2_view.c | 14 +++++++++++++-
 src/bin/prog_x11.c    |  2 +-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c
index 60df3f8..5bdc07e 100644
--- a/src/bin/imlib2_view.c
+++ b/src/bin/imlib2_view.c
@@ -806,7 +806,7 @@ main(int argc, char **argv)
             case KeyPress:
                 while (XCheckTypedWindowEvent(disp, win, KeyPress, &ev))
                     ;
-                key = XLookupKeysym(&ev.xkey, 0);
+                key = XLookupKeysym(&ev.xkey, ev.xkey.state);
                 switch (key)
                 {
                 default:
@@ -819,6 +819,10 @@ main(int argc, char **argv)
                     goto quit;
                 case XK_r:
                     goto show_cur;
+                case XK_R:
+                    opt_scale = true;
+                    opt_sc_out_x = opt_sc_out_y = 1.;
+                    goto show_cur;
                 case XK_Right:
                     goto show_next;
                 case XK_Left:
@@ -923,6 +927,14 @@ main(int argc, char **argv)
                     image_width = 0;    /* Reset window size */
                 load_image_frame(argv[no], finfo.frame_num, inc);
                 break;
+            case ConfigureNotify:
+                if (ev.xconfigure.width == window_width &&
+                    ev.xconfigure.height == window_height)
+                    break;
+                opt_scale = true;
+                opt_sc_out_x = (double)ev.xconfigure.width / image_width;
+                opt_sc_out_y = (double)ev.xconfigure.height / image_height;
+                goto show_cur;
             }
         }
         while (XPending(disp));
diff --git a/src/bin/prog_x11.c b/src/bin/prog_x11.c
index c497ed4..f8f43cb 100644
--- a/src/bin/prog_x11.c
+++ b/src/bin/prog_x11.c
@@ -44,7 +44,7 @@ prog_x11_create_window(const char *name, int w, int h)
 
     XSelectInput(disp, win, KeyPressMask |
                  ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
-                 PointerMotionMask | ExposureMask);
+                 PointerMotionMask | ExposureMask | StructureNotifyMask);
 
     XStoreName(disp, win, name);
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to