engel@servix.irisa.fr (Jean Christophe Engel) (05/26/89)
I have written a simple application that draws line segments in a window using *only* Xlib and not the XToolKit. When a user changes the size of the window with his favorite Window Manager, I want to adjust the size of the graphics to the new size of the window. XSelectInput(dpy, win, ExposureMask | ResizeRedirectMask) in order to enable my program to be notified when either a "Expose" or "Resize" event occurs. 2. To get the *new* dimensions of the window. I thought that a call to XGetWindowAttributes(dpy, win, &win_att) would do the job. The XWindowAttributes win_att structure indeed contains info about the window, but the width and height correspond to the *initial* size of the window, and *not* the new one. Did I miss something, or what's wrong with the way I do ? PS: Btw, I created the window with: win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 100, 100, dimx, dimy, 2, /*--- Border width ---*/ BlackPixel(dpy, 0), WhitePixel(dpy, 0)); Thanx for any reply ... -------------------------------------------------------------------------- | Jean-Christophe Engel (Equipe TEMIS) Phone: +33 99 36 20 00 | | IRISA Fax: 99 38 38 32 | | Campus Universitaire de Beaulieu Telex: UNIRISA 950 473F | | 35042 RENNES Cedex - FRANCE E-mail: engel@irisa.fr | --------------------------------------------------------------------------
rws@EXPO.LCS.MIT.EDU (05/27/89)
XSelectInput(dpy, win, ExposureMask | ResizeRedirectMask) You want StructureNotifyMask, not ResizeRedirectMask. Selecting for ResizeRedirectMask will tend to prevent the WM from resizing your window, unless your program handles the negotiation. To get the new dimensions, you should track the ConfigureNotify events that arrive.
klee@chico.pa.dec.com (Ken Lee) (05/27/89)
> When a user changes the size of the window with his favorite Window Manager, > I want to adjust the size of the graphics to the new size of the window. > XSelectInput(dpy, win, ExposureMask | ResizeRedirectMask) To get ConfigureNotify events (including resize), use the StructureNotifyMask. The ResizeRedirectMask is for window managers that want to redirect resize requests. After you receive the event, a XGetWindowAttributes or XGetGeometry request should give you the correct window size. Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. klee@decwrl.dec.com