summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2007-02-23 19:27:43 +0000
committerMatthias Melcher <fltk@matthiasm.com>2007-02-23 19:27:43 +0000
commitc47b4c91aefbea91bd8405013a5b9f8c6567c99b (patch)
treef40edd8e48bba17618f463fa1ff702539ca1c930
parent7696c64a46de8780d3f9eda655a94b37cc3caf00 (diff)
Avoiding to wait forever under Cygwin. (STR #1608)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5712 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_win32.cxx5
-rw-r--r--test/demo.cxx8
2 files changed, 13 insertions, 0 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 7b18f3100..6fc64c778 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -267,6 +267,11 @@ int fl_wait(double time_to_wait) {
if (Fl::idle || Fl::damage())
time_to_wait = 0.0;
+ // if there are no more windows and this timer is set
+ // to FOREVER, continue through or look up indefinetely
+ if (!Fl::first_window() && time_to_wait==1e20)
+ time_to_wait = 0.0;
+
fl_unlock_function();
time_to_wait = (time_to_wait > 10000 ? 10000 : time_to_wait);
diff --git a/test/demo.cxx b/test/demo.cxx
index ee75b2424..32a4687de 100644
--- a/test/demo.cxx
+++ b/test/demo.cxx
@@ -306,6 +306,14 @@ int load_the_menu(const char* fname)
}
for (;;) {
if (fgets(line,256,fin) == NULL) break;
+ // remove all carriage returns that Cygwin may have inserted
+ char *s = line, *d = line;
+ for (;;++d) {
+ while (*s=='\r') s++;
+ *d = *s++;
+ if (!*d) break;
+ }
+ // interprete the line
j = 0; i = 0;
while (line[i] == ' ' || line[i] == '\t') i++;
if (line[i] == '\n') continue;