I plan to have a graphical interface in the homebrew computer. To this end, I am learning about windowing systems.
- Overview -
The main components of a windowing system seem to roughly be:
- hardware interfacing
- communicating with input (mouse, keyboard) and output (screen) devices
- state management
- tracking the state of a window. For example its position, size, parent, children, visibility
- rendering
- determining the most efficient way to draw a window
- adding window decorations
- window server and client communication
- the server notifying clients of events (eg. mouse move, window exposed)
- clients sending requests to the server (eg. change window title, get contents of clipboard) and receiving responses from the server (eg. contents of clipboard)
- Tutorial -
I came across Joe Marlin’s awesome Windowing Systems By Example tutorial series (archived here). In it, we are shown how to create a simple stacking window manager. It uses clipping regions to draw/update only the visible parts of a window. The series covers the “state management” and “rendering” parts of a windowing system.