emacs-diffs
[Top][All Lists]
Advanced

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

master 824440a7c8: Apply fix for bug#52761 to GTK native input as well


From: Po Lu
Subject: master 824440a7c8: Apply fix for bug#52761 to GTK native input as well
Date: Wed, 26 Jan 2022 20:21:12 -0500 (EST)

branch: master
commit 824440a7c8213e3c36d027248112d1dad06a3bb7
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Apply fix for bug#52761 to GTK native input as well
    
    * src/xgselect.c (xg_select): Apply said fix on regular GTK
    builds when native input is being used.
---
 src/xgselect.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/xgselect.c b/src/xgselect.c
index d22340fc9b..7252210c68 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]