lvgl / lv_drivers

TFT and touch pad drivers for LVGL embedded GUI library
https://docs.lvgl.io/master/porting/index.html
MIT License
290 stars 309 forks source link

feat(sdl): add SDL_HIGHDPI define to allow high DPI render #310

Closed slightc closed 1 month ago

slightc commented 3 months ago

309

kisvegabor commented 3 months ago

The docs says

window should be created in high-DPI mode if supported (>= SDL 2.0.1)

So it won't be used if not supported. Therefore I wonder if we can add it unconditionally.

slightc commented 3 months ago

I think that should be a config field, it is up to the user to decide on their own

ITotalJustice commented 3 months ago

The docs says

window should be created in high-DPI mode if supported (>= SDL 2.0.1)

So it won't be used if not supported. Therefore I wonder if we can add it unconditionally.

you mean like?

#if defined(SDL_HIGHDPI) && SDL_HIGHDPI && SDL_VERSION_ATLEAST(2, 0, 1)
    flag |= SDL_WINDOW_ALLOW_HIGHDPI;
#endif

to https://github.com/lvgl/lv_drivers/blob/0091dc612facc94dce1061a9b78d641c77f1791a/sdl/sdl.c#L336


edit: nvm, i misread unconditionally as conditionally, my bad 😄

slightc commented 3 months ago

I think use SDL_HIGHDPI macro definition check, that should be defined by those in need, no need for additional version checking (want to keep simplicity).

kisvegabor commented 3 months ago

The version check is internal and we need to add it only once. IMO it's simpler than having a new config option which is visible for all the users.

So if there is no objection and if it's not harmful I vote for adding SDL_HIGHDPI (if the SDL version id high enough).

slightc commented 3 months ago

emm, that like this?

#ifndef SDL_HIGHDPI
# define SDL_HIGHDPI  SDL_VERSION_ATLEAST(2, 0, 1)
#endif

#if SDL_HIGHDPI
    flag |= SDL_WINDOW_ALLOW_HIGHDPI;
#endif
kisvegabor commented 3 months ago

Or just:

#if SDL_VERSION_ATLEAST(2, 0, 1)
    flag |= SDL_WINDOW_ALLOW_HIGHDPI;
#endif
slightc commented 1 month ago

@kisvegabor I'm update it, I think that may best can be force enable/disable by developer, so still use the SDL_HIGHDPI, this PR maybe OK?

kisvegabor commented 1 month ago

Could you add it to lvgl master too?