[comp.windows.x] Sizing of xterm on right mouse button

brooks@maddog.llnl.gov (12/31/88)

In the days of yore and X10 and uwm, the left mouse button gave
you an 80x24 xterm, the center lets the user select an arbitary
size, and the right mouse button gave you an 80x65 xterm.

Now, under uwm or awm, the left button and middle buttons work
correctly, but the right button seems to give you a random window
height.  Does anyone understand this?

I actually discovered the arcanity with a little test program
which I was hoping to get the zoomed window hints to take on the
right mouse button.  Wishful me! I don't care much that xterm has
undesired right button behaviour, but would like to get zoomed
window hints to take on the right mouse button.  Even setting the
initial state to ZoomState using SetWMHints does not get it to come
up in the Zoomed State.  Does anyone know how to get the Zoomed
window hints to take under mouse control?  Are the Zoomed window
hints supported at all.

For anyone interested in playing with this, here is my starter
application, "cc -o try try.c -lX11" will build it.

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

#define XPOS	10
#define YPOS	10
#define XPIXELS	200
#define YPIXELS	200
#define BORDER	1

main(argc, argv)
int argc;
char **argv;
{
	Display *display;
	Window window;
	GC gc;
	int screen;
	XSizeHints hints;
	XSizeHints zhints;
	XWMHints wmhints;

	if((display = XOpenDisplay(NULL)) == NULL) {
		fprintf(stderr, "%s: failed to open display\n");
		exit(1);
	}
	screen = DefaultScreen(display);

	window = XCreateSimpleWindow(display, XRootWindow(display, screen),
		XPOS, YPOS, XPIXELS, YPIXELS, BORDER,
		XWhitePixel(display, screen), XBlackPixel(display, screen));

	fprintf(stderr, "XStoreName returns %d\n", XStoreName(display, window, "try: window"));
	fprintf(stderr, "XSetIconName returns %d\n", XSetIconName(display, window, "try: icon"));
	fprintf(stderr, "XSetCommand returns %d\n", XSetCommand(display, window, argv, argc));
	hints.flags = USSize;
	hints.width = XPIXELS;
	hints.height = YPIXELS;
	fprintf(stderr, "XSetNormalHints returns %d\n", XSetNormalHints(display, window, &hints));
	zhints.flags = USSize;
	zhints.width = XPIXELS * 2;
	zhints.height = YPIXELS * 2;
	fprintf(stderr, "XSetZoomHints returns %d\n", XSetZoomHints(display, window, &zhints));
	wmhints.flags = InputHint | StateHint;
	wmhints.input = True;	/* To get awm to draw the border, uwm does not need this. */
	wmhints.initial_state = DontCareState;
	fprintf(stderr, "XSetWMHints returns %d\n", XSetWMHints(display, window, &wmhints));


	gc = XCreateGC(display, window, 0, 0);
	XSetForeground(display, gc, XWhitePixel(display, screen));
	XSetBackground(display, gc, XBlackPixel(display, screen));

	XMapWindow(display, window);
	XClearWindow(display, window);
	XFlush(display);


	printf("hit [ret] when ready to draw:");
	getchar();
	XDrawRectangle(display, window, gc, 10, 10, 10, 10);
	XFlush(display);

	printf("hit [ret] when ready to terminate:");
	getchar();

	XDestroyWindow(display, window);
	XFlush(display);
	XCloseDisplay(display);
}

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (01/03/89)

    In the days of yore and X10 and uwm, the left mouse button gave
    you an 80x24 xterm, the center lets the user select an arbitary
    size, and the right mouse button gave you an 80x65 xterm.

Correct semantics (as I recall) for the right button only for a certain
font size.  The right button gave you a "full screen height" window,
which happened to be 65 lines for the default font.

    Now, under uwm or awm, the left button and middle buttons work
    correctly, but the right button seems to give you a random window
    height.  Does anyone understand this?

As I recall, another magic option somewhere in X10 was whether or not
to clip to the screen for right button.  The X11 uwm has the latter
behaviour.

    Are the Zoomed window hints supported at all.

No.