[comp.windows.x] twm mods to eliminate "technicolor" flickering

csvsj@garnet.berkeley.edu (Steve Jacobson) (09/20/89)

Here are some twm mods to eliminate PseudoColor "technicolor" flickering.
The mods allow the user to optionally separate input focus from colormap
focus. "Click to focus colormap" mode eliminates flickering, but allows
the user to easily switch colormap focus when desired.

This is accomplished with a new .twmrc variable, NoShiftColorFocus, and a
new twmrc function, f.colorfocus. They are described in the man page diffs
below.


diffs between original and modified versions

twm.man:

14c14
< .TH TWM 1 "16 August 1988" "X Version 11"
---
> .TH TWM 1 "19 September 1989" "X Version 11"
305a306,314
> .IP "\fBNoShiftColorFocus\fP" 20
> If this variable is specified, colormaps will not be installed and
> deinstalled as the cursor enters and leaves windows or when input focus
> is shifted to a new window. By default, colormap focus tracks keyboard focus.
> If this variable is specified, a new window's colormap is installed
> when the window is first displayed, and a previously created window's
> colormap is installed when a window currently receiving the colormap focus
> is destroyed. When this variable is specified, use the \fBf.colorfocus\fP
> function to direct the colormap focus to a different window.
436a446,451
> .IP "\fBf.colorfocus\fP" 20
> This function directs the colormap focus to a window client.
> If \fBNoShiftColorFocus\fP is set, \fBf.colorfocus\fP allows you to shift
> the colormap focus to a desired window. If executed from a menu, the cursor
> is changed to a dot and the next window to receive a button press will
> gain the colormap focus.

add_window.c:

122a123
>     ColorFocus = tmp_win;

events.c:

211c211
<     if (tmp_win == Focus)
---
>     if (tmp_win == Focus && !NoShiftColorFocus)
212a213,214
>     else if (tmp_win == ColorFocus && NoShiftColorFocus)
> 	XInstallColormap(dpy, tmp_win->attr.colormap);
621a624,634
>     if (ColorFocus == tmp_win && tmp_win->next != NULL && NoShiftColorFocus)
>     {
> 	XInstallColormap(dpy, tmp_win->next->attr.colormap);
> 	ColorFocus = tmp_win->next;
>     }
>     else if (ColorFocus == tmp_win && tmp_win->prev != NULL &&
> 		NoShiftColorFocus)
>     {
> 	XInstallColormap(dpy, tmp_win->prev->attr.colormap);
> 	ColorFocus = tmp_win->prev;
>     }
668a682,685
> 		    if (NoShiftColorFocus)
> 		    {
> 	   	    	XInstallColormap(dpy, tmp_win->attr.colormap);
> 		    }
1199c1216,1219
< 	    XInstallColormap(dpy, tmp_win->attr.colormap);
---
> 	    if (!NoShiftColorFocus)
> 	    {
> 	    	XInstallColormap(dpy, tmp_win->attr.colormap);
> 	    }
1288c1308,1311
< 		XUninstallColormap(dpy, tmp_win->attr.colormap);
---
> 	    	if (!NoShiftColorFocus)
> 	    	{
> 		   XUninstallColormap(dpy, tmp_win->attr.colormap);
> 		}

gram.y:

76c76
< %token <num> F_ZOOM F_FULLZOOM
---
> %token <num> F_ZOOM F_FULLZOOM F_COLORFOCUS
89a90
> %token <num> NO_SHIFT_COLOR_FOCUS
133a135,136
> 		| NO_SHIFT_COLOR_FOCUS	{ if (FirstTime)
> 						NoShiftColorFocus = TRUE; }
395a399
> 		| F_COLORFOCUS		{ $$ = F_COLORFOCUS; }

lex.l:

107a108
> f.colorfocus			{ return F_COLORFOCUS; }
124a126,127
> [Nn][Oo][Ss][Hh][Ii][Ff][Tt][Co][Oo][Ll][Oo][Rr][Ff][Oo][Cc][Uu][Ss] {
> 				 return (NO_SHIFT_COLOR_FOCUS); }

menus.c:

51c51
< #ifdef macII
---
> #if defined(macII) || defined(AIX)
868a869,873
> 	    if (!NoShiftColorFocus)
> 	    {
> 	    	ColorFocus = tmp_win;
> 	    	XInstallColormap(dpy, tmp_win->attr.colormap);
> 	    }
871a877,884
>     case F_COLORFOCUS:
> 	if (DeferExecution(context, func, DotCursor))
> 	    return;
> 
> 	ColorFocus = tmp_win;
> 	XInstallColormap(dpy, tmp_win->attr.colormap);
> 	break;
> 
1137a1151
> 	case F_COLORFOCUS:
1163a1178,1180
> #ifdef ANSI_SIGNAL
>     register void (*istat) (), (*qstat) ();
> #else
1164a1182
> #endif

twm.c:

135a136
> TwmWindow *ColorFocus = NULL;	/* new window to focus colormap */
140a142
> int NoShiftColorFocus = FALSE;  /* don't shift colormap on enters */
189a192,194
> #ifdef ANSI_SIGNAL
>     void (*old_handler) ();
> #else
190a196
> #endif

twm.h:

247a248
> extern TwmWindow *ColorFocus;
254a256
> extern int NoShiftColorFocus;

version.c:

41,42c41,42
< char *Revision = "$Revision: 5.0 $";
< char *Date = "$Date: 88/10/18 11:36:29 $";
---
> char *Revision = "$Revision: 5.0atp $";
> char *Date = "$Date: 89/09/18 $";