[comp.windows.x] xterm - icons can disappear off screen ...

jmsellens@watmath.waterloo.edu.UUCP (02/26/87)

If you have a non-active icon at the left side of your screen, and you
change the title of the window to a shorter one, the icon may disappear
off the screen since the upper left corner stays in the same place, and
the icon shrinks.  This is what I did to misc.c around line 866:

#ifdef waterloo
	if (screen->iconVwin.window) {
	    WindowInfo info;
	    int x, y;
	    XChangeWindow( screen->iconVwin.window, screen->iconVwin.width,
			   screen->iconVwin.height );
	    /* make sure that the icon hasn't shifted completely off sceen */
	    if ( XQueryWindow( screen->iconVwin.window, &info ) )
		if ( info.x + info.width < 10 || info.y + info.height < 10 ) {
		    x =  info.x+info.width<10 ? 10 - info.width : info.x;
		    y =  info.y+info.height<10 ? 10 - info.height : info.y;
		    XMoveWindow( screen->iconVwin.window, x, y );
		}
	}
#else
	if (screen->iconVwin.window)
	    XChangeWindow( screen->iconVwin.window, screen->iconVwin.width,
			   screen->iconVwin.height );
#endif

	if (screen->iconTwin.window) {
#ifdef waterloo
	    WindowInfo info;
	    int x, y;
	    screen->iconTwin.width = screen->iconVwin.width;
	    screen->iconTwin.height = screen->iconVwin.height;
	    XChangeWindow( screen->iconTwin.window, screen->iconTwin.width,
			   screen->iconTwin.height );
	    /* make sure that the icon hasn't shifted completely off sceen */
	    if ( XQueryWindow( screen->iconTwin.window, &info ) )
		if ( info.x + info.width < 10 || info.y + info.height < 10 ) {
		    x =  info.x+info.width<10 ? 10 - info.width : info.x;
		    y =  info.y+info.height<10 ? 10 - info.height : info.y;
		    XMoveWindow( screen->iconTwin.window, x, y );
		}
#else
	    screen->iconTwin.width = screen->iconVwin.width;
	    screen->iconTwin.height = screen->iconVwin.height;
	    XChangeWindow( screen->iconTwin.window, screen->iconTwin.width,
			   screen->iconTwin.height );
#endif