Before this commit, reproduce this issue with the following command:
yad --form --field=chk:CHK TRUE --changed-action='echo 2:' --field=changes
don't use your mouse; instead press the Space key once to toggle the checkbox. The "changes" field isn't updated but it should be. This is the issue.
Now pressing Space again (or dragging/clicking the mouse) pumps the main loop, which frees the thread to run, which updates the "changes" field. This is a manual work-around for this issue.
To fix this issue I replaced gtk_main_iteration with gtk_main_iteration_do (FALSE). This way the main loop doesn't block when no events are pending, and the thread is always free to run.
Then slow down the busy-waiting loop not to hog the CPU. 10000 us keeps yad below 1% CPU on my rig, and the form UI remains very responsive. I'm using this command to test how responsive it is:
Before this commit, reproduce this issue with the following command:
don't use your mouse; instead press the Space key once to toggle the checkbox. The "changes" field isn't updated but it should be. This is the issue.
Now pressing Space again (or dragging/clicking the mouse) pumps the main loop, which frees the thread to run, which updates the "changes" field. This is a manual work-around for this issue.
To fix this issue I replaced
gtk_main_iteration
withgtk_main_iteration_do (FALSE)
. This way the main loop doesn't block when no events are pending, and the thread is always free to run.Then slow down the busy-waiting loop not to hog the CPU. 10000 us keeps yad below 1% CPU on my rig, and the form UI remains very responsive. I'm using this command to test how responsive it is:
Just keep pressing Tab Space Tab Space ... quickly to update each field. Test with and without
--changed-action
.