Lars, why do you leave these vars last_time_pressed, last_key_pressed and last_state_pressed uninitialised before you use them for the first time?
Should they not be: static Time last_time_pressed = 0; static unsigned int last_key_pressed = 0; static unsigned int last_state_pressed = 0; ? Also, is my comment correct? Ie, should this stuff be moved into xforms itself? Angus // If you have a better way to handle "wild-output" of // characters after the key has been released than the one // below, please contact me. (Lgb) // Perhaps this code should be moved into xforms' do_keyboard? // Ie, "wild-output" is swallowed silently and the widgets // don't have to worry. // (Angus 7 Dec 2002) // These are fine as static vars (Angus 6 Dec 2002) static Time last_time_pressed; static unsigned int last_key_pressed; static unsigned int last_state_pressed; lyxerr[Debug::KEY] << "Workarea Diff: " << xke->time - last_time_pressed << endl; if (xke->time - last_time_pressed < 25 // Should be tunable? && ret_state == last_state_pressed && xke->keycode == last_key_pressed) { lyxerr[Debug::KEY] << "Workarea: Purging X events." << endl; if (XEventsQueued(fl_get_display(), QueuedAlready) > 0) waitForX(true); // This purge make f.ex. scrolling stop immediately when // releasing the PageDown button. The question is if // this purging of XEvents can cause any harm... // after some testing I can see no problems, but // I'd like other reports too. (Lgb) break; } last_time_pressed = xke->time; last_key_pressed = xke->keycode; last_state_pressed = ret_state;