artemsen / swayimg

Image viewer for Wayland
MIT License
379 stars 31 forks source link

Display scale not handled correctly #199

Closed alterNERDtive closed 1 month ago

alterNERDtive commented 1 month ago

My main use case is making a screenshot or partial screenshot, then pasting it as a floating window somewhere in view. I have recently acquired some 4k displays and I am now using those with 2x scaling, e.g.:

output $displaymain {
  mode 3840x2160@150Hz
  adaptive_sync on
  scale 2
}

Observed behaviour:

When I take a screenshot and then paste it (wl-paste | swayimg -s real -w image -), it is 4x the expected size; in other words, it renders the input image (3840x2160) at twice the size in each dimension (7680x4320) when the display scale is set to 2. Or maybe it’s actually the other way around, it treats a scaled display as the scaled resolution (1920x1080) instead of the native one. The result is the same in either case :)

Expected behaviour:

I would expect it to render an image at the actual display resolution, not the scaled one.

Reproduction is quite simple:

  1. set a display to scale 2 in Sway (I would expect it to be the same in other WMs, but that’s what I’m using!)
  2. take a screenshot (e.g. grimshot copy output)
  3. paste the screenshot into swayimg (wl-paste | swayimg -s real -w image -)
  4. observe magnified image display in swayimg

I do also have a single non-scaled display; I disabled it for testing, that is not causing the issue.

artemsen commented 1 month ago

Looks like it is a duplicate of #134. I have two displays with different scale factors and Swayimg works normally only on one of them. I don't know why =)

artemsen commented 1 month ago

Duplicate of #134