X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=docs%2Freference%2Fglk-window-arrangement.sgml;h=cc9ba523bef69b5af5ce0b5edfdba906296f2328;hb=c6e78c57fc1b323ec055bfe48c7430515be27d1c;hp=9926d817c5d81f04bbc138de262021190da24540;hpb=062bbb9e7322c8e3f5162f86fc2f93bfc587b830;p=rodin%2Fchimara.git diff --git a/docs/reference/glk-window-arrangement.sgml b/docs/reference/glk-window-arrangement.sgml index 9926d81..cc9ba52 100644 --- a/docs/reference/glk-window-arrangement.sgml +++ b/docs/reference/glk-window-arrangement.sgml @@ -30,18 +30,47 @@ Now you have two windows. In exactly the same way, you can split either of them You can repeat this as often as you want. Every time you split a window, one new window is created. Therefore, the call that does this is called glk_window_open(). -It might have been less confusing to call it glk_split_window() — or it might have been more confusing. I picked one. +It might have been less confusing to call it glk_split_window() — or it might have been more confusing. I picked one. It is important to remember that the order of splitting matters. If you split twice, you don't have a trio of windows; you have a pair with another pair on one side. Mathematically, the window structure is a binary tree. Example time. Say you do two splits, each a 50-50 percentage split. You start with the original window A, and split that into A and B; then you split B into B and C. -Screen shot 1 + + + + O + / \ + A O + / \ + B C + + Or, you could split A into A and B, and then split A again into A and C. -Screen shot 2 + + + + O + / \ + O B + / \ + A C + + I'm using the simplest possible splits in the examples above. Every split is 50-50, and the new window of the pair is always below the original one (the one that gets split.) You can get fancier than that. Here are three more ways to perform the first example; all of them have the same tree structure, but look different on the screen. -Screen shot 3 + + + + + + O + / \ + A O + / \ + B C + + On the left, we turn the second split (B into B/C) upside down; we put the new window (C) above the old window (B). @@ -55,7 +84,28 @@ The visible windows on the Glk screen are leaf nodes of the binar You don't create pair windows directly; they are created as a consequence of window splits. Whenever you create a new window, a new pair window is also created automatically. In the following two-split process, you can see that when a window is split, it is replaced by a new pair window, and moves down to become one of that O's two children. -Screen shot 4 + + + + A + + + + + O + / \ + A B + + + + + O + / \ + A O + / \ + B C + + You can't draw into a pair window. It's completely filled up with the two windows it contains. They're what you should be drawing into.