# Is a valid windowid never 0? - Xwindows

This is a discussion on Is a valid windowid never 0? - Xwindows ; It would sure simplify my logic (doing best match for window that most nearly matches certain properties) if I could count on zero not being a valid windowid. -- mailto:rlhamil@smart.net http://www.smart.net/~rlhamil Lasik/PRK theme music: "In the Hall of the Mountain ...

# Thread: Is a valid windowid never 0?

1. ## Is a valid windowid never 0?

It would sure simplify my logic (doing best match for window that
most nearly matches certain properties) if I could count on
zero not being a valid windowid.

--
mailto:rlhamil@smart.net http://www.smart.net/~rlhamil

Lasik/PRK theme music:
"In the Hall of the Mountain King", from "Peer Gynt"

2. ## Re: Is a valid windowid never 0?

Richard.L.Hamilton@mindwarp.smart.net (Richard L. Hamilton) wrote in
news:10m55hjq0jtp774@corp.supernews.com:
> It would sure simplify my logic (doing best match for window that
> most nearly matches certain properties) if I could count on
> zero not being a valid windowid.

0 is never a valid window ID.

Ken Lee, http://www.rahul.net/kenton/

3. ## Re: Is a valid windowid never 0?

Richard L. Hamilton wrote:
>
> It would sure simplify my logic (doing best match for window that
> most nearly matches certain properties) if I could count on
> zero not being a valid windowid.

No window will ever have the ID identified by the symbol "None".
The header file defines None as 0, so yes it is true that
no valid window ID will ever be 0.

4. ## Re: Is a valid windowid never 0?

Richard L. Hamilton wrote:
>It would sure simplify my logic (doing best match for window that
>most nearly matches certain properties) if I could count on
>zero not being a valid windowid.

You can.

The null resource is often specified as "None", which is defined
in X.h as zero, analogous to the use of "NULL" as a zero pointer.

The window ID is an XID, which is the concatenation of three fields:
any two of these fields can be zero, but not all three simultaneously.