[comp.windows.x] Stalking the Wild ConfigureRequest Monster

mouse@SHAMASH.MCRCIM.MCGILL.EDU (der Mouse) (08/19/90)

> I want to be able to position my window at byte boundaries.

You probably mean at a multiple of 8 pixels from somewhere.  (This does
not necessarily have anything to do with bytes.)

> However, the window manager doesn't always comply with my request for
> XMoveWindow.

If the window manager doesn't want your window to go there, your only
alternatives are to make it an override-redirect window or switch
window managers.

> Hence, I need to trap any ConfigRequest and if its a reposition
> request, I need to position the window at the nearest 8-bit boundary.
> However, I want to take over the window only when a reposition
> request is obtained.  And leave it to the WM at other times.

Trying to second-guess the window manager is a dangerous and usually
antisocial business.  Why do you think your window should always be on
an "8-bit" boundary?  You may be trying to solve a problem the wrong
way.  (Fairly often, in my experience, someone asks "how do I do
<foo>?" when they really want to do <bar> instead, and have mistakenly
decided that the only way to get <bar> is by doing <foo>.)

> Am doing the following :

>    1. Select input with the SubstructureRedirectMask on the top level
>       window of my application.

Not what you want to do.  Or at least, not related to the problem you
described above.

>    2. Turn the override_redirect flag False (thats what the Xlib
>       manual says I shud do).

>    3. And then wait for the event.

>    4. After obtaining the event :

>       i) Turn the overridde_redirect flag of the window True.
>      ii) Configure the Window by XConfigureWindow().
>     iii) Turn the override_redirect flag False.

It's not clear to me what event you're expecting to get in step 3.  You
can do (4i) through (4iii), and the window should move OK, but there
are problems with this.  One is that if you're using a reparenting
window manager, this method will move the window only within the window
manager's parent window.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu