Closed oyarsa closed 1 year ago
The only way the image would be tiled is if its resolution is smaller than the pixel resolution (not logical but actual pixels) of the monitor. So pick an large enough image.
Both the image (linked in the post) and the monitor are 4K (3840 × 2160).
This seems like some issue with a two-monitor setup with different resolutions because the image is not tiled in the built-in monitor, even when its resolution differs from that monitor.
I tried with other image sizes, and the smallest size that fills the monitor height almost totally is 5000 × 2813
, which is bigger than it should be for a 4K monitor.
That being the case, I don't see how it's an image problem. A 4K image should fill a 4K monitor.
On Sun, Apr 30, 2023 at 06:19:33PM -0700, Italo Silva wrote:
Both the image (linked in the post) and the monitor are 4K (3840 × 2160).
This seems like some issue with a two-monitor setup with different resolutions because the image is not tiled in the built-in monitor, even when its resolution differs from that monitor.
The resolution differing is not sufficient, it has to be less than the resolution of th emonitor, only then will it be tiled, and the tiling happens automatically on the GPU, not under kitty's control.
it has to be less than the resolution of th monitor
I don't understand. I already verified that the image's resolution matches the monitor (both are 4K).
not under kitty's control
Then why did the behaviour change between 0.25 and 0.28?
Kitty 0.25.2:
Kitty 0.28.1:
The 0.25 behaviour also looks weird because the image is cropped.
No clue, I cannot replicate. Feel free to debug yourself, relevant code is the draw_bg() function in shaders.c and and bgimage_vertex.glsl shader both of which are small and simple.
This is the commit that changed the behaviour: https://github.com/kovidgoyal/kitty/commit/4d80427908b3d54ed6f48a57a250f404b1951984. I found it through bisect.
I don't know enough about graphics to understand it, but this should help.
Fix committed. I am travelling and dont have access to a mac ot test right now so please see it it works.
I've tested on macOS, and it's back to the behaviour before that patch.
Are you sure that's correct, though? Because now it has the opposite behaviour: it's cropped. See here:
Refer to the original image:
There are only two available dimensions, the viewport size and the window size. SO it has to be one of them. What is your monitors scale factor? i.e. how many physical pixels make a logical pixel? THe only way I can see for bth number to be incorrect is for the scale factor glfw reports to kitty to not match the actual scale factor of your monitor.
The 4K monitor is on 1.5 scaling (2560x1440). How can I check the scale factor from glfw?
It will be the ratio of the viewport size to window size. And the code where glfw gets the scale factor is in glfw/cocoa_window.m IIRC search for scale.
I added some logging to that file (commit), and the scale factor seems to be correct:
viewDidChangeBackingProperties 2.000000 2.000000
viewDidChangeBackingProperties 2.000000 2.000000
_glfwPlatformGetWindowContentScale 0.000000 0.000000
viewDidChangeBackingProperties 2.000000 2.000000
_glfwPlatformGetWindowContentScale 0.000000 0.000000
_glfwPlatformGetWindowContentScale 0.000000 0.000000
I'm afraid I don't understand what the code is doing. Could it be that glfw is also scaling the background image when it shouldn't be?
glfw doesnt see the image at all, it is directly transmitted to the GPU and didnt you say the scale should be 1.5 not 2?
didnt you say the scale should be 1.5 not 2
You're right; the correct scale should be 1.5. I got confused for a moment.
That will be the reason for the mismatch then.
I am guessing cocoa rounds these scale numbers up and then rescales post rendering to work around applications that dont support fractional scaling. Dont see much kitty can do here.
hey @oyarsa how did you make the image darker, and highlight the terminal text? plase!
To darken the background, you can use background_tint
. I'm not sure what you mean by "highlight the terminal text".
Describe the bug In kitty 0.28.1, the background image is tiled even if it has the same resolution as the monitor. I have a dual monitor setup with the built-in Macbook monitor and a 4K monitor. It looks correct in the built-in monitor.
In kitty 0.25, this was behaving as expected. I upgraded to 0.28, and this started happening.
I don't want to use
scaled
because it would look weird when the terminal doesn't occupy the full screen.To Reproduce Steps to reproduce the behaviour:
Screenshots
Environment details
Additional context Minimal
kitty.conf
:saber-4k.png
: