[haiku-development] Re: window server / compositor

  • From: looncraz <looncraz@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 6 Jan 2016 09:44:51 -0600

On 1/6/2016 09:12, Yong Bakos wrote:

Hi everyone,
Thank you for keeping Haiku alive, I have always found BeOS/Haiku fascinating.

I have been digging through the source but am having a hard time discovering
how the desktop environment, window server, compositor, etc are handled. Could
anyone please point me in the right direction?

There is currently no compositor in the app_server, each window draws into the same frame buffer via a DrawingEngine (which uses a Painter or HWInterface attached to a RenderingBuffer). Drawing commands can be accelerated by a HWInterface (such as AccelerantHWInterface), or they use agg for software rendering. Currently, everywhere draw is converted to the Screen coordinate space before drawing, so there's a great deal of coordinate conversions going on constantly. The app_server creates UpdateQueues so that redraws can be performed in bursts to limit tearing and ficker as well.

The app_server can use multiple "interfaces" not just a screen. It can render to a BView (for the test_app_server, for example), to an HTML5 canvas, a remote interface, or to a local device (GPU, screen), IIRC, which is important to keep in mind if actually working on the drawing code (it also has concepts of Canvas and View (and ViewState), and DirectWindow drawing (direct client access to frame buffer))... and then much of that has its client-side counter-part which must be kept in sync... it's more simple than it sounds, don't be afraid of getting dirty ;-)

If I wanted to try to create an "alternative" desktop environment for Haiku,
for example, using a tiling window management system, do you have any tips about what to
investigate within the API and source tree?

However... none of that necessarily matters for this, really. If you want to change how windows behave or how the decorator logic works, you are interested in the Desktop, ServerWindow, Window, WindowBehavior, and Decorator classes (and subclasses) in the app_server. You may also need to introduce concepts on the client side for a proper tiling window manager so that applications can adapt. If you aren't interested in BeOS/Haiku compatibility, the sky is the limit.

If you have any specific questions, I'd be more than willing to help as much as I can (Axel and others definitely know more about the app_server than I do - something I hope to change ;-) ).

---The loon

Other related posts: