summaryrefslogtreecommitdiffstats
path: root/HACKING
blob: b78d40f8913c45d4fa50764fb54e38fc3d820bf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
WIP notes on hacking the Screen source.

* Screen commands are handled by the DoAction function in process.c.
  The local variable nr is set to an integer value representing the
  command to be evaluated; for every command `foo', there is an
  integer value RC_FOO for use as nr's value to represent it. Find
  the matching case label to follow procesing of the command.
   
  The RC_FOO values are defined in comm.h, which is automatically
  generated by comm.sh, based on the names of the commands
  themselves (found in comm.c).

* The current display is held in the global variable "display".
  Variable names like D_foo are shorthands for display->d_foo (where d_foo
  is a member of "struct display").

* Names like D_IS, D_TI, D_SG usually refer to the values of various
  termcap features of the current display. These are found in term.h,
  which is automatically generated from term.c by term.sh.

* The main input-reading function for handling user input from a display,
  is disp_readev_fn in display.c. This also handles automatic transformation
  of mouse-tracking codes from display coordinates to screen-window
  coordinates, and decodes characters from the display's encoding, passing
  it on to the foreground input processor.

  Input is passed through ProcessInput in process.c to handle
  keybindings (specified by bindkey and such), and then processed by
  layer-specific input-processing functions, which you'll find in
  instances of struct LayFuncs. For instance, keystrokes are processed
  by:

        normal windows:         WinPrGocess
        window in copy-mode:    MarkProcess
        window list:            WListProcess
        command input line:     InpProcess

* Handling string escapes (in hardstatus and the like), such as %w or
  %{= bw}, is done in screen.c, MakeWinMsgEv().