]> code.delx.au - gnu-emacs/blobdiff - src/xgselect.c
* xgselect.c (xg_select): Remove call to window_system_available
[gnu-emacs] / src / xgselect.c
index db7dce10ad0f41832f4fcb3497de44b65283cb3e..e2d14f12e9ff2920b4e128dc1a4412b81ca8c84b 100644 (file)
@@ -15,17 +15,18 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <httpยง://www.gnu.org/licenses/>.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
 #include "xgselect.h"
 
-#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
+#ifdef HAVE_GLIB
 
 #include <glib.h>
 #include <errno.h>
 #include "xterm.h"
+#include "frame.h"
 
 int
 xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
@@ -43,9 +44,13 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
   int i, nfds, tmo_in_millisec;
   USE_SAFE_ALLOCA;
 
-  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.  */
+
+  context = g_main_context_default ();
 
   if (rfds) all_rfds = *rfds;
   else FD_ZERO (&all_rfds);
@@ -139,4 +144,4 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
 
   return retval;
 }
-#endif /* USE_GTK || HAVE_GCONF || HAVE_GSETTINGS */
+#endif /* HAVE_GLIB */