Subject: bug#9754: Issue with Emacs 23.4

From: Ken Brown <[email-masked]>
Date: Fri, 18 May 2012 14:38:17 -0400

On 5/18/2012 2:02 PM, Stefan Monnier wrote:
>> I understand, and I'm no longer proposing the patch for the emacs-24 branch.
>> My question is about what should be done in the trunk.  It seems to me that
>> it would be better to use x_in_use, and I'm wondering if knowledgeable
>> people agree.
>
> I do think it's better, yes.

OK, thanks.  Then I'll probably apply the following patch, after waiting 
a few days to see how a new bug in xg_select that I just reported is 
resolved.

=== modified file 'src/lisp.h'
--- src/lisp.h  2012-05-09 17:51:30 +0000
+++ src/lisp.h  2012-05-18 13:38:36 +0000
@@ -3549,6 +3549,7 @@
  #ifdef HAVE_X_WINDOWS
  /* Defined in xfns.c */
  extern void syms_of_xfns (void);
+extern int x_in_use;

  /* Defined in xsmfns.c */
  extern void syms_of_xsmfns (void);

=== modified file 'src/xfns.c'
--- src/xfns.c  2012-05-02 10:20:35 +0000
+++ src/xfns.c  2012-05-18 18:34:10 +0000
@@ -136,7 +136,7 @@

  /* Nonzero if using X.  */

-static int x_in_use;
+int x_in_use;

  static Lisp_Object Qnone;
  static Lisp_Object Qsuppress_icon;

=== modified file 'src/xgselect.c'
--- src/xgselect.c      2012-05-16 02:22:53 +0000
+++ src/xgselect.c      2012-05-18 18:33:23 +0000
@@ -43,7 +43,7 @@
    int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0;
    int i, nfds, fds_lim, tmo_in_millisec;

-  if (inhibit_window_system || !display_arg)
+  if (!x_in_use)
      return select (max_fds, rfds, wfds, efds, timeout);

    if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds));

Ken