Creating a window manager from scratch is a daunting task. You really should know what you want to achieve. If only curiosity is involved, then rather start out by examining the source code for twm, fluxbox or even WindowMaker. You could also start with Gnome or KDE, but these are extremely complex. Another option would be to get your hands on some old Macintosh or trying to install BeOS or Haiku (a re-coded BeOS) to get a feeling how GUI desktops can be done differently with a minimum of system resources (when compared to recent PC's). The old Inside Apple Macintosh developer books are available as PDF files online, have a Google serach for these. They are old, but provide a good description of GUI interfaces. The old Next manuals are also quite revealing.
In the end you will have to deal with process handling, managing windows (including decoration, borders, title bars, standard clickable items), control items (buttons, checkboxes, lists), maintaining config file, allowing interaction with KDE/Gnome applications, GUI graphics and double-buffering, text and font glyph display, etc, etc.
Linux Archive