- if (! (x_in_use
- && g_main_context_pending (context = g_main_context_default ())))
- return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask);
+ /* Do not try to optimize with an initial check with g_main_context_pending
+ and a call to pselect if it returns false. If Gdk has a timeout for 0.01
+ second, and Emacs has a timeout for 1 second, g_main_context_pending will
+ return false, but the timeout will be 1 second, thus missing the gdk
+ timeout with a lot. */