Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HiDPI / Retina Display Support #126

Open
dognotdog opened this issue Nov 21, 2015 · 7 comments
Open

HiDPI / Retina Display Support #126

dognotdog opened this issue Nov 21, 2015 · 7 comments

Comments

@dognotdog
Copy link

It seems like creating a simple Cairo surface in a Tk window (as in the Tk examples) doesn't use native pixels on a scaled display (in my case a Retina MacBook with OS X 10.10).

Is there some way to a) query the native pixel size, and b) to set the surface to have native resolution instead of scaled?

@lobingera
Copy link
Contributor

afaiu Cairo on OSX, it asks for a Quartz surface and uses this. I'd guess the resolution is already decided in the initilisation of the Tk window.

@dognotdog
Copy link
Author

The reason I think it's something to do with surface creation is that a TreeView, for example, does use native size pixels. I've tried looking through the Canvas creation sequence in Tk.jl and Cairo.jl as well as digging a bit in the Tk sources, but it's all convoluted enough that I failed to find out where things go awry, so far.

In the meantime, I'm trying to bring up a native window with a Quartz drawable via Julia's FFI to figure out how to do it, but that's still in progress.

@dognotdog
Copy link
Author

So, drawing into a plain NSView via overriding -drawRect: with the Julia FFI and objc runtime yields correct drawing results, eg. the drawable has a HiDPI resolution without having to do any special setup to get that.

So where in the setup process of the Cairo Canvas is the error?

@lobingera
Copy link
Contributor

Could you please spend a few lines, what you want to do and how this looks in code?
I had no time to look into the details. but it could be that Cairo is somehow put into the mode to render to a bitmap which is copied to screen and the window size isn't reported correctly as there are many layers of indirection (OSX, TK, Quartz 2D, libcairo).

@nalimilan
Copy link
Contributor

I would try with a GTK or Qt window and see whether the issue persists. Tk isn't the most actively developed toolkit around.

@lobingera
Copy link
Contributor

The Gtk.jl Canvas provides double-buffering via drawing to an image (pixel) surface by default and i fear we see the same problem. But this default can be bypassed and the underlying rendering stage can be accessed.

@dognotdog
Copy link
Author

Unfortunately, I haven't done anything with Tk/Gtk/Qt outside of Julia, so I've not the faintest clue how a HiDPI option should be passed. I know Tk is the old dog of the bunch, but it was the only one I could get working mostly right on short notice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants