Skip to content

Commit a145836

Browse files
committed
scale image zoom setting by display density
1 parent dfa1024 commit a145836

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
master
22

33
- do our own tile snapping if gtk has no snap mechanism
4+
- high-dpi support
45

56
## 4.1.0 26/07/25
67

src/imageui.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,18 @@ imageui_get_zoom(Imageui *imageui)
444444
return zoom;
445445
}
446446

447+
double
448+
imageui_get_pixel_size(Imageui *imageui)
449+
{
450+
double pixel_size;
451+
452+
g_object_get(imageui,
453+
"pixel-size", &pixel_size,
454+
NULL);
455+
456+
return pixel_size;
457+
}
458+
447459
static gboolean
448460
imageui_tick(GtkWidget *widget, GdkFrameClock *frame_clock, gpointer user_data)
449461
{
@@ -566,7 +578,7 @@ imageui_magout(Imageui *imageui)
566578
void
567579
imageui_oneone(Imageui *imageui)
568580
{
569-
imageui_zoom_to_eased(imageui, 1.0);
581+
imageui_zoom_to_eased(imageui, imageui_get_pixel_size(imageui));
570582
}
571583

572584
static void
@@ -800,7 +812,8 @@ imageui_key_pressed(GtkEventControllerKey *self,
800812
if (state & GDK_CONTROL_MASK)
801813
zoom = 1.0 / zoom;
802814

803-
imageui_zoom_to_eased(imageui, zoom);
815+
imageui_zoom_to_eased(imageui,
816+
zoom * imageui_get_pixel_size(imageui));
804817

805818
handled = TRUE;
806819
break;

0 commit comments

Comments
 (0)