Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 02-27-2020, 01:18 PM   #1
jbenwell
Member
jbenwell began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Feb 2020
Device: Kobo Forma
Koreader Emulator on a Macbook (retina display)

I've got Koreader running on a 2017 Macbook with a retina display. The window drawn is four times the size of the actual content (see attachment).

Things work fine on an external monitor, including a 4k one.

I've been poking at the source and can't figure out where the window or canvas is created. Could anyone point me at an appropriate place to start looking?

Thanks!
Jason
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2020-02-27 at 1.16.40 PM.png
Views:	46
Size:	487.8 KB
ID:	177399  
jbenwell is offline   Reply With Quote
Old 02-27-2020, 01:24 PM   #2
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 9,982
Karma: 17701002
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
SDL2 might need a hint that there's a HiDPI scale factor to be applied somewhere.

(Shot in the dark, HiDPI is a wonderful mess that I'm happy I personally don't have to deal with anywhere for now ).
NiLuJe is offline   Reply With Quote
Advert
Old 02-27-2020, 01:27 PM   #3
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 9,982
Karma: 17701002
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
c.f., https://wiki.libsdl.org/SDL_CreateWindow

Note that we don't actually build a macOS application bundle, so I have no idea how to deal with the plist requirements.
NiLuJe is offline   Reply With Quote
Old 02-27-2020, 01:34 PM   #4
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 391
Karma: 422487
Join Date: Apr 2014
Device: BQ Cervantes 4
Yup, what NiLuJe said.

brew should contain a SDL version recent enough to support
Code:
SDL_WINDOW_ALLOW_HIGHDPI
. Is just a matter to use that in https://github.com/koreader/koreader...DL2_0.lua#L112.

If you want to submit a PR please make sure to OR that flag just
Code:
if ffi.os == "OSX"
and leave window creation as is for other platforms.

As brew is a rolling release "distro" I'm pretty sure we don't need to check for versions there.
pazos is offline   Reply With Quote
Old 02-27-2020, 01:51 PM   #5
jbenwell
Member
jbenwell began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Feb 2020
Device: Kobo Forma
Thanks very much, NiLuJe and pazos. I threw this in (not to submit, just to try):

bit.bor(bit.bor(full_screen and 1 or 0, SDL.SDL_WINDOW_RESIZABLE), SDL.SDL_WINDOW_ALLOW_HIGHDPI)

and also had to add this to

SDL2_0_h.lua line 853

static const int SDL_WINDOW_ALLOW_HIGHDPI = 4096;

I'm not sure if there is any interest in this, but I can submit it as a fix after wrapping things nicely and setting the flags in a nicer way.
jbenwell is offline   Reply With Quote
Advert
Old 02-27-2020, 01:52 PM   #6
jbenwell
Member
jbenwell began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Feb 2020
Device: Kobo Forma
Actually spoke too soon. It's not working again. I'll keep poking.
jbenwell is offline   Reply With Quote
Old 02-27-2020, 02:00 PM   #7
jbenwell
Member
jbenwell began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Feb 2020
Device: Kobo Forma
Setting to 8192 rather than 4096 works. I can't count, apparently.
jbenwell is offline   Reply With Quote
Old 02-27-2020, 04:29 PM   #8
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 9,982
Karma: 17701002
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
Don't worry too much about the constant, just add it to the list near the bottom, and as long as you PR from a branch where we can push to, I'll run a rebuild of the autogenerated SDL2_0_h.lua .
NiLuJe is offline   Reply With Quote
Old 02-28-2020, 10:26 AM   #9
Frenzie
Guru
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 946
Karma: 330000
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
Quote:
Originally Posted by pazos View Post
If you want to submit a PR please make sure to OR that flag just
Code:
if ffi.os == "OSX"
and leave window creation as is for other platforms.
Isn't that SDL's job? I imagine that flag does nothing at all on platforms other than iOS and MacOS? And conversely, if it does do something, surely it should be doing it?

Last edited by Frenzie; 02-28-2020 at 10:28 AM.
Frenzie is offline   Reply With Quote
Old 02-28-2020, 11:50 AM   #10
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 9,982
Karma: 17701002
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, (PW) & PW2; Kobo H2O & Forma
Yep, it's handled by platform-specific bits wherever it's "needed".
NiLuJe is offline   Reply With Quote
Old 02-28-2020, 12:21 PM   #11
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 391
Karma: 422487
Join Date: Apr 2014
Device: BQ Cervantes 4
Quote:
Originally Posted by Frenzie View Post
Isn't that SDL's job? I imagine that flag does nothing at all on platforms other than iOS and MacOS? And conversely, if it does do something, surely it should be doing it?
And probably the flag gets ignored on SDL versions < 2.0.1, but I dunno. My suggestion of wrapping it in osx only was related to avoid sdl version checks, but I wasn't aware of the gorgeous SDL_Linked_Version_AtLeast() function. So using that makes sense even in the case the flag is actually ignored on previous versions.
pazos is offline   Reply With Quote
Old 02-28-2020, 12:22 PM   #12
Frenzie
Guru
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 946
Karma: 330000
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
You're aware that SDL 2.0.1 came out about 7 years ago, right?

Edit: I mean, literally the only thing older is SDL 2.0.0. Which came out a few weeks prior. 2013-08-17 for 2.0.0, 2013-10-24 for 2.0.1.

But fine, closer to 6 than to 7. Doesn't change anything, imo. That's all EOL. Ubuntu 14.04 shipped with 2.0.2.

Last edited by Frenzie; 02-28-2020 at 12:26 PM.
Frenzie is offline   Reply With Quote
Old 02-28-2020, 12:32 PM   #13
jbenwell
Member
jbenwell began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Feb 2020
Device: Kobo Forma
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.)
jbenwell is offline   Reply With Quote
Old 02-28-2020, 12:40 PM   #14
pazos
cosiñeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 391
Karma: 422487
Join Date: Apr 2014
Device: BQ Cervantes 4
I'm still using SDL1.2 for some stuff. I do never forget that SDL2.0 removed the linux framebuffer support.

On the bright side newer SDL versions paired with DirectFB allow to run SDL thingies without X11. It is actually cool to run graphical things on the Raspberry Pi this way.
pazos is offline   Reply With Quote
Old 02-28-2020, 01:39 PM   #15
Frenzie
Guru
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 946
Karma: 330000
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
@pazos But when I put in the PR for removing SDL 1.2 you said something like "be gone legacy stuff /thumbs up" :P

@jbenwell We do that manually with https://github.com/koreader/ffi-cdecl As long as it's in SDL2_0_decl.c it should be fine.

Anyway, if you really must put in that condition, you should use the SDL_Linked_Version_AtLeast function I put in place for that very reason. Well, except I implicitly did not intend for it to check for 2.0.1, just for newer than 2.0.4. It's quite possible the program is broken on <2.0.4 because no one's tested that in half a decade.
Frenzie is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
iBooks on Mavericks with non-retina display SamL Apple Devices 3 01-10-2014 05:25 AM
Is anyone using the MacBook Pro with Retina display as an eReader? pata Apple Devices 12 08-14-2012 11:29 AM
iPad Apple’s New Retina Display: Do All Those Pixels Matter? monkeyluis Apple Devices 0 03-15-2012 08:46 AM
Rumoured Retina Display on iPad 3 Skilgannon Apple Devices 16 03-07-2012 03:29 PM


All times are GMT -4. The time now is 05:52 PM.


MobileRead.com is a privately owned, operated and funded community.