[comp.windows.x.motif] Window manager hints: window group problem

epstein@trwacs.UUCP (Jeremy Epstein) (02/27/91)

We're trying to build an application which has multiple top
level windows, which we're then trying to group together using
the window manager hints.  Our goal is that when we iconify the
"master" window, the other top level window should be iconified
as well.

The first of the following programs creates a top level window and
displays the window ID.  The second program, when given the window
ID from the first as a command line parameter, will create another
top level window with the window_group field of the window manager
hints set to the first window.

We've run these programs under mwm (1.1), twm, and olwm on X11R4
on Sun 3 & Sun 4 systems.  Iconifying the first window does not
iconify the second window.

Is this a misreading of ICCCM, a bug in the programs, or a problem
with the window managers?  If it's a problem with the window managers,
are there any window managers where this works properly?  Is this
anywhere in the FAQ (I couldn't find it)?

Thanks for any help!
--Jeremy

*****START OF PROGRAM #1*****
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <Xm/Xm.h>
#include <Xm/Text.h>
#include <stdio.h>

main(argc, argv)
int argc;
char *argv[];
{
	Widget toplevel, text;
	Arg args[10];
	int n=0;
	Window win_id;
	char string[32];

	toplevel = XtInitialize(argv[0], "Main_window", NULL, 0, &argc, argv);
	text = XtCreateManagedWidget("label", xmTextWidgetClass, toplevel, NULL, 0);
	XtRealizeWidget(toplevel);
	win_id = XtWindow(toplevel);
	sprintf(string, "Window id: %d/0x%x", win_id, win_id);
	XtSetArg(args[n], XmNvalue, string); n++;
	XtSetValues(text, args, n);
	XtMainLoop();
}
*****END OF PROGRAM #1*****

*****START OF PROGRAM #2*****
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xresource.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <Xm/Xm.h>
#include <Xm/Text.h>

main(argc, argv)
int argc;
char *argv[];
{
	Widget toplevel;
	Arg args[10];
	int n=0;
	long flags;
	XID win_id;
	XWMHints *wm_hints;
	
	win_id = atoi(argv[1]);
	toplevel = XtInitialize(argv[0], "Child", NULL, 0, &argc, argv);
	XtCreateManagedWidget("child", xmTextWidgetClass, toplevel, NULL, 0);
	XtRealizeWidget(toplevel);
	wm_hints = XAllocWMHints();
	wm_hints -> flags = WindowGroupHint;
	wm_hints -> window_group = win_id;
	XSetWMHints(XtDisplay(toplevel), XtWindow(toplevel), wm_hints);
	XtMainLoop();
}
*****END OF PROGRAM #2*****
-- 
Jeremy Epstein			UUCP: uunet!trwacs!epstein
Trusted X Research Group	Internet: epstein@trwacs.fp.trw.com
TRW Systems Division		Voice: +1 703/876-8776
Fairfax Virginia