Moving a frameless window.

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
Moving a frameless window.

Submitted by Anonymous on Tue, 06/25/2002 - 18:13. Developers
Hi all,

I need to create a frameless window (no decoration) that can be moved around. It seems that a frameless window can only be moved if both new position are different from the original one.

If either the x or y position is the same the frameless window will not move
where as the window with decoration moves correctly.

I have added a small application at the end of this posting.

Thanks in advance for the help.

/* Code starts here */

#include
#include
#include
#include

Display *display; /* xlib id of display */

/* move the window in the x direction by increment of 100 */
void pushed( Widget button, Widget topWidget, XtPointer pNotUsed)
{
static Position x = 0;
static Position y = 200;

XtVaSetValues( topWidget, XmNx, x, XmNy, y, NULL);
x += 100;
}

main(int argc, char *argv[])
{
Widget top_wid, button;
XtAppContext app;
Arg args[4];
Cardinal nRes = 0;

top_wid = XtVaAppInitialize(&app, "testw_top", NULL, 0,
&argc, argv, NULL, NULL);

Widget wTop = top_wid;
Widget wTmp = top_wid;
while ( !XtIsVendorShell(wTop) && (wTmp=XtParent(wTop)) )
wTop = wTmp;

/* Set to FALSE for frameless */
Boolean useFrame = TRUE;

if ( useFrame )
{
XtSetArg(args[nRes], XmNmwmDecorations, MWM_DECOR_BORDER ); nRes++;
}
else
{
XtSetArg(args[nRes], XmNmwmDecorations, 0 ); nRes++;
}
XtSetArg(args[nRes], XmNwidth,300); nRes++;
XtSetArg(args[nRes], XmNheight,300); nRes++;
XtSetArg(args[nRes], XtNoverrideRedirect, 0);nRes++;

XtSetValues( top_wid, args, nRes);

button = XmCreatePushButton( wTop, "Push me to move", NULL, 0);
XtManageChild(button);
XtAddCallback(button, XmNactivateCallback, pushed, wTop);

XtRealizeWidget(top_wid);
XtAppMainLoop(app);
}

Anonymous

I got the exact same problem and could not find any way of fixing it. If you do, please contact me.

Regards,