Re: Discarding key pressed events.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Luca Cappa wrote:

Hello,

in my application I have some key handlers which receive input from the user. When the user press a key, a task has to be executed: this task could require a tiny time slice or a longer one. The problem is that if the user hold pressed a key and the relative task takes a lot of time to be executed, my application will be flooded of key pressed events. I would like to avoid the situation where I receive a lot of "key press" events, which force my application to execute a long time consuming task each time the event is received, and then the application is stuck until all the events are "eaten".

How to avoid this? maybe i could delete the keys' event from the events queue? Any help?

Actually I did a workaround for this problem:

1- get an key press event;
2- disable key press event with: set_events (get_events() ^ Gdk::KEY_PRESS_MASK);
3- start a timer which every 10 millisecs do a task;
4- receive a key release event;
5- stop the timer
6- reenable the key press event mask: set_events (get_events() | Gdk::KEY_PRESS_MASK);

The problem actually is that I cant call "set_events" on a widget which is already realized, and I am get a lot of warnings indeed.
So, my problem is still unresolved. Anyone could help me?

Thanks in advance,
Luca


p.s. I am using gtkmm, but there is no problem in talking to my about gtk+.
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux