Add Fl::keyboard_screen_scaling(int) to control recognition of ctrl/+/-/0/
This commit is contained in:
parent
9d4d5ffdeb
commit
4ba6cef0b9
@ -18,6 +18,8 @@ Changes in FLTK 1.4.0 Released: ??? ?? 2019
|
||||
New Features and Extensions
|
||||
|
||||
- (add new items here)
|
||||
- New Fl::keyboard_screen_scaling(0) call stops recognition of ctrl/+/-/0/
|
||||
keystrokes as scaling all windows of a screen.
|
||||
- New "Preview" switch added to the GTK native file chooser dialog
|
||||
available on the X11 platform. This requires function fl_register_images()
|
||||
to have been called.
|
||||
|
1
FL/Fl.H
1
FL/Fl.H
@ -1037,6 +1037,7 @@ int main() {
|
||||
static float screen_scale(int n); // via screen driver
|
||||
static void screen_scale(int n, float factor); // via screen driver
|
||||
static int screen_scaling_supported();
|
||||
static void keyboard_screen_scaling(int);
|
||||
|
||||
/** @} */
|
||||
|
||||
|
@ -2154,6 +2154,14 @@ int Fl::screen_scaling_supported() {
|
||||
return Fl::screen_driver()->rescalable();
|
||||
}
|
||||
|
||||
/** Controls the possibilty to scale all windows by ctrl/+/-/0/ or cmd/+/-/0/.
|
||||
This function must be called before fl_open_display() runs to be effective.
|
||||
\param value 0 to stop recognition of ctrl/+/-/0/ (or cmd/+/-/0/ under macOS) keys as window scaling.
|
||||
*/
|
||||
void Fl::keyboard_screen_scaling(int value) {
|
||||
Fl::screen_driver()->keyboard_screen_scaling = value;
|
||||
}
|
||||
|
||||
// Pointers you can use to change FLTK to another language.
|
||||
// Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx
|
||||
FL_EXPORT const char* fl_local_shift = Fl::system_driver()->shift_name();
|
||||
|
@ -66,11 +66,11 @@ protected:
|
||||
int x2, int y2, int w2, int h2);
|
||||
|
||||
public:
|
||||
bool keyboard_screen_scaling; // true means ctrl/+/-/0/ resize windows
|
||||
static char bg_set;
|
||||
static char bg2_set;
|
||||
static char fg_set;
|
||||
|
||||
public:
|
||||
virtual float scale(int n) {return 1;}
|
||||
virtual void scale(int n, float f) { }
|
||||
static Fl_Screen_Driver *newScreenDriver();
|
||||
|
@ -39,7 +39,7 @@ char Fl_Screen_Driver::fg_set = 0;
|
||||
|
||||
|
||||
Fl_Screen_Driver::Fl_Screen_Driver() :
|
||||
num_screens(-1), text_editor_extra_key_bindings(NULL)
|
||||
num_screens(-1), text_editor_extra_key_bindings(NULL), keyboard_screen_scaling(true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -471,7 +471,7 @@ void Fl_Screen_Driver::open_display()
|
||||
been_here = true;
|
||||
if (rescalable()) {
|
||||
use_startup_scale_factor();
|
||||
Fl::add_handler(Fl_Screen_Driver::scale_handler);
|
||||
if (keyboard_screen_scaling) Fl::add_handler(Fl_Screen_Driver::scale_handler);
|
||||
int mx, my;
|
||||
int ns = Fl::screen_driver()->get_mouse(mx, my);
|
||||
Fl_Graphics_Driver::default_driver().scale(scale(ns));
|
||||
|
Loading…
Reference in New Issue
Block a user