Path: utzoo!telly!philmtl!uunet!tut.cis.ohio-state.edu!MIZAR.DOCS.UU.SE!victor From: victor@MIZAR.DOCS.UU.SE (Bjorn Victor) Newsgroups: gnu.emacs.bug Subject: X11 focus management Message-ID: <8912141748.AAmizar10997@mizar.DoCS.UU.SE> Date: 14 Dec 89 17:48:28 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 73 In GNU Emacs 18.55.5 of Thu Dec 7 1989 on mizar (berkeley-unix) Emacs doesn't do focus management (for highlighting the cursor), as src/x11term.c states in function internal_socket_read(). Instead it does Enter/Leave window management, which is not really relevant. Well, I got irritated on it (since I use twm with TitleFocus), and looked at it. I'm no Xpert, but it seems to work if you simply change the case EnterNotify/LeaveNotify pair with FocusIn/FocusOut, and change the XSelectInput call in XInitWindow to use FocusChangeMask instead of EnterWindowMask | LeaveWindowMask. Perhaps some Xpert can tell me if this is the wrong way of doing things, or if I'll get bitten by some evil side effect? -- Bjorn Victor victor@DoCS.UU.SE Dept. of Computer Systems or victor%DoCS.UU.SE@uunet.UU.NET Uppsala University, Sweden "I'd rather hack a Lisp Machine!" The patch: *** /usr/share/local/src/gnu/emacs-18.55/src/x11term.c Thu Aug 3 04:56:42 1989 --- /home/mizar/docs/victor/emacs/18.55/src/x11term.c Thu Dec 14 18:15:59 1989 *************** *** 1314,1326 **** * still show a filled cursor whenever the pointer * enters the emacs window. */ ! case EnterNotify: CursorToggle (); CursorOutline = 0; CursorToggle (); break; ! case LeaveNotify: CursorToggle (); CursorOutline = 1; CursorToggle (); --- 1314,1328 ---- * still show a filled cursor whenever the pointer * enters the emacs window. */ ! /* case EnterNotify: */ ! case FocusIn: /* Focus management *seems* this simple... */ CursorToggle (); CursorOutline = 0; CursorToggle (); break; ! /* case LeaveNotify: */ ! case FocusOut: /* Focus management... */ CursorToggle (); CursorOutline = 1; CursorToggle (); *************** *** 2386,2392 **** XSelectInput(XXdisplay, XXwindow, KeyPressMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | ! EnterWindowMask | LeaveWindowMask | StructureNotifyMask); XMapWindow (XXdisplay, XXwindow); --- 2388,2395 ---- XSelectInput(XXdisplay, XXwindow, KeyPressMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | ! /* EnterWindowMask | LeaveWindowMask | */ ! FocusChangeMask | /* Focus management */ StructureNotifyMask); XMapWindow (XXdisplay, XXwindow);