csvsj@garnet.berkeley.edu (Steve Jacobson) (03/20/90)
X Window System Bug Report xbugs@expo.lcs.mit.edu VERSION: R4 CLIENT MACHINE and OPERATING SYSTEM: Sun SPARCstation 1 running SunOS 4.0.3c DISPLAY TYPE: Sun cgsix WINDOW MANAGER: twm AREA: twm SYNOPSIS: Here are some suggested modifications to twm that eliminate "technicolor flicker" when the server cannot simultaneously install all the different colormaps associated with the currently active windows. DESCRIPTION: These modifications at support for one new twm variable, NoShiftColorFocus, and one new twm function, f.colorfocus. When NoShiftColorFocus is set, twm will not install different colormaps in response to window entry events. It will install new colormaps in response to window creation, window mapping, deiconificying, or when the window that has the colormap focus is iconified or destroyed. Note that the root window colormap will be temporarily installed during twm operations such as twm menu display and window resizing. The f.colorfocus function installs the colormap(s) associated with the window it is invoked upon. This allows the colormap focus to be manually changed. SAMPLE FIX: *** parse.h Wed Mar 14 13:24:44 1990 --- /tuna_b/x11r4/mit/clients/twm/parse.h Thu Dec 14 11:51:26 1989 *************** *** 90,96 **** #define F_CUTFILE 43 #define F_SHOWLIST 44 #define F_HIDELIST 45 - #define F_COLORFOCUS 46 #define F_MENU 101 /* string */ #define F_WARPTO 102 /* string */ --- 90,95 ---- *** screen.h Wed Mar 14 10:46:55 1990 --- /tuna_b/x11r4/mit/clients/twm/screen.h Thu Dec 14 11:52:27 1989 *************** *** 196,202 **** int UnknownHeight; /* height of the unknown icon */ int TitleHeight; /* height of the title bar window */ TwmWindow *Focus; /* the twm window that has focus */ - TwmWindow *ColorFocus; /* the twm window that has color focus */ int EntryHeight; /* menu entry height */ int FramePadding; /* distance between decorations and border */ int TitlePadding; /* distance between items in titlebar */ --- 196,201 ---- *************** *** 239,245 **** short FirstTime; /* first time we've read .twmrc */ short CaseSensitive; /* be case-sensitive when sorting names */ short WarpUnmapped; /* allow warping to unmapped windows */ - short NoShiftColorFocus; /* color focus doesn't follow mouse */ FuncKey FuncKeyRoot; } ScreenInfo; --- 238,243 ---- *** gram.y Wed Mar 14 13:27:23 1990 --- /tuna_b/x11r4/mit/clients/twm/gram.y Fri Dec 15 11:01:02 1989 *************** *** 87,93 **** %token <num> MOVE RESIZE WAIT SELECT KILL LEFT_TITLEBUTTON RIGHT_TITLEBUTTON %token <num> NUMBER KEYWORD NKEYWORD CKEYWORD CLKEYWORD FKEYWORD FSKEYWORD %token <num> SKEYWORD DKEYWORD JKEYWORD WINDOW_RING WARP_CURSOR ERRORTOKEN - %token <num> NO_SHIFT_COLOR_FOCUS %token <ptr> STRING %type <ptr> string --- 87,92 ---- *************** *** 229,236 **** win_list | WARP_CURSOR { if (Scr->FirstTime) Scr->WarpCursor = TRUE; } - | NO_SHIFT_COLOR_FOCUS { if (Scr->FirstTime) - Scr->NoShiftColorFocus = TRUE; } | WINDOW_RING { list = &Scr->WindowRingL; } win_list ; --- 228,233 ---- *** add_window.c Thu Mar 15 21:58:33 1990 --- /tuna_b/x11r4/mit/clients/twm/add_window.c Fri Dec 15 16:41:16 1989 *************** *** 168,174 **** XGetWindowAttributes(dpy, tmp_win->w, &tmp_win->attr); XFetchName(dpy, tmp_win->w, &tmp_win->name); tmp_win->class = NoClass; - Scr->ColorFocus = tmp_win; XGetClassHint(dpy, tmp_win->w, &tmp_win->class); FetchWmProtocols (tmp_win); FetchWmColormapWindows (tmp_win); --- 168,173 ---- *************** *** 781,790 **** */ if (RootFunction) ReGrab(); - if (Scr->NoShiftColorFocus) - { - InstallWindowColormaps(0, tmp_win); - } return (tmp_win); } --- 780,785 ---- *** events.c Fri Mar 16 09:26:28 1990 --- /tuna_b/x11r4/mit/clients/twm/events.c Thu Dec 14 11:52:19 1989 *************** *** 422,427 **** --- 422,430 ---- n = j*(j-1)/2 + i; Scr->cmapInfo.cmaps->scoreboard[n] = 1; } else { + fprintf (stderr, + "%s: client illegally changed colormap (i = %d, j = %d\n", + ProgramName, i, j); InstallWindowColormaps(ColormapNotify, (TwmWindow *) NULL); } } *************** *** 1043,1058 **** } } - if (Scr->NoShiftColorFocus && Scr->ColorFocus == Tmp_win && - Tmp_win->next != NULL) - Scr->ColorFocus = Tmp_win->next; - else if (Scr->NoShiftColorFocus && Scr->ColorFocus == Tmp_win && - Tmp_win->prev != NULL) - Scr->ColorFocus = Tmp_win->prev; - else if (!Scr->NoShiftColorFocus || Scr->ColorFocus == Tmp_win) - Scr->ColorFocus = &Scr->TwmRoot; if (Scr->cmapInfo.cmaps == &Tmp_win->cmaps) ! InstallWindowColormaps(DestroyNotify, Scr->ColorFocus); /* * TwmWindows contain the following pointers --- 1046,1053 ---- } } if (Scr->cmapInfo.cmaps == &Tmp_win->cmaps) ! InstallWindowColormaps(DestroyNotify, &Scr->TwmRoot); /* * TwmWindows contain the following pointers *************** *** 1165,1175 **** XMapWindow(dpy, Tmp_win->frame); SetMapStateProp(Tmp_win, NormalState); SetRaiseWindow (Tmp_win); - if (Scr->NoShiftColorFocus) - { - Scr->ColorFocus = Tmp_win; - InstallWindowColormaps(0, Tmp_win); - } break; case IconicState: --- 1160,1165 ---- *************** *** 1799,1805 **** * titlebars are legible */ if (ewp->window == Scr->Root) { ! if (!scanArgs.leaves && !scanArgs.enters && !Scr->NoShiftColorFocus) InstallWindowColormaps(EnterNotify, &Scr->TwmRoot); return; } --- 1789,1795 ---- * titlebars are legible */ if (ewp->window == Scr->Root) { ! if (!scanArgs.leaves && !scanArgs.enters) InstallWindowColormaps(EnterNotify, &Scr->TwmRoot); return; } *************** *** 1836,1843 **** (Tmp_win->list && ewp->window == Tmp_win->list->w)) { if (Tmp_win->hilite_w) /* 1 */ XMapWindow (dpy, Tmp_win->hilite_w); ! if (!scanArgs.leaves && !scanArgs.enters && ! !Scr->NoShiftColorFocus) InstallWindowColormaps (EnterNotify, /* 2 */ &Scr->TwmRoot); SetBorder (Tmp_win, True); /* 3 */ --- 1826,1832 ---- (Tmp_win->list && ewp->window == Tmp_win->list->w)) { if (Tmp_win->hilite_w) /* 1 */ XMapWindow (dpy, Tmp_win->hilite_w); ! if (!scanArgs.leaves && !scanArgs.enters) InstallWindowColormaps (EnterNotify, /* 2 */ &Scr->TwmRoot); SetBorder (Tmp_win, True); /* 3 */ *************** *** 1851,1858 **** * If we are entering the application window, install * its colormap(s). */ ! if ((!scanArgs.leaves || scanArgs.inferior) && ! !Scr->NoShiftColorFocus) InstallWindowColormaps(EnterNotify, Tmp_win); } } /* end if Tmp_win->mapped */ --- 1840,1846 ---- * If we are entering the application window, install * its colormap(s). */ ! if (!scanArgs.leaves || scanArgs.inferior) InstallWindowColormaps(EnterNotify, Tmp_win); } } /* end if Tmp_win->mapped */ *************** *** 1888,1894 **** ActiveItem = NULL; ActiveMenu = mr; MenuDepth--; - UninstallRootColormap(); } return; } --- 1876,1881 ---- *************** *** 1996,2002 **** SetFocus ((TwmWindow *) NULL); Scr->Focus = NULL; } else if (Event.xcrossing.window == Tmp_win->w && ! !scanArgs.enters && !Scr->NoShiftColorFocus) { InstallWindowColormaps (LeaveNotify, &Scr->TwmRoot); } } --- 1983,1989 ---- SetFocus ((TwmWindow *) NULL); Scr->Focus = NULL; } else if (Event.xcrossing.window == Tmp_win->w && ! !scanArgs.enters) { InstallWindowColormaps (LeaveNotify, &Scr->TwmRoot); } } *************** *** 2263,2269 **** */ if (Scr->cmapInfo.root_pushes) return; ! /* Don't reload the current window colormap list. */ if (Scr->cmapInfo.cmaps == &tmp->cmaps) return; --- 2250,2256 ---- */ if (Scr->cmapInfo.root_pushes) return; ! /* Don't reload the currend window colormap list. */ if (Scr->cmapInfo.cmaps == &tmp->cmaps) return; *************** *** 2354,2360 **** * not that of the root window. */ tmp = Scr->cmapInfo.pushed_window; - Scr->ColorFocus = &Scr->TwmRoot; InstallWindowColormaps(0, &Scr->TwmRoot); Scr->cmapInfo.pushed_window = tmp; } --- 2341,2346 ---- *************** *** 2398,2408 **** args = 0; (void) XCheckIfEvent(dpy, &dummy, UninstallRootColormapQScanner, &args); ! if (!args || Scr->NoShiftColorFocus) ! { ! Scr->ColorFocus = Scr->cmapInfo.pushed_window; InstallWindowColormaps(0, Scr->cmapInfo.pushed_window); - } } } --- 2384,2391 ---- args = 0; (void) XCheckIfEvent(dpy, &dummy, UninstallRootColormapQScanner, &args); ! if (!args) InstallWindowColormaps(0, Scr->cmapInfo.pushed_window); } } *** menus.c Fri Mar 16 08:57:56 1990 --- /tuna_b/x11r4/mit/clients/twm/menus.c Tue Mar 6 11:49:05 1990 *************** *** 1,3 **** --- 1,5 ---- + /* @(#) menus.c 1.2@(#) Workstation Software Support 3/6/90 */ + /*****************************************************************************/ /** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ /** Salt Lake City, Utah **/ *************** *** 1062,1070 **** } XUnmapWindow(dpy, tmp->w); tmp->mapped = UNMAPPED; - UninstallRootColormap(); } XFlush(dpy); ActiveMenu = NULL; --- 1064,1072 ---- } XUnmapWindow(dpy, tmp->w); tmp->mapped = UNMAPPED; } + UninstallRootColormap(); XFlush(dpy); ActiveMenu = NULL; *************** *** 1648,1654 **** XUnmapWindow (dpy, Scr->Focus->hilite_w); } - if (!Scr->NoShiftColorFocus) InstallWindowColormaps (0, tmp_win); if (tmp_win->hilite_w) XMapWindow (dpy, tmp_win->hilite_w); SetBorder (tmp_win, True); --- 1650,1655 ---- *************** *** 1659,1671 **** } break; - case F_COLORFOCUS: - if (DeferExecution(context, func, Scr->SelectCursor)) - return; - Scr->ColorFocus = tmp_win; - InstallWindowColormaps (0, tmp_win); - break; - case F_DESTROY: if (DeferExecution(context, func, Scr->DestroyCursor)) return TRUE; --- 1660,1665 ---- *************** *** 2091,2097 **** SetBorder (Scr->Focus, False); if (Scr->Focus->hilite_w) XUnmapWindow (dpy, Scr->Focus->hilite_w); } - if (!Scr->NoShiftColorFocus) InstallWindowColormaps(0, &Scr->TwmRoot); Scr->Focus = NULL; Scr->FocusRoot = TRUE; --- 2085,2090 ---- *************** *** 2173,2183 **** WarpToWindow (tmp_win); tmp_win->icon = FALSE; tmp_win->icon_on = FALSE; - if (Scr->NoShiftColorFocus) - { - Scr->ColorFocus = tmp_win; - InstallWindowColormaps(0, tmp_win); - } } Iconify(tmp_win, def_x, def_y) --- 2166,2171 ---- *************** *** 2271,2286 **** tmp_win->icon_on = TRUE; else tmp_win->icon_on = FALSE; - if (Scr->NoShiftColorFocus && Scr->ColorFocus == tmp_win) - { - if (tmp_win->next != NULL) - Scr->ColorFocus = tmp_win->next; - else if (tmp_win->prev != NULL) - Scr->ColorFocus = tmp_win->prev; - else - Scr->ColorFocus = &Scr->TwmRoot; - InstallWindowColormaps(0, Scr->ColorFocus); - } } static void Identify (t) --- 2259,2264 ---- *************** *** 2489,2498 **** Bool onoroff; { if (tmp->highlight) { ! Pixmap pix = onoroff ? tmp->border : tmp->gray; ! ! XSetWindowBorderPixmap (dpy, tmp->frame, pix); ! if (tmp->title_w) XSetWindowBorderPixmap (dpy, tmp->title_w, pix); } } --- 2467,2482 ---- Bool onoroff; { if (tmp->highlight) { ! if (onoroff) { ! XSetWindowBorder(dpy, tmp->frame, tmp->border); ! if (tmp->title_w) ! XSetWindowBorder(dpy, tmp->title_w, tmp->border); ! } ! else { ! XSetWindowBorderPixmap(dpy, tmp->frame, tmp->gray); ! if (tmp->title_w) ! XSetWindowBorderPixmap(dpy, tmp->title_w, tmp->gray); ! } } } *** parse.c Wed Mar 14 14:15:29 1990 --- /tuna_b/x11r4/mit/clients/twm/parse.c Tue Mar 6 11:49:04 1990 *************** *** 1,3 **** --- 1,5 ---- + /* @(#) parse.c 1.2@(#) Workstation Software Support 3/6/90 */ + /*****************************************************************************/ /** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ /** Salt Lake City, Utah **/ *************** *** 51,57 **** #include "gram.h" #include "parse.h" ! #define SYSTEM_INIT_FILE "/usr/lib/X11/twm/system.twmrc" #define BUF_LEN 300 static FILE *twmrc; --- 53,59 ---- #include "gram.h" #include "parse.h" ! #define SYSTEM_INIT_FILE "/tuna_a/x11r4/lib/twm/system.twmrc" #define BUF_LEN 300 static FILE *twmrc; *************** *** 392,398 **** { "f.bottomzoom", FKEYWORD, F_BOTTOMZOOM }, { "f.circledown", FKEYWORD, F_CIRCLEDOWN }, { "f.circleup", FKEYWORD, F_CIRCLEUP }, - { "f.colorfocus", FKEYWORD, F_COLORFOCUS }, { "f.colormap", FSKEYWORD, F_COLORMAP }, { "f.cut", FSKEYWORD, F_CUT }, { "f.cutfile", FKEYWORD, F_CUTFILE }, --- 394,399 ---- *************** *** 502,508 **** { "noraiseonwarp", KEYWORD, kw0_NoRaiseOnWarp }, { "north", DKEYWORD, D_NORTH }, { "nosaveunders", KEYWORD, kw0_NoSaveUnders }, - { "noshiftcolorfocus", NO_SHIFT_COLOR_FOCUS, 0 }, { "notitle", NO_TITLE, 0 }, { "notitlefocus", KEYWORD, kw0_NoTitleFocus }, { "notitlehighlight", NO_TITLE_HILITE, 0 }, --- 503,508 ---- *** twm.c Wed Mar 14 11:00:47 1990 --- /tuna_b/x11r4/mit/clients/twm/twm.c Mon Dec 18 10:48:36 1989 *************** *** 637,645 **** Scr->DefaultFont.font = NULL; Scr->DefaultFont.name = DEFAULT_FAST_FONT; - Scr->ColorFocus = NULL; - Scr->NoShiftColorFocus = NULL; - } --- 637,642 ---- *** twm.man Mon Mar 19 11:29:50 1990 --- /tuna_b/x11r4/mit/clients/twm/twm.man Fri Dec 22 11:40:46 1989 *************** *** 604,620 **** optional \fIwin-list\fP is given, only those windows will not have titlebars. \fBMakeTitle\fP may be used with this option to force titlebars to be put on specific windows. - .IP "\fBNoShiftColorFocus\fP" 8 - This variable indicates that window colormaps should not be installed in - response to window entry events. When this variable is set, a different - colormap will be installed when a window is mapped, deiconified, if the - \fBf.colorfocus\fP function is invoked on a window that doesn't currently - have the colormap focus, or if the window that currently has the colormap - focus is iconified or destroyed. Additionaly, the root window colormap - will be temporarily installed during window manager functions such as - menu display and window resizing. Setting this variable will eliminate - "technicolor flicker" when the server cannot simultaneously install all of - the different colormaps associated with the currently active windows. .IP "\fBNoTitleFocus\fP" 8 This variable indicates that \fItwm\fP should not set keyboard input focus to each window as it is entered. Normally, \fItwm\fP sets the focus --- 604,609 ---- *************** *** 905,916 **** This function lowers the top-most window that occludes another window. .IP "\fBf.circleup\fP" 8 This function raises the bottom-most window that is occluded by another window. - .IP "\fBf.colorfocus\fP 8 - This function installs the colormaps (obtained from the WM_COLORMAP_WINDOWS - property on the window) when the \fBNoShiftColorFocus\fP variable has been - set. When the \fBNoShiftColorFocus\fP variable has not been set, this function - is not useful, since twm will install a window's colormaps in response to - window entry events. .IP "\fBf.colormap\fP \fIstring\fP" 8 This function rotates the colormaps (obtained from the WM_COLORMAP_WINDOWS property on the window) that \fItwm\fP will display when the pointer --- 894,899 ----