int n_gfds, retval = 0, our_fds = 0, max_fds = fds_lim - 1;
int i, nfds, tmo_in_millisec, must_free = 0;
bool need_to_dispatch;
-#ifdef HAVE_PGTK
+#ifdef USE_GTK
bool already_has_events;
#endif
context = g_main_context_default ();
acquire_select_lock (context);
-#ifdef HAVE_PGTK
+#ifdef USE_GTK
already_has_events = g_main_context_pending (context);
+#ifndef HAVE_PGTK
+ already_has_events = already_has_events && x_gtk_use_native_input;
+#endif
#endif
if (rfds) all_rfds = *rfds;
tmop = &tmo;
}
-#ifndef HAVE_PGTK
+#ifndef USE_GTK
fds_lim = max_fds + 1;
nfds = thread_select (pselect, fds_lim,
&all_rfds, have_wfds ? &all_wfds : NULL, efds,
tmop, sigmask);
#else
- /*
- On PGTK, when you type a key, the key press event are received,
- and one more key press event seems to be received internally.
- The second event is not via a socket, so there are weird status:
- - socket read buffer is empty
- - a key press event is pending
- In that case, we should not sleep, and dispatch the event immediately.
- Bug#52761
- */
+ /* On PGTK, when you type a key, the key press event are received,
+ and one more key press event seems to be received internally.
+
+ The same can happen with GTK native input, which makes input
+ slow.
+
+ The second event is not sent via the display connection, so the
+ following is the case:
+
+ - socket read buffer is empty
+ - a key press event is pending
+
+ In that case, we should not sleep in pselect, and dispatch the
+ event immediately. (Bug#52761) */
if (!already_has_events)
{
fds_lim = max_fds + 1;