How do systems like X11 and Microsoft Windows distinguish between windows and controls?
It seems to me that windows are what controls are placed in.
The following is strictly Windows only.
In Windows, a control is a window with a predetermined function, e.g, edit, combobox, scrollbar, etc, etc. As such, the code that will process the message routed to it is already written (it is identified by the control class name.)
A non-control window, what could be considered a "normal window", is a container that may consist of other windows, such as controls or, non-windowed graphical elements, e.g, lines, curves, etc. A crucial difference between the two is that, the code that processes messages and therefore determines the function of a non-control window must be programmer-written, IOW, it is not mostly (or entirely) "canned code" that can be identified by referring to a pre-existing class name.
All of the above said, OOP libraries, such as those used in Lazarus, can blur the distinction between the two to some extent, making it a bit subjective as to what is a window and what is a control.
HTH.