]> git.eshelyaron.com Git - emacs.git/commitdiff
Apply fix for bug#52761 to GTK native input as well
authorPo Lu <luangruo@yahoo.com>
Thu, 27 Jan 2022 01:20:25 +0000 (09:20 +0800)
committerPo Lu <luangruo@yahoo.com>
Thu, 27 Jan 2022 01:20:25 +0000 (09:20 +0800)
* src/xgselect.c (xg_select): Apply said fix on regular GTK
builds when native input is being used.

src/xgselect.c

index d22340fc9bc0a704fe16e197604ee91bea3b5425..7252210c68637a5bf8fe33cedfcb2a9a4c7c99c0 100644 (file)
@@ -96,15 +96,18 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds,
   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;
@@ -153,21 +156,26 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds,
        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;