window location and size changes event

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

Questions about motif? Contact us

2 posts / 0 new
Last post
window location and size changes event

 

window location and size changes

event
Submitted by orank on Mon, 03/24/2003 - 16:33.

Hi ,
I would like to store the real location and size of my main window at all times. So that when I exit the application I will save the location and size and then I will be able to reopen the main window at the same place the next time I open the application.
Is there an X event that gets activated when I change the window position and size ?
Thanks in advance
oran

 

Wed, 03/26/2003 - 01:54#1

Wed, 03/26/2003 - 01:54#1

ICS_support

window location and size changes event

Like so much in X, the answer is "Yes, but...". That is, you get that information via X events (see XConfigureEvent), which contains the x/y/width/height of the window. However, the window manager interposes itself in the process; you get the rewritten values, after any window manager offsets. And the window manager may then interpret your values with its own titlebar or other decorations in the way.

So you can more or less get the values that you`re looking for. But how to save them? Well, you really want a session manager to be used. But development of session managers stalled around the time of X11R5 and Motif 2.0. The next-best thing is to save the values before you exit in a file; the file-system survives shutdowns of the program and the X server. Originally, the application defaults file located in the user`s ~/app-defaults/ directory was considered program-writable. This file would ordinarily be used by Xt when the program starts up; Xt constructs a resource database which can include the top-level window`s geometry. But the practice was never made wide-spread enough. The result has been that applications write invisible files in the user`s home directory, such as ".twmrc". You`d then need to have your application either merge in this file, if it is in resource-database format, or to simply read the values and use those values when creating the top-level shell for your application.