Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!ucsd!ucbvax!parc.xerox.com!janssen From: janssen@parc.xerox.com (Bill Janssen) Newsgroups: comp.soft-sys.andrew Subject: Re: easy suggestion for EZ Message-ID: <0bd=4hwB0KGW46ohNv@holmes.parc.xerox.com> Date: 28 Jan 91 23:18:05 GMT References: Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 138 Excerpts from ext.andrew: 28-Jan-91 Re: easy suggestion for EZ Gary Keim@andrew.cmu.edu (1346+0) > What does the user community think about this issue? Is a new > preference called for? *.ShortIconNames: YES I've modified my xim so that it controls both titles (which I like to be as long as possible) and icons (which I like short) more precisely. The preference MaxTitleLength is either the max number of chars to put in the title line, or -1 if no max is desired (as long as possible). Same for MaxIconLabelLength. Finally, it is per-application selectable whether to use the name of the application in the title line, via UseProgramNameInTitle. Here's an excerpt from my preferences file: typescript.MaxIconLabelLength: 20 typescript.MaxTitleLength: -1 typescript.UseProgramNameInTitle: yes ez.MaxIconLabelLength: 20 ez.MaxTitleLength: -1 ez.UseProgramNameInTitle: no Here's my version of SetWMProperties (from xim.c): static void SetWMProperties(self, nameChanged) struct xim *self; boolean nameChanged; { Window leader = self->groupLeader; Display *display = xim2display(self); Window window = xim2window(self); char *WMName, *iconname; int lengthName; int lengthTitle; int lengthWMName; char *name = im_GetProgramName(); char *title = xim_GetTitle(self); XWMHints *wmhints, *hints, myhints; if (nameChanged) { XClassHint programClass; programClass.res_name = name; programClass.res_class = "atk"; XSetClassHint(display, window, &programClass); } if (useProgramNameInTitle && name != NULL) lengthName = strlen(name); else lengthName = 0; if (title != NULL) lengthTitle = strlen(title); else lengthTitle = 0; if (titleMaxLength > 0 && lengthTitle > titleMaxLength) lengthTitle = titleMaxLength; WMName = (char *) malloc (lengthName + lengthTitle + 2); bcopy(name, WMName, lengthName); WMName[lengthName] = ' '; bcopy(title, WMName + lengthName + 1, lengthTitle); WMName[lengthWMName = lengthName + 1 + lengthTitle] = (char) 0; XStoreName(display, window, useProgramNameInTitle ? WMName : WMName + lengthName + 1); if (iconMaxLength > 0 && lengthWMName > iconMaxLength) { WMName[lengthWMName - iconMaxLength] = '.'; WMName[lengthWMName - iconMaxLength + 1] = '.'; iconname = WMName + lengthWMName - iconMaxLength; } else iconname = WMName; XSetIconName(display, window, iconname); if ((wmhints = XGetWMHints (display, window)) == NULL) { hints = &myhints; hints->flags = 0; } else hints = wmhints; hints->flags |= StateHint; /* try to make expose work -wjh */ hints->initial_state = NormalState; hints->flags |= InputHint; hints->input = TRUE; if (leader != 0) { hints->window_group = leader; hints->flags |= WindowGroupHint; } XSetWMHints(display, window, hints); if (wmhints != NULL) XFree (wmhints); if (leader != 0) { int argc; char **argv; if (nameChanged) { char buf[500]; sprintf (buf, "Andrew window-group leader for %s (process %d)", name, getpid()); XStoreName(display, leader, buf); buf[0] = (char) 0; gethostname(buf, sizeof(buf)); XChangeProperty(display, leader, XA_WM_CLIENT_MACHINE, XA_STRING, 8, PropModeReplace, buf, strlen(buf)); }; argv = application_GetRestartArgs(&argc); XSetCommand (display, leader, argv, argc); } } There is code in xim__InitializeClass to actually read the preferences: iconMaxLength = environ_GetProfileInt ("MaxIconLabelLength", 10); titleMaxLength = environ_GetProfileInt ("MaxTitleLength", -1); useProgramNameInTitle = environ_GetProfileSwitch("UseProgramNameInTitle", FALSE); Note also that my xim struct has a slot for window group leader, and that I put all windows from a particular process in a single window group, on which I place the appropropriate X11 ICCCM properties for restart. Now to go in and take that code out of typescript that limits the title length... Bill