Giter Site home page Giter Site logo

Request: Independent window rescale about fltk HOT 13 OPEN

fltk avatar fltk commented on June 27, 2024
Request: Independent window rescale

from fltk.

Comments (13)

erco77 avatar erco77 commented on June 27, 2024 1

In fltk 1.4.x, [Ctrl]- and [Ctrl]+ does this. Should work with all of the fltk test programs.

from fltk.

abrolag avatar abrolag commented on June 27, 2024

Oh that's great news!
Just to be sure I've got this right, so an application with two windows can have one enlarged, while the other one stays the same. Is that right?

from fltk.

erco77 avatar erco77 commented on June 27, 2024

Oh, per-window in a multiwindow app? Offhand I don't think it works that way, no, so your request should stand unless there's something I'm missing.
I believe the Ctrl+/- scaling is for all windows in the app, not just the one you're currently in, the goal being to help the application look right on high dpi displays.

from fltk.

MatthiasWM avatar MatthiasWM commented on June 27, 2024

Also, in Apple MacOS, you can scale the entire screen simply by holding Ctrl and dragging the scroll wheel (or the two-finger scroll on the touch pad). It's really a fantastic help for sight impaired people and aging programmers.

from fltk.

ManoloFLTK avatar ManoloFLTK commented on June 27, 2024

What is currently possible with FLTK 1.4 is to define a global shortcut key
that would enlarge all windows on a screen, and, for example, reset all windows
to their previous size if repeated.
That is nearly what you asked for except that other windows of the FLTK app
get enlarged too, which may be acceptable since switching is very simple.
The following example defines ctrl-P as that global shortcut
and have it enlarge all window content 3-fold. That won't work if the ctrl-P
shortcut is used for something else by the FLTK app (say, a menu item shortcut).

  1. add this function to your code:
    #include <src/Fl_Screen_Driver.H>
    int my_scale_handler(int event) {
    if ( event != FL_SHORTCUT || (!Fl::event_ctrl()) ) return 0;
    int key = Fl::event_key() & ~(FL_SHIFT+FL_CTRL);
    if (key != 'p') return 0;
    static float current_scale = 1;
    static int current_screen = -1;
    if (current_screen == -1 ) {
    current_screen = Fl::first_window()->screen_num();
    current_scale = Fl::screen_scale(current_screen);
    Fl::screen_driver()->rescale_all_windows_from_screen(current_screen, 3);
    }
    else {
    Fl::screen_driver()->rescale_all_windows_from_screen(current_screen, current_scale);
    current_screen = -1;
    }
    return 1;
    }

  2. put this statement very early in your program, possibly as 1st statement in main():
    Fl::add_handler(my_scale_handler);

from fltk.

ManoloFLTK avatar ManoloFLTK commented on June 27, 2024

I believe there's no convenient hook to the code to rescale an FLTK window
individually. That is because FLTK defines a per-display scaling factor
and refers to that value in many places under the logic that all windows
of the same display share the same value of the scaling factor.
That property allows all FLTK apps to become rescalable with FLTK 1.4 without
change to their source code.

from fltk.

abrolag avatar abrolag commented on June 27, 2024

Thanks for the updates. A bit disappointing, but still an impovement on the overall fixed size of fltk V 1.3

from fltk.

Albrecht-S avatar Albrecht-S commented on June 27, 2024

I believe that this issue has been discussed and will not be fixed, at least not in the near or middle future.

I suggest to close this issue. It will be closed no later than 1 week from now if there's no further action.

from fltk.

erco77 avatar erco77 commented on June 27, 2024

We could plan for such changes, perhaps as a discussion on fltk.coredev.
Or an RFE/STR that remains open so the request and implementation suggestions don't get lost,
as I imagine there's several needs, each with its own details. (multi-monitor/screen specific vs. window specific, etc)
I imagine implementation could be tricky, since deparented windows like menus and
dialogs would probably have to be affected too.

from fltk.

abrolag avatar abrolag commented on June 27, 2024

This seems like a good compromise. While I appreciate this isn't a high priority for most people, I wouldn't want it to get lost completely.

from fltk.

Albrecht-S avatar Albrecht-S commented on June 27, 2024

Okay, points taken. I removed the 'wontfix' label and added 'enhancement' so we can leave this issue open for now and discuss the possible improvements further.

from fltk.

abrolag avatar abrolag commented on June 27, 2024

Just as a matter of interest, we've been able to get what we wanted with fltk1.3.5. We set the windows as resizable, and work with a fixed W/H ratio (so circles remain circles), then store the default width. When resizing we multiply text font size by the ratio of the current width against the default.
Menu bars and tabs (with text) don't work correctly so we synthesize these.
If anyone is interested the project is Yoshimi soft-synth and is on here and sourceforge.

from fltk.

rageworx avatar rageworx commented on June 27, 2024

In fltk 1.4.x, [Ctrl]- and [Ctrl]+ does this. Should work with all of the fltk test programs.

Dear @Albrecht-S ,
I read this now, and really super thanks for announcing this feature to test high DPI affects on 96 DPI screen !

from fltk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.