summaryrefslogtreecommitdiffstats
path: root/HACKING
blob: 9cd0d1af4f5e970bed0b81d42e3cac7d477783a5 (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 processing 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().