summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2024-08-08 17:50:31 +0200
committerAlbrecht Schlosser <albrechts.fltk@online.de>2024-08-08 17:50:31 +0200
commitb7fc02e5234029b55b71ec771aaccad3a739b3c3 (patch)
treefa9df87548c0b72e2cccecec56965999d94b7458 /test
parent60330a6d6f0cb396e694bf9353b4f116bd4b7213 (diff)
Simplify test/handle_keys.cxx and remove comments
Diffstat (limited to 'test')
-rw-r--r--test/handle_keys.cxx14
1 files changed, 4 insertions, 10 deletions
diff --git a/test/handle_keys.cxx b/test/handle_keys.cxx
index e63aa280d..decf0c121 100644
--- a/test/handle_keys.cxx
+++ b/test/handle_keys.cxx
@@ -109,18 +109,15 @@ const char *get_keyname(int k, int &lg) {
return "0";
}
else if (k < 32) { // control character
- sprintf(buffer, "^%c", (char)(k + 64));
- lg = 2;
+ lg = sprintf(buffer, "^%c", (char)(k + 64));
}
else if (k < 128) { // ASCII
- snprintf(buffer, sizeof(buffer), "'%c'", k);
- lg = 3;
+ lg = snprintf(buffer, sizeof(buffer), "'%c'", k);
} else if (k >= 0xa0 && k <= 0xff) { // ISO-8859-1 (international keyboards)
char key[8];
int kl = fl_utf8encode((unsigned)k, key);
key[kl] = '\0';
- snprintf(buffer, sizeof(buffer), "'%s'", key);
- lg = 3;
+ lg = snprintf(buffer, sizeof(buffer), "'%s'", key);
} else if (k > FL_F && k <= FL_F_Last) {
lg = snprintf(buffer, sizeof(buffer), "FL_F+%d", k - FL_F);
} else if (k >= FL_KP && k <= FL_KP_Last) {
@@ -335,18 +332,15 @@ void close_cb(Fl_Widget *win, void *) {
int main(int argc, char **argv) {
+#ifdef _WIN32
// Set an appropriate font for Wine on Linux (test only).
// This is very likely not necessary on a real Windows system.
// Set environment variable FLTK_USING_WINE to a non-empty string
// to enable this feature, e.g. (in bash) `export FLTK_USING_WINE=1`.
-
-#ifdef _WIN32
const char *using_wine = fl_getenv("FLTK_USING_WINE");
printf("FLTK_USING_WINE = %s\n", using_wine ? using_wine : "");
if (using_wine && *using_wine) {
- // set an alternate fixed font for the terminal widget
// Fl::set_font(FL_COURIER, " DejaVu Sans Mono"); // DejaVu Mono
- // Fl::set_font(FL_COURIER, "BNimbus Mono PS"); // Nimbus Mono PS bold
Fl::set_font(FL_COURIER, " Liberation Mono"); // Liberation Mono
}
#endif