[comp.sys.sun] Resizing current window

perryc@sun.com (Perry Cross) (01/28/89)

Sorry this is dated, but I fell behind reading.  Someone wanted to resize
his current window programmatically but I only saw the answers, not the
request, hence I'm sending to Sunspots and not the requestor.

	Perry

/*  Program to resize current shelltool to 100 x 100 pixels
    cc <filename> -lsuntool -lsunwindow -lpixrect

    Of course you could just do the following:

	#include <stdio.h>

	static char ESC = '\033';

	main()
	{
        	printf("%c[4;%d;%dt", ESC, 100, 100);
	}

/*
#include <stdio.h>
#include <suntool/sunview.h>
#include <pixrect/pixrect.h>
#include <sunwindow/window_hs.h>
#include <sys/file.h>

main(argc,argv)
int argc;
char *argv[];
{
        Rect this_rect;
        char *this_window = (char *)getenv("WINDOW_ME"), parent[WIN_NAMESIZE];
        int fd;

	/*  WINDOW_ME is the tty, you want the parent */
        fd = open(this_window, O_RDWR);
        win_numbertoname(win_getlink(fd, WL_PARENT), parent); close(fd);
        fd = open(parent, O_RDWR); 
        win_getrect(fd, &this_rect);   
        this_rect.r_width = this_rect.r_height = 100;
        win_setrect(fd, &this_rect);
        close(fd);

        exit(0);
}