Ignoring keypresses



I have an application that can de-miniaturize itself, but when it does
that I would like it to eat keyboard input for a short period of time
- otherwise the user might be typing in a different program and
suddenly have my application activated and receiving input without the
user realizing it.

I am currently using the following piece

		time_t start = time(0);
		do { 
			GdkEvent *event;
			while ((event = gdk_event_get())) {
				if (event->type != GDK_KEY_PRESS &&
				    event->type != GDK_KEY_RELEASE)
					gtk_main_do_event(event);
				gdk_event_free(event);
			}
		} while (time(0) <= start + 1);

but it is not quite satisfactory. One problem is that the resolution
of the timer is not too good, but the worst problem is that the GUI
does not appear to be updating while inside this loop. This is quite
bad since the application is de-miniaturizing and thus really needs a
repaint.

Is there a better way to achieve the effect that I want?

-- 
Regards, Anders



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