Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!stan!marvin!toml From: toml@marvin.Solbourne.COM (Tom LaStrange) Newsgroups: comp.windows.x.motif Subject: Re: What is the best way to iconify/deiconify? Message-ID: Date: 8 May 91 14:14:32 GMT References: <9105071922.AA15644@15644> <9105081533.AA19820@osfsun> Sender: toml@solbourne.com (Tom LaStrange) Distribution: inet Organization: Solbourne Computer, Inc. Lines: 49 In-Reply-To: wwang@osf.org's message of 8 May 91 08:33:45 GMT |> Jerry: |> Here are the code segments: |> |> /* check the window state, call it when you get a PropertyNotify event */ |> void checkState(w, cd, event) |> Widget w; |> char *cd; |> XPropertyEvent *event; |> { |> Arg args[1]; |> Boolean iconic; |> Atom actual_type, atom; |> int actual_format; |> unsigned long nitems, bytes_after; |> unsigned char *data; |> long *state; |> |> atom = XInternAtom(display, "WM_STATE", False); |> |> XGetWindowProperty(display, window, atom, |> 0L, 1L, False, AnyPropertyType, &actual_type, |> &actual_format, &nitems, &bytes_after, &data); |> |> printf("actual_type: %s, actual_format: %d, nitems: %d, bytes_after: %d\n", |> XGetAtomName(dpy, actual_type), actual_format, nitems, bytes_after); |> |> state = (long *)data; |> if (*state == NormalState) printf("NormalState\n"); |> if (*state == IconicState) printf("IconicState\n"); |> if (*state == WithdrawnState) printf("WithdrawnState\n"); |> |> free(date); |> return; |> } This is not a safe thing to do and the ICCCM kind of frowns on it. Section 4.1.3.1 WM_STATE "In general, clients should not need to examine the contents of this property; it is intended for communication between window and session managers." What if the window changes state between the time you you get the property and return it? You should watch for and keep track of MapNotify and UnmapNotify events if you want to track your current state. -- (I kid you not)Tom LaStrange toml@Solbourne.COM