Issue in GtkDialog Button Press Handler


Came across a general problem with GtkDialog:

Test case:
a) Open a large file (Approx. 10K of lines) in Gedit
b) Open the Find Dialog (Ctrl + f)
c) Enter a junk string that is not present in in file (so that the
search engine scans the entire doc)
d) Click "find" in the search dialog, gedit won't respond until the
search is finished, also pls. notice that the keyboard is _not_ grabbed
and can be used when the search is progressing

Now: Repeat the search by hitting the "Return Key". Our keyboard will be
grabbed until the search is complete and you will not be able to use it
in the mean time.

This is common for GtkDialogs which runs a background operation for a
key response and its effect is very severe in certain cases when the
call back for button press pops up an UI like GtkEntry as the user can't
use the keyboard as its grabbed.

I think the reason being when a button in the dialog is pressed the
keyboard is grabbed in gtkbutton.c: gtk_real_button_activate() using
gtk_grab_add() & gdk_keyboard_grab() and is released only in
gtk_button_finish_activate() using gtk_grab_remove() &

In the time gap (say KBG) between gtk_real_button_activate() and
gtk_button_finish_activate() the keyboard will be arrested and could not
interact with other widgets of the application. If the call back for
button press pops up a new UI which requires keyboard interaction then
the above keyboard_grab will not allow the user to interact with the new
GUI as its in the time period KBG. This effect is very severe in the
cases when the button_pressed call back pops up a new UI as said above
and the only way to release the keyboard grab is terminating the

Pls. let me know if there are ways to handle this scenario in the apps.
or it needs to be handled in GTK.

Thanks in Advance.


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