Improve recognition of re-scaling shortcuts - cont'd

This commit is contained in:
ManoloFLTK 2024-02-11 19:10:39 +01:00
parent 4ea058da0a
commit cf551ddf5a

View File

@ -482,10 +482,11 @@ int Fl_Screen_Driver::scale_handler(int event)
if (!keyboard_screen_scaling) return 0; if (!keyboard_screen_scaling) return 0;
if ( event != FL_SHORTCUT || !Fl::event_command() ) return 0; if ( event != FL_SHORTCUT || !Fl::event_command() ) return 0;
const char *key = Fl::event_text(); const char *key = Fl::event_text();
char ek[2] = "";
if (!key || !*key) { if (!key || !*key) {
static char ek; ek[0] = (char)(Fl::event_key() & 0xff);
ek = Fl::event_key() & ~(FL_SHIFT+FL_COMMAND); ek[1] = '\0';
key = &ek; key = (const char *)ek;
} }
enum {none, zoom_in, zoom_out, zoom_reset} zoom = none; enum {none, zoom_in, zoom_out, zoom_reset} zoom = none;
if (key[0] == '0' || (strcmp(key, "à") == 0 /* for Fr keyboards*/)) zoom = zoom_reset; if (key[0] == '0' || (strcmp(key, "à") == 0 /* for Fr keyboards*/)) zoom = zoom_reset;