summaryrefslogtreecommitdiff
path: root/src/Fl_Screen_Driver.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-02-28 09:13:35 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-02-28 09:13:35 +0100
commitf4fb973c5d81928c76336827d2a7471715fc1323 (patch)
treeabca0b2c3b38817e4705a44292711ca9365e19cb /src/Fl_Screen_Driver.cxx
parentfa7fe3137268baaa1b4a37defc0916fec3865c7c (diff)
Simplify code to recognize GUI rescaling shortcuts
Diffstat (limited to 'src/Fl_Screen_Driver.cxx')
-rw-r--r--src/Fl_Screen_Driver.cxx13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx
index ced46e75f..d63644e7c 100644
--- a/src/Fl_Screen_Driver.cxx
+++ b/src/Fl_Screen_Driver.cxx
@@ -481,17 +481,10 @@ int Fl_Screen_Driver::scale_handler(int event)
{
if (!keyboard_screen_scaling) return 0;
if ( event != FL_SHORTCUT || !Fl::event_command() ) return 0;
- const char *key = Fl::event_text();
- char ek[2] = "";
- if (!key || !*key) {
- ek[0] = (char)(Fl::event_key() & 0xff);
- ek[1] = '\0';
- key = (const char *)ek;
- }
enum {none, zoom_in, zoom_out, zoom_reset} zoom = none;
- if (key[0] == '0' || (strcmp(key, "à") == 0 /* for Fr keyboards*/)) zoom = zoom_reset;
- else if (key[0] == '+' || key[0] == '=') zoom = zoom_in;
- else if (key[0] == '-' || (key[0] == '6' /* for Fr keyboards*/)) zoom = zoom_out;
+ if (Fl::test_shortcut(FL_COMMAND+'+')) zoom = zoom_in;
+ else if (Fl::test_shortcut(FL_COMMAND+'-')) zoom = zoom_out;
+ else if (Fl::test_shortcut(FL_COMMAND+'0')) zoom = zoom_reset;
if (zoom != none) {
int i, count;
if (Fl::grab()) return 0; // don't rescale when menu windows are on