Opening a new window is an activity that gets called for the pending window. This activity is the "constructing something" activity, and it's used to set background colours, neatly arranged unpositioned new windows, and apply the minimum width rules. New rules can be written before and after this activity. These rules may refer to "the pending g-window"; note that before, this window will not yet be in existence on the screen but its properties can be changed, and after it should be present on the screen.
Should you want to make changes to the styles for the windows, this is also the place to do it (see the Glk spec for more information on this). During the before phase, set the stylehint you want. During the after phase, remove it again, so that it doesn't affect other newly created windows. (See background colour rules for an example of this).
For example: windows containing hyperlinks need to be "hyperlink-activated" before each click. To do this, use the following phrases:
Code:
After constructing the conversation-window:
expect links in conversation-window.
To expect links in (g - a g-window):
(- glk_request_hyperlink_event({g}.ref_number); -).
After constructing is a good entry point for this, as it's after the window has appeared but before anything's been drawn inside it.
Then after a link has been handled, you'll need to call this phrase again to reset hyperlink-watching.