diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2024-03-05 03:08:30 +0100 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2024-03-05 03:08:30 +0100 |
| commit | 4c0a2ffb8159f58d1f9f0b5298770deff874895e (patch) | |
| tree | e8120e2e0665677221eade701de8657ad785f454 /test | |
| parent | 72840ea2c12c41b36aff623b18f9c219ae085da3 (diff) | |
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.
Diffstat (limited to 'test')
| -rw-r--r-- | test/keyboard.cxx | 9 |
1 files 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) { |
