user configuration of fltk based applications

206 views
Skip to first unread message

Max Kovgan

unread,
Aug 14, 2015, 12:24:46 PM8/14/15
to fltk.general
hi.
Trying to use FLTK application on a big display (attached).
Expected to find a way to make FLTK scale properly everything according to my display.
So, dug a bit in ~, and found a nice folder: ~/.fltk/fltk.org
The file seeming to have a name expected to have the salvation is: ~/.fltk/fltk.org/fltk.prefs
But it is too thin.

So, I have briefly visited the pages:
Searching for "Configuration", and found nothing.

(Basically the complaint was that fltk lies about dpi.
And the answer at that time was "well, everybody lies, and so do we".
Is the situation with that lying function still the same?
Maybe it's a good time to make it tell the truth....)

Please help.

xrandr.output.txt

Greg Ercolano

unread,
Aug 14, 2015, 12:44:09 PM8/14/15
to fltkg...@googlegroups.com
On 08/13/15 19:34, Max Kovgan wrote:
> hi.
> Trying to use FLTK application on a big display (attached).
> Expected to find a way to make FLTK scale properly everything according to my display.

Some questions:

What function are you having trouble with:

1) Scaling the widgets + fonts (i.e. resizing issue)
2) Fl::screen_xywh() and/or screen_work_area()?
3) Fl::screen_dpi()?

Assuming the problem is with getting the screen size,
what version of FLTK are you using? (1.3.3, an svn snapshot, i.e. r######)

Given the output of xrandr, sounds like the platform is X windows.
If screen size/dpi is the issue, curious what values you're getting
back from FLTK (as we can see what xrandr says -- 3840x2160

If you're having a problem with one of the latest release
versions (e.g. 1.3.3), try the latest svn snapshot in case the
issue has been fixed.

> So, dug a bit in ~, and found a nice folder: ~/.fltk/fltk.org
> The file seeming to have a name expected to have the salvation is: ~/.fltk/fltk.org/fltk.prefs
> But it is too thin.

Yes, probably not what you want.
I don't think screen size/dpi would be a prefs issue, nor related
to widget + window scaling/resizing.

Note that if you use show(argc,argv), you can set the window size
from the command line with the -geometry flag. That way if you know
the res of your screen, you can force the size via the command line,
e.g. "./yourapp -geometry 3840x2160", IIRC.

> Also found a discouraging post: http://comments.gmane.org/gmane.comp.lib.fltk.devel/10506
> (Basically the complaint was that fltk lies about dpi.
> And the answer at that time was "well, everybody lies, and so do we".
> Is the situation with that lying function still the same?
> Maybe it's a good time to make it tell the truth....)

Sounds like the point was that the underlying OS functions return
incorrect info, and FLTK is just passing that info back from the OS.


MacArthur, Ian (Selex ES, UK)

unread,
Aug 18, 2015, 4:41:26 AM8/18/15
to fltkg...@googlegroups.com
> Trying to use FLTK application on a big display (attached).
> Expected to find a way to make FLTK scale properly everything according
> to my display.

FLTK doesn't do auto scaling; you need to do that yourself; it's part of being fast-and-light!

Though recent snapshots do provide some mechanisms to help on very high DPI "retina" displays; in general if you want to do "responsive design" you need to size and position your widgets programmatically to get the desired effects.
Well, that's what I do at any rate...

> So, dug a bit in ~, and found a nice folder: ~/.fltk/fltk.org
> The file seeming to have a name expected to have the salvation is:
> ~/.fltk/fltk.org/fltk.prefs
> But it is too thin.

That's not what that is for...


> So, I have briefly visited the pages:
> • http://www.fltk.org/articles.php?L+TFAQ
> • http://www.fltk.org/doc-1.3/index.html
> Searching for "Configuration", and found nothing.

No, that's not the way it is done.

Also, note that folks are often somewhat confused, perhaps even "challenged", by fltk's resize behaviour. It's a great system, once you get your head around it, but...


FWIW, if you layout your window, with all your widgets positioned and sized at some know size, with the correct aspect ratio, and the window resizeable is assigned, then do a "window->resize();" to the larger size for your display, this will scale all the widgets proportionally to the new size.

However, it will not scale your fonts for you, you need to do that in code - though again there are shortcuts to allow all labels to be resized suitably.

What is it you are trying to do? Perhaps another way to get there may be found?

> Also found a discouraging post:
> http://comments.gmane.org/gmane.comp.lib.fltk.devel/10506
> (Basically the complaint was that fltk lies about dpi.
> And the answer at that time was "well, everybody lies, and so do we".
> Is the situation with that lying function still the same?
> Maybe it's a good time to make it tell the truth....)

FLTK reports whatever the underlying system reports; it is not that fltk "lies", it is that (for strange arcane reasons that I personally don’t hold much truck with) the core OS and display drivers have some quite odd ideas about what dpi means, in many cases.

However, fltk doesn't really work in dpi anyway, it only works in pixels (even font scaling we try to do in pixels rather than points) so inaccurate dpi is usually not a problem - we do get accurate screen pixel counts and you can work with them.





Selex ES Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
Reply all
Reply to author
Forward
0 new messages