FLTK logo

Re: [fltk/fltk] The case for Fl_Window::pixels_per_unit() and Fl_Double_Window::pixels_per_unit() (#230)

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] The case for Fl_Window::pixels_per_unit() and Fl_Double_Window::pixels_per_unit() (#230) ManoloFLTK Sep 29, 2021  
 

This issue seems specific to the macOS platform of FLTK since Metal is involved.
Therefore, adding in your code a small bit of Objective-c should be a working solution.

Here is a suggestion:
starting from your Fl_Window * object (which can also be an Fl_Double_Window), say win,
NSView *view = [fl_xid(win) contentView];
will give you the NSView object, view, corresponding to this window,
NSSize s = [view convertSizeToBacking:NSMakeSize(10, 10)];
int scale = (int(s.width + 0.5) > 10 ? 2 : 1);
will give you the correct scale factor for your window, 2 if it's on a retina display,
1 if it's not.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.