Blender window system

introduction

This document describes the Blender window system. We will start of by defining the terminology of the elements of the window system. Then the data structures of each of these elements are given.

terminology

Below is a picture of the application window of Blender with some of the areas numbered.

Blender main window

Blender main window

  1. The blue area inside the main main window of Blender is called a screen.
  2. The red area inside the screen is a screen area. Screens typically have a number of screen areas. In the picture three screen areas are found.
  3. Screen areas are divided by screen edges. The detail (black) in the picture shows an enlarged screen edge.
  4. Within each screen area there is a space (e.g. the yellow lined button space in the picture).
  5. Spaces can have headers (purple) which can be located above or beneath the space.

Data structures

The definitions of the window system elements are all found in the screen.h file.

Screens are defined with the bScreen C language structure:
typedef struct bScreen {
  ID id;
  ListBase vertbase, edgebase, areabase;
  Scene *scene;
  short startx, endx, starty, endy; /* framebuffer coords */
  short sizex, sizey;
  short scenenr, screennr; /* alleen voor pupmenu */
  short full, rt;
  short mainwin, winakt;
} bScreen;
The structure contains a linked list with all the screen areas and another one for the all the screen edges.

Screen areas are defined with the ScrArea structure:
typedef struct ScrArea {
  struct ScrArea *next, *prev;
  ScrVert *v1, *v2, *v3, *v4;
  bScreen *full; /* als area==full, dit is de parent */
  short *headqueue, *hq, *winqueue, *wq;
  float winmat[4][4];
  rcti totrct, headrct, winrct;
  short headwin, win; short headertype; /* 0=niets, 1= down, 2= up */
  char spacetype, butspacetype; /* SPACE_... */ short winx, winy; /* size */
  char   head_swap, head_equal;
  char win_swap, win_equal;
  short headbutlen, headbutofs;
  short cursor, rt;
  void (*headchange)(), (*winchange)();
  void (*headdraw)(void), (*windraw)(void);
  /* opmerking: fuctiepointers met types binnen de halen geeft problemen met SDNA */
  void (*headqread)(), (*winqread)();
  ListBase spacedata; ListBase uiblocks;
} ScrArea;
The structure is a linked list of all the screen areas in a screen. It contains data about the space and the header in the screen area (among other things...).

Screen edges are defined with the ScrArea structure:
typedef struct ScrEdge {
  struct ScrEdge *next, *prev;
  ScrVert *v1, *v2;
  short border; /* 1 als op rand screen */
  short flag;
  int pad;
} ScrEdge;