Path: utzoo!attcan!uunet!husc6!cs.utexas.edu!ut-emx!clyde From: clyde@ut-emx.UUCP (Head UNIX Hacquer) Newsgroups: comp.windows.x Subject: Modifications to twm Keywords: Add default icon placement to twm Message-ID: <9093@ut-emx.UUCP> Date: 28 Dec 88 23:58:49 GMT Organization: Moose & Squirrel Software Lines: 202 I got tired of having my xman icons pop up in the upper left hand corner of my screen, so I made some changes to twm to specify default icon geometries. Actually, I'm tired of clients which don't do window manager hints, but these fixes take care of it. The diffs are fairly small (~200 lines), so I'm putting them in this message. Based upon the version of twm distributed in the X11R3 contrib tree. ----------------- cut here ----------------------- *** events.c.orig Wed Dec 28 17:40:24 1988 --- events.c Wed Dec 28 17:42:52 1988 *************** *** 638,641 **** --- 638,642 ---- XSizeHints hints; int zoom_save; + int x, y; #ifdef DEBUG *************** *** 672,695 **** if (tmp_win->wmhints->flags & IconPositionHint) { - int x, y; - x = tmp_win->wmhints->icon_x; y = tmp_win->wmhints->icon_y; - - if (x > MyDisplayWidth) - x = MyDisplayWidth - tmp_win->icon_w_width - - (2 * BorderWidth); - - if (y > MyDisplayHeight) - y = MyDisplayHeight - tmp_win->icon_height - - IconFont.height - 4 - (2 * BorderWidth); - - - XMoveWindow(dpy, tmp_win->icon_w, x, y); } else { ! XMoveWindow(dpy, tmp_win->icon_w, 0, 0); } tmp_win->iconified = TRUE; --- 673,707 ---- if (tmp_win->wmhints->flags & IconPositionHint) { x = tmp_win->wmhints->icon_x; y = tmp_win->wmhints->icon_y; } else { ! char *ico; ! ! x = y = 0; ! ico = (char *)LookInNameList(ICON_GEOMETRY, ! tmp_win->icon_name); ! if (ico != NULL) ! { ! int i, junk; ! ! i = XParseGeometry(ico, &x, &y, &junk, &junk); ! if ((i & XValue) == 0) ! x = 0; ! if ((i & YValue) == 0) ! y = 0; ! } } + + if (x > MyDisplayWidth) + x = MyDisplayWidth - tmp_win->icon_w_width - + (2 * BorderWidth); + + if (y > MyDisplayHeight) + y = MyDisplayHeight - tmp_win->icon_height - + IconFont.height - 4 - (2 * BorderWidth); + + XMoveWindow(dpy, tmp_win->icon_w, x, y); tmp_win->iconified = TRUE; *** gram.y.orig Wed Dec 28 17:40:32 1988 --- gram.y Wed Dec 28 17:43:28 1988 *************** *** 80,84 **** %token ICONIFY_BY_UNMAPPING DONT_ICONIFY_BY_UNMAPPING %token WARPCURSOR NUMBER BORDERWIDTH TITLE_FONT REVERSE_VIDEO ! %token RESIZE_FONT NO_TITLE AUTO_RAISE FORCE_ICON NO_HILITE %token MENU_FONT ICON_FONT UNKNOWN_ICON ICONS ICON_DIRECTORY %token META SHIFT CONTROL WINDOW TITLE ICON ROOT FRAME --- 80,84 ---- %token ICONIFY_BY_UNMAPPING DONT_ICONIFY_BY_UNMAPPING %token WARPCURSOR NUMBER BORDERWIDTH TITLE_FONT REVERSE_VIDEO ! %token RESIZE_FONT NO_TITLE AUTO_RAISE FORCE_ICON NO_HILITE ICON_GEOMETRY %token MENU_FONT ICON_FONT UNKNOWN_ICON ICONS ICON_DIRECTORY %token META SHIFT CONTROL WINDOW TITLE ICON ROOT FRAME *************** *** 235,238 **** --- 235,240 ---- | MONOCHROME { color = MONOCHROME; } color_list + | ICON_GEOMETRY { list = ICON_GEOMETRY; } + geometry_list | DEFAULT_FUNCTION action { DefaultFunction.func = $2; if ($2 == F_MENU) *************** *** 337,340 **** --- 339,352 ---- win_entry : string { if (FirstTime) AddToList(list, $1, 0); } + ; + + geometry_list : LB geometry_entries RB + ; + + geometry_entries : /* Empty */ + | geometry_entries geometry_entry + ; + + geometry_entry : string string { if (FirstTime) AddToList(list, $1, $2); } ; *** lex.l.orig Wed Dec 28 17:40:41 1988 --- lex.l Wed Dec 28 17:43:38 1988 *************** *** 184,187 **** --- 184,188 ---- [Nn][Oo][Ss][Aa][Vv][Ee][Uu][Nn][Dd][Ee][Rr] { return NO_SAVEUNDER; } [Rr][Aa][Nn][Dd][Oo][Mm][Pp][Ll][Aa][Cc][Ee][Mm][Ee][Nn][Tt] { return RANDOM_PLACEMENT; } + [Ii][Cc][Oo][Nn][Gg][Ee][Oo][Mm][Ee][Tt][Rr][Yy] { return (ICON_GEOMETRY); } {qstring} { yylval.ptr = yytext; return STRING; } {number} { (void)sscanf(yytext, "%d", &yylval.num); *** list.c.orig Wed Dec 28 17:40:49 1988 --- list.c Wed Dec 28 17:43:56 1988 *************** *** 56,59 **** --- 56,60 ---- name_list *AutoRaise = NULL; /* list of window names to auto-raise */ name_list *Icons = NULL; /* list of window names and icons */ + name_list *IconGeometries = NULL; /* list of window names and icons */ name_list *NoHighlight = NULL; /* list of windows no to highlight */ name_list *DontIconify = NULL; /* don't iconify by unmapping */ *************** *** 133,136 **** --- 134,143 ---- DontIconify = nptr; break; + + case ICON_GEOMETRY: + nptr->next = IconGeometries; + nptr->ptr = ptr; + IconGeometries = nptr; + break; } } *************** *** 182,185 **** --- 189,196 ---- case ICONS: l = Icons; + break; + + case ICON_GEOMETRY: + l = IconGeometries; break; *** twm.man.orig Wed Dec 28 17:40:58 1988 --- twm.man Wed Dec 28 17:44:14 1988 *************** *** 203,206 **** --- 203,227 ---- in conjunction with the \fBDontIconifyByUnmapping\fP list. The default is to iconify by unmapping the window and mapping a seperate icon window. + .IP "\fBIconGeometry\fP { \fIlist\fP }" 20 + This variable is a list of window names and default icon geometries. + For example: + .EX 0 + \fBIconGeometry\fP + { + "xman" "0x0+100+150" + "xload" "0x0+700+100" + } + .EE + The names "xman" and "xload" are added to a list that is searched + when the client window is reparented by \fItwm\fP. + This list is searched only if the client does not provide a window manager + hint for icon positioning (e.g. xman, xmh). + The + .I icon + names specified are just the first portion of the name to match. In the + above example, "xman" would match "xman_SunOS" and also "xman blob". + The client + .I icon + names are checked against those specified in this list. .IP "\fBIconManagerDontShow\fP { \fIlist\fP }" 20 This variable is a list of window names that will not be displayed -- Shouter-To-Dead-Parrots @ Univ. of Texas Computation Center; Austin, Texas clyde@emx.utexas.edu; ...!cs.utexas.edu!ut-emx!clyde "You really have to take a broad perspective when giving pat answers to other people's problems." - Eyebeam