_NET_ACTIVE_WINDOW
The root-window property that names the active window, and the message that lets a taskbar or an application ask for it to change — with a field that reveals who asked.
Before EWMH, X had no notion of an "active window", only keyboard focus, and any client could move that with XSetInputFocus. It was not enough: the window might sit on another virtual desktop, be iconified or lie buried under three others, and focus in an invisible window is not what anyone means by active. So EWMH put _NET_ACTIVE_WINDOW on the root window, set by the window manager and holding the ID of the window it considers active, or None if there is none. Taskbars highlight their button from it, and xdotool getactivewindow simply reads it out.
In the other direction goes a ClientMessage of the same type to the root window: make this window active. The window manager then switches desktop, deiconifies, raises and focuses — or declines. Since version 1.3 the message carries a source indication: 1 means the application itself is asking, 2 that a pager or taskbar is acting on the user's behalf, and 0 that the sender is old and knows no better. Together with the timestamp in the next field, that is the raw material for focus stealing prevention: a click in the panel goes through, an application that wants to jump in mid-sentence gets to blink instead. wmctrl -a and xdotool windowactivate send exactly this message, which is what separates them from windowfocus, which just sets focus and leaves the rest to chance.