From 4c0a2ffb8159f58d1f9f0b5298770deff874895e Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 5 Mar 2024 03:08:30 +0100 Subject: [PATCH] Fix shortcut (Esc) handling in test/keyboard.cxx Esc is intentionally consumed by the test program (see comment) but other keystrokes (shortcuts) must pass to allow zooming with ctrl/+/-/0. The old code filtered all shortcuts which turned out to be wrong. Not being able to zoom was caused by a previous commit that lowered the priority of the zoom key handler - which alone was not wrong. --- test/keyboard.cxx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/keyboard.cxx b/test/keyboard.cxx index 46ba6142f..7cc3e2680 100644 --- a/test/keyboard.cxx +++ b/test/keyboard.cxx @@ -1,7 +1,7 @@ // // Keyboard/event test program for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2021 by Bill Spitzak and others. +// Copyright 1998-2024 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -38,9 +38,12 @@ void key_cb(Fl_Button*, void*) {} void shift_cb(Fl_Button*, void*) {} void wheel_cb(Fl_Dial*, void*) {} -// this is used to stop Esc from exiting the program: +// This is used to stop Esc from exiting the program. +// Other keystrokes like zoom keys (ctrl/+/-/0) must pass though. int handle(int e) { - return (e == FL_SHORTCUT); // eat all keystrokes + if (e == FL_SHORTCUT && Fl::event_key() == FL_Escape) + return 1; + return 0; } int MyWindow::handle(int msg) {