Main window location without decoration

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

Questions about motif? Contact us

2 posts / 0 new
Last post
Main window location without decoration

Submitted by Anonymous (not verified) on

Fri, 06/15/2012 - 12:07

Is there a way to get the x and y coordinates of a window without window decorations? Or is there a way to get the width and height of the window decorations?
I would like to save the position of the main window to a file when a program is exited and then load the values when that program is started. However there is a slight difference in the values (which I believe is due to the window border and title bar) which causes the window to move over slightly every time the application is started.
‹ Nedit as a widget? Scroll a "text area" ›

 

Fri, 03/09/2007 - 12:52#1

Fri, 03/09/2007 - 12:52#1

Submitted by yahubat on

Mon, 07/16/2012 - 13:15

Fri, 03/09/2007 - 12:52#1

Yuriy Syrota

Main window location without decoration

I wonder how do you get coordinates of main widnow. The following program that reads coordinates of tolvele and then set them works correctly in my Window Manager (metacity). Try it in your envronment.

#include <Xm/XmAll.h></p>
<p>Widget toplevel;</p>
<p>void<br />
buttonCb(Widget w, XtPointer app, XtPointer c)<br />
{<br />
int x=0,y=0;<br />
XtVaGetValues(toplevel, XmNx, &x, XmNy, &y, NULL);<br />
fprintf(stderr, "x: %d, y: %d\n", x, y); //rasta<br />
XtVaSetValues(toplevel, XmNx, x, XmNy, y, NULL);<br />
}</p>
<p>int<br />
main(int argc, char **argv)<br />
{<br />
Widget button;<br />
XtAppContext app;<br />
XmContainerWidget contw;<br />
XmStringTable tmp;</p>
<p> toplevel = XtVaAppInitialize(&app, "XOpSysConf",<br />
NULL, 0, &argc, argv, NULL, NULL);<br />
button =<br />
XtVaCreateManagedWidget("button", xmPushButtonWidgetClass, toplevel,<br />
NULL);<br />
XtAddCallback(button, XmNactivateCallback, buttonCb, &app);<br />
XtManageChild(button);</p>
<p> XtRealizeWidget(toplevel);<br />
XtAppMainLoop(app);<br />
return 0;<br />
}<br />