toml@marvin.Solbourne.COM (Tom LaStrange) (05/31/91)
Oh combined wisdom of the net, please solve my problem... For the sake of simplicity, let's assume that the window manager will NOT iconify my window when it is mapped. Say I have a top-level window that has the input focus. I want to map another top-level window and set input focus to it. I want to do something like this: MapTheWindow(window); SetTheFocus(window); I do not want MapTheWindow to return until I can set input focus to the window, it and all of it's ancestors must be mapped. MapTheWindow cannot simply wait for a MapNotify event because the window manager may map the client window and then sometime later map its frame. In between, input focus cannot be set because an ancestor of the window is unmapped. MapTheWindow cannot wait for a VisibilityNotify event because the window may be completely obscured. It cannot wait for Expose events for the same reason. What I really want is an event that tracks the state of the map_state member of the XWindowAttributes structure. I hope I've overlooked something. Can you solve this problem? Thanks, (I kid you not)Tom LaStrange toml@Solbourne.COM
msm@src.dec.com (Mark S. Manasse) (05/31/91)
Just so. That's why in our paper about X we observe that window managers should be required to either grab the server around the map calls, or map the windows in the other order. Mark
mayoff@cs.utexas.edu (Robert Mayoff) (06/04/91)
In article <TOML.91May30152355@marvin.Solbourne.COM> toml@marvin.Solbourne.COM (Tom LaStrange) writes: >Say I have a top-level window that has the input focus. I want to map >another top-level window and set input focus to it. I want to do something >like this: > MapTheWindow(window); > SetTheFocus(window); >I do not want MapTheWindow to return until I can set input focus to the >window, it and all of it's ancestors must be mapped. MapTheWindow cannot >simply wait for a MapNotify event because the window manager may map the >client window and then sometime later map its frame. In between, input focus >cannot be set because an ancestor of the window is unmapped. MapTheWindow >cannot wait for a VisibilityNotify event because the window may be >completely obscured. It cannot wait for Expose events for the same reason. > >What I really want is an event that tracks the state of the map_state member >of the XWindowAttributes structure. You *CAN* wait for VisibilityNotify. To quote Scheifler, Gettys, & Newman, "X Window System C Library and Protocol Reference": When a window changes state from partially or fully obscured or not viewable to viewable and completely unobscured, an event with "Unobscured" is generated. When a window changes state from viewable and completely unobscured or not viewable, to viewable and partially obscured, an event with "PartiallyObscured" is generated. When a window changes state from viewable and completely unobscured, from viewable and partially obscured, or from not viewable to viewable and fully obscured, an event with "FullyObscured" is generated. So, whenever a window and all its ancestors become mapped, so that it is viewable, a VisibilityNotify is generated on that window. A detail indicates just "how visible" the window is, but you don't seem to be interested in that. Hence, you need simply to use the VisibilityChangeMask in your event mask, and call XSetInputFocus whenever you get a VisibilityNotify event. -- /_ rob <mayoff@cs.utexas.edu> /_ Fun things to do with UNIX (#118 in a series): / tail -f super.grow | cat /etc/motd - >> super.grow
toml@marvin.Solbourne.COM (Tom LaStrange) (06/07/91)
> >Say I have a top-level window that has the input focus. I want to map > >another top-level window and set input focus to it. I want to do something > >like this: > > MapTheWindow(window); > > SetTheFocus(window); > >I do not want MapTheWindow to return until I can set input focus to the > >window, it and all of it's ancestors must be mapped. MapTheWindow cannot > >simply wait for a MapNotify event because the window manager may map the > >client window and then sometime later map its frame. In between, input focus > >cannot be set because an ancestor of the window is unmapped. MapTheWindow > >cannot wait for a VisibilityNotify event because the window may be > >completely obscured. It cannot wait for Expose events for the same reason. > > > >What I really want is an event that tracks the state of the map_state member > >of the XWindowAttributes structure. > > You *CAN* wait for VisibilityNotify. To quote Scheifler, Gettys, & > Newman, "X Window System C Library and Protocol Reference": > > When a window changes state from partially or fully obscured or not > viewable to viewable and completely unobscured, an event with > "Unobscured" is generated. When a window changes state from viewable > and completely unobscured or not viewable, to viewable and partially > obscured, an event with "PartiallyObscured" is generated. When a > window changes state from viewable and completely unobscured, from > viewable and partially obscured, or from not viewable to viewable and > fully obscured, an event with "FullyObscured" is generated. > > So, whenever a window and all its ancestors become mapped, so that it > is viewable, a VisibilityNotify is generated on that window. A detail > indicates just "how visible" the window is, but you don't seem to be > interested in that. Hence, you need simply to use the > VisibilityChangeMask in your event mask, and call XSetInputFocus > whenever you get a VisibilityNotify event. I have the case where the window starts out not visible, gets mapped and is still not visible because it is completely obscured. No VisibilityNotify events are generated. -- (I kid you not)Tom LaStrange toml@Solbourne.COM
toml@marvin.Solbourne.COM (Tom LaStrange) (06/07/91)
A bunch of stuff about mapping windows and VisibilityNotify events deleted. > I have the case where the window starts out not visible, gets mapped and > is still not visible because it is completely obscured. No VisibilityNotify > events are generated. I was wrong, this does work properly under MIT X11R4. It appears that the two servers I have on my desk from different manufacturers don't handle this properly. Sorry for the wasted bandwidth. -- (I kid you not)Tom LaStrange toml@Solbourne.COM
rws@expo.lcs.mit.EDU (Bob Scheifler) (06/07/91)
I have the case where the window starts out not visible, gets mapped and is still not visible because it is completely obscured. No VisibilityNotify events are generated. Bug in your server then (seems to work in mine).
toml@solbourne.COM (06/07/91)
> I have the case where the window starts out not visible, gets mapped and > is still not visible because it is completely obscured. No VisibilityNot ify > events are generated. > Bug in your server then (seems to work in mine). OK, seems to work fine under X11R4. Both the servers I have on my desk appear to be broken. Thanks.