🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #99985

Re: 18.55 emacs does X focus management

#99985
From: carroll
Date: Sat, 17 Feb 1990 17:40
54 lines
2964 bytes
/* Written 12:42 am  Feb 15, 1990 by jik@PIT-MANAGER.MIT.EDU in m.cs.uiuc.edu:gnu.emacs.bug */
>  Emacs 18.55 uses EnterWindow and LeaveWindow events to decide when
>to solidify and outline the cursor.  Instead, it should use FocusIn
>and FocusOut events; the change to make it do this is trivial.  Patch
>follows at the end of this message.
>
>Jonathan Kamens			              USnail:
>MIT Project Athena				11 Ashford Terrace
>jik@Athena.MIT.EDU				Allston, MA  02134
>Office: 617-253-8495			      Home: 617-782-0710

Actually, that's still not going to work correctly. Here is the code out
of Epoch that does focus managment, and it works in all cases except
1. If the focus goes to a child window of an Epoch window by cursor motion.
2. The window manager redirects keystrokes into Epoch from a non-Epoch
   window (ala TWM and icons).

To make this work, you _must_ have a state variable, which I call "X_focus",
which records whether you have the focus because the cursor is in the
window, or because you were explicitly given the focus.

	    /* Here's the current scheme
	     * xcrossing.focus -> Is this the window with focus or an inferior?
	     * X_focus : 0 for no-focus, 1 for pointer focus,
	     *           2 for explicit focus.
	     * Rules : Explicit focus is lost only through FocusOut, and set
	     * through FocusIn. Enter/Leave can set pointer focus iff
	     * no explicit focus. Enter/Leave are meaningless unless the
	     * focus field is set.
	     */

	    case EnterNotify :
	    case LeaveNotify :
		if (! event.xcrossing.focus || X_focus == 2) break;
	    case FocusIn :
	    case FocusOut :
		X_focus =
		    event.type == FocusIn ? 2 :
			(event.type == EnterNotify ? 1 : 0);
		if (cursor_exists)
		    {
		    CClearCursor();
		    CCursorToggle();
		    }
		break;


Alan M. Carroll                "I hold the line - The line of strength
carroll@cs.uiuc.edu             that pulls me through the fear.
Conversation Builder:           San Jacinto - I hold the line - San Jacinto
+ Tomorrow's Tools Today +      Poison bite and darkness take my sight.
Epoch Development Team          I hold the line."
CS Grad / U of Ill @ Urbana    ...{ucbvax,pur-ee,convex}!cs.uiuc.edu!carroll
Technical Details
Message-ID: <51300003@m.cs.uiuc.edu>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!spdcc!snorkelwacker!think!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!carroll

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,e9c6a6b6a4298290,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1990-02-17 16:18:25 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!spdcc!snorkelwacker!think!zaphod.mps.ohio-state.edu!brutus.cs.uiuc.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!carroll
From: carroll@m.cs.uiuc.edu
Newsgroups: gnu.emacs.bug
Subject: Re: 18.55 emacs does X focus management
Message-ID: <51300003@m.cs.uiuc.edu>
Date: 17 Feb 90 17:40:14 GMT
Lines: 54
Nf-ID: #R:<9002150642.AA22892@pit-manager.:-40:m.cs.uiuc.edu:51300003:000:2215
Nf-From: m.cs.uiuc.edu!carroll    Feb 16 16:42:00 1990
Posted: Sat Feb 17 18:40:14 1990