🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #98662

input_pending bug (repost for 18.57)

#98662
From: Paul Barton-Davis
Date: Wed, 24 Apr 1991 17:59
122 lines
4467 bytes
[ As requested by RMS, this is a repost of this bug report
  after I obtained 18.57 and tested the problem there also.
  
  I really could use some ideas on why the behaviour seen
  and described here does not cause problems on other systems,
  since I can see no reason why it would not. I've included
  the code I added to x11term.c that fixes the problem.
]

Hardware: Sequent Symmetry (X-client)
	  DECstation 3100 (X-server)

Software: Emacs 18.55.nnn & 18.57.nnn
          Dynix 3.0.12
  	  Ultrix 4.1
	  X11.R4 (athena)
	  twm (from athena X11 dist)

Bug description: 
****************

	If emac's window is resized emacs will not update 
	the screen until a key or mouse event occurs.

Bug Trackdown:
**************

	detect_input_pending() uses FIONREAD. After a resize,
	FIONREAD will detect pending input, since the X server
	sends Emacs event notification. This results in
	the global "input_pending" being set to a non-zero
	value. During internal_socket_read(), emacs discovers
	that it needs to redisplay the screen. However, when
	update_screen() checks to see if any input is pending,
	it finds there is, and so skips the update.

	Of course, the "pending input" is just X protocol
	bytes and event notifications, not the "normal"
	input that non-X emacs deal with exclusively.

Possible Bug Fix:
*****************

	Use XCheckWindowEvent() and XPutBackEvent() to determine
	if pending events contain those that emacs considers
	"input": KeyPress, ButtonPress, ButtonRelease. If not,
	set input_pending to zero.

	I have tried this, and it appears to work fine. If
	this is a real bug, I'll post it, but I'm sure RMS
	will have something to say about this.

	Here is the context diff for x11term.c

*** x11term.c	Tue Apr 23 12:20:36 1991
--- x11term.c-orig	Wed Apr 24 10:43:13 1991
***************
*** 1304,1346 ****
      }
  #endif
    while (XPending (XXdisplay)) {
- 
- #ifdef FIONREAD
- #ifdef UW_CSL  
- 
-     /**************************************************************
-        BUG FIX for Opus (??)
-      **************************************************************/
-     
-     
-     /* check to see if there are any actual keyboard
-        or mouse events in the queue. If not, mark
-        input_pending as false. We use masks for the only
-        types of events that emacs currently considers
-        keyboard input (see switch block below for those
-        cases that increment "count").
-      */
- 
-     if (XCheckWindowEvent (XXdisplay, XXwindow, KeyPressMask | ButtonPressMask | ButtonReleaseMask,
- 		       &event) == False)
-       {
- 	extern int input_pending;
- 
- #ifdef XDEBUG
- 	fprintf (stderr, "NO keybd or mouse events detected (but ip = %d)\n", input_pending);
- #endif
- 	input_pending = 0;
-       }
-     else
-       {
- #ifdef XDEBUG
- 	fprintf (stderr, "keyboard events detected (with ip = %d)\n", input_pending);
- #endif
- 	XPutBackEvent (XXdisplay, &event);
-       }
- #endif
- #endif
- 
      XNextEvent (XXdisplay,&event);
      event.type &= 0177;		/* Mask out XSendEvent indication */
  
--- 1304,1309 ----


Wierdness:
*********

	Given the above description, this ought to happen
	when the client runs on the DECstation or anything else,
	for that matter. It doesn't. I don't understand this,
	and it means I may well be wrong.

-- 
Paul Barton-Davis			<pauld@cs.washington.edu>
UW Computer Science Lab		``to shatter tradition makes us feel free''


-- 
Paul Barton-Davis <pauld@cs.washington.edu> UW Computer Science Lab	 

"People cannot cooperate towards common goals if they are forced to
 compete with each other in order to guarantee their own survival."
Technical Details
Message-ID: <1991Apr24.175934.7726@beaver.cs.washington.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!unreplyable!garbage

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,8a93e7168468c03f,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1991-04-24 10:59:34 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!unreplyable!garbage
From: pauld@CS.WASHINGTON.EDU (Paul Barton-Davis)
Newsgroups: gnu.emacs.bug
Subject: input_pending bug (repost for 18.57)
Message-ID: <1991Apr24.175934.7726@beaver.cs.washington.edu>
Date: 24 Apr 91 17:59:34 GMT
Sender: daemon@tut.cis.ohio-state.edu
Reply-To: pauld@cs.washington.edu (Paul Barton-Davis)
Distribution: gnu
Organization: Computer Science & Engineering, U. of Washington, Seattle
Lines: 122
Approved: bug-gnu-emacs@prep.ai.mit.edu