My reading of the above is that we should add the HIGHDPI flag when the emulator is running on a retina Macbook. I think the issue is that there is a scaling factor applied to reduce the hardware resolution of 2560 x 1600 to the apparent resolution of 1280 X 800, and leaving this flag out results in the window being created for the apparent resolution and the canvas being created for the hardware resolution.
I added the following code to ffi/SDL2_0.lua
-- set up screen (window)
if ffi.os == "OSX" then
screen_flags = bit.bor(full_screen and 1 or 0,
SDL.SDL_WINDOW_RESIZABLE,
SDL.SDL_WINDOW_ALLOW_HIGHDPI)
else
screen_flags = bit.bor(full_screen and 1 or 0,
SDL.SDL_WINDOW_RESIZABLE)
end
S.screen = SDL.SDL_CreateWindow("KOReader",
tonumber(os.getenv("KOREADER_WINDOW_POS_X")) or SDL.SDL_WINDOWPOS_UNDEFINED,
tonumber(os.getenv("KOREADER_WINDOW_POS_Y")) or SDL.SDL_WINDOWPOS_UNDEFINED,
S.w, S.h,
screen_flags
)
I also removed the declaration of the SDL_WINDOW_ALLOW_HIGHDPI flag from SDL2_0_h.lua and put it in SDL2_0_decl.c.
I'm not certain how I should build to test. I've tried running kodev build, and it doesn't recreate the SDL2_0_h.lua file. I also tried kodev clean with the same result.
Any pointers on how I should build to test this before putting in a PR?
(Sorry for the newbie question - i've never worked with this stuff before.)
|