Angus Leeming <[EMAIL PROTECTED]> writes:

| 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;
| ?

nah... static vars are initialized to 0.

#include <iostream>

int main() 
{
        static int foo;
        std::cout << "Foo: " << foo << std::endl;
}

| Also, is my comment correct? Ie, should this stuff be moved into xforms 
| itself?

perhaps.

| 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)

My plan was/is to remove a lot of these when we get separate KEY_PRESS
and KEY_RELEASE events, this has not been true with 0.88 and 0.89 (not
sure how 1.0 behaves in this respect).
        
|       // 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;
>

-- 
        Lgb


Reply via email to