[comp.windows.x] Better interactive performance

grunwald@flute.cs.uiuc.edu (Dirk Grunwald) (01/18/89)

When running X, emacs & latex on my sun-3/60, I notice a bit of a detail
in setting the focus. In particular, I can move the cursor from my emacs
window to an xterm window, type a few characters & have them appear
in the emacs window.

Presumably, this is because I use auto-focus, and both X and `twm' (the WM
I'm using) need to execute before the focus can change to my xterm window.

Is there a simple way to fix this? I've /etc/renice'd -5 my X server,
so it should get scheduled quickly, but tracking delay is still noticeable.

Also, I tried renicing `twm', but then recalled that this will nice
all the new children of twm.

Does anyone else have a solution, or perhaps a set of patches to TWM to
run ``niced'' but to fork children as ``normal''?

davep@ginsu.apple.COM (01/18/89)

> When running X, emacs & latex on my sun-3/60, I notice a bit of a delay
> in setting the focus. In particular, I can move the cursor from my emacs
> window to an xterm window, type a few characters & have them appear
> in the emacs window.
>
> Presumably, this is because I use auto-focus, and both X and `twm' (the WM
> I'm using) need to execute before the focus can change to my xterm window.

Try setting the NoTitleFocus variable in your .twmrc file.  If this
variable is not set, twm explicitly calls XSetInputFocus so that when
the pointer is in the title bar, keyboard input will be sent to the
body window.  When you move the pointer, the server sends EnterNotify
and LeaveNotify events to twm, which calls XSetInputFocus to move the
focus to the new window.  Meanwhile, the server can asynchronously
send characters to the window which first had focus.

If NoTitleFocus is set, the server sends characters to whichever window
the pointer is in when the character is received.

rich@RICE.EDU (Richard Murphey) (01/18/89)

In article <GRUNWALD.89Jan17131053@flute.cs.uiuc.edu> Dirk Grunwald writes:
> When running X, emacs & latex on my sun-3/60, I notice a bit of a detail
> in setting the focus. In particular, I can move the cursor from my emacs
> window to an xterm window, type a few characters & have them appear
> in the emacs window.
> 
> Does anyone else have a solution, or perhaps a set of patches to TWM to
> run ``niced'' but to fork children as ``normal''?

You might look at the way GNU emacs handles reniceing itself.
From the emacs distribution 18.52 in src/config.h:

/* Define HIGHPRI as a negative number
   if you want Emacs to run at a higher than normal priority.
   For this to take effect, you must install Emacs with setuid root.
   Emacs will change back to the users's own uid after setting
   its priority.  */

#define HIGHPRI -10

and in src/emacs.c:

#ifdef HIGHPRI
  setpriority (PRIO_PROCESS, getpid (), HIGHPRI);
  setuid (getuid ());
#endif HIGHPRI

Perhaps using this in the server would help you.

On another note, I have noticed that running GNU emacs reniced -10 and either
twm or Xsun at normal priority (0) results in both of them soaking up 50% of
the CPU cycles. I don't know why, but running them on separate hosts cures it.

Rich Murphey
Electrical Engineering
Rice University

klee@daisy.UUCP (Ken Lee) (01/19/89)

In article <GRUNWALD.89Jan17131053@flute.cs.uiuc.edu> grunwald@flute.cs.uiuc.edu (Dirk Grunwald) writes:
=>When running X, emacs & latex on my sun-3/60, I notice a bit of a detail
=>in setting the focus. In particular, I can move the cursor from my emacs
=>window to an xterm window, type a few characters & have them appear
=>in the emacs window.

Set NoTitleFocus in your .twmrc.  TWM won't get swapped in, so your
focus change should be immediate.

Ken Lee
-- 
klee@daisy.uucp
Daisy Systems Corp., Interactive Graphics Tools Dept.