Ghost Kernel

Canvas implementation, desktop application 2016/07/11, 21:08:20

The latest commit includes a canvas implementation and the first steps for an actual desktop.

A canvas component is needed to allow applications to freely draw on a buffer in memory, which is usually only done by window server. The use case for this canvas is for example drawing a task-bar from within the desktop application or providing a space to draw images from client-side. It will also be the basis for other user-drawn components.

Unlike other UI components, the content of a canvas is entirely rendered by the component creator instead of the server. The implementation for this is done with a combination of shared memory and messaging. The client requests creation of a canvas component just as with any other component, and the window server notifies the client with events when the buffer has been allocated.

The most challenging issue with a shared memory buffer is avoiding the client application to cause faulty memory accesses when the buffer needs to be resized (i.e. after relayouting). This is now solved by simply retaining the previous buffer until the client application sends an _acknowledge message_ to the window server. This consumes more memory until the buffer is acknowledged but improves stability. A nice little discussion on this topic was led in the OSDev forums.