[comp.windows.x] olwm problem with XSetSizeHints and XSetNormalHints

tl@censun1.UUCP (SSUID Tin Li) (10/27/89)

 obtained olwm from expo and used on a SUN 3/160 with MIT X11R3
server.  I tried to move the toplevel window using XMoveWindow
and XSetSizeHints but olwm would not let me.  The same code had
no problem if I used mwm, twm, or uwm.  I wonder if anyone had
encountered similar problems.  The test program first creates a
HP form widget with a button in it.  When I click on the button,
the whole window should reposition to 300,300 but olwm just
repaint the window and does not move it.
Here is the test program

---- test program begin ------
#include <stdio.h>
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include "Xw.h"
#include "Form.h"
#include "PButton.h"
#include <X11/Xatom.h>

Widget toplevel, buttonwidget, formwidget;
/*
 * button callback function
 */
void buttonselected (w, client_data, call_data)
Widget w;
caddr_t client_data;
caddr_t call_data;
{
    XSizeHints *hints;
    printf ("Button CallBack Selected\n" );
    XMoveWindow( XtDisplay(toplevel), XtWindow(toplevel),300,300);
    hints = (XSizeHints *)XtMalloc(sizeof(XSizeHints));
    hints->x = 300; hints->y=300;
    hints->flags = PPosition|USPosition;
    XSetSizeHints( XtDisplay(toplevel), XtWindow(toplevel),
                                hints , XA_WM_SIZE_HINTS);
    XtFree(hints);
}
/*
 * main program
 */
void main (argc, argv)
unsigned int argc;
char **argv;
{
    Cardinal i;
    Arg arglist[20];
    XSizeHints *hints;
    static XtCallbackRec buttonselectcallbacks[] = {

                                        { buttonselected, NULL },
                                        { NULL, NULL },
                                        };
    toplevel = XtInitialize ("main", "DEmo", NULL, NULL, &argc, argv);
    XtSetArg(arglist[0], XtNx, 100); /* set initial shell size */
    XtSetArg(arglist[1], XtNy, 600);
    XtSetValues ( toplevel, arglist, 2);
    XtSetMappedWhenManaged(toplevel, FALSE);
    formwidget = XtCreateManagedWidget ("test", XwformWidgetClass,
                                                toplevel, NULL, NULL);
    i = 0;                           /* create a button */
    XtSetArg (arglist[i], XtNlabel, "LABEL"); i++;
    XtSetArg(arglist[i], XtNselect, buttonselectcallbacks);i++;
    XtSetArg(arglist[i], XtNwidth, 100);i++;
    XtSetArg(arglist[i], XtNheight, 100);i++;
    buttonwidget = XtCreateManagedWidget ("dialog", XwpushButtonWidgetClass,
                                                formwidget, arglist, i);
    XtRealizeWidget (toplevel);
    hints = (XSizeHints *)XtMalloc(sizeof(XSizeHints));
    hints->x = 100; hints->y = 600;     /* tell wm initial size and position */
    hints->width=100; hints->height=100;
    hints->flags = PPosition|PSize|USPosition|USSize;
    XSetStandardProperties(XtDisplay(toplevel), XtWindow(toplevel), "panelname",
                           "iconname",None,NULL,0,hints );
    XtFree((void *)hints);
    XtMapWidget(toplevel);
    XtMainLoop ();
}
---- test program  end ------


Also is there a easy way to find out the height of the title bar that
decorated a window?


Thanks in advance!





Tin P. Li
internet:  tl@cen.com                           Century Computing Inc
uucp:      uunet!censun1!tl                     1014 West St.
                                                Laurel, MD, 20707