Skip to content

Instantly share code, notes, and snippets.

@flatcap
Last active June 10, 2022 18:56
Show Gist options
  • Save flatcap/dae78ae1cdd7427b04e19331b7cd6bbe to your computer and use it in GitHub Desktop.
Save flatcap/dae78ae1cdd7427b04e19331b7cd6bbe to your computer and use it in GitHub Desktop.
Window Events

Window Events

Callers grouped by type

SIGWINCH

All the places in the code where SIGWINCH is handled:

They call:

OP_ENTER_COMMAND

All the places in the code where OP_ENTER_COMMAND is handled. This may call mutt_parse_rc_line() which may spawn shells commands.

They call:

OP_REDRAW (Ctrl-L)

All the places in the code where OP_REDRAW is handled. Usually this is the result of Ctrl-L being pressed.

They call:

External Command

All the places in the code where external commands are called directly. e.g. editor, pgp pin entry

Whilst these programs are running the screen could be resized, so assume the worst.

They call:

Event loop

All the places in the code where NeoMutt is waiting for user input:

They call:

Resize message window

All the places in the code that resize the Message Window:

They call mutt_window_reflow_message_rows():

Custom

All the places where code manually calls mutt_getch()

All the places where code manually calls km_dokey()

They call:

  • Nothing

Pseudo Code

This is what should happen for each of the markers above:

REFLOW

  • mutt_window_reflow()
    • window_notify_all()
      • NT_WINDOW => WA_RECALC, WA_REPAINT

RESIZE

Check the size of the screen. Notify all the Windows whose size or position changed. This may have no effect.

  • mutt_resize_screen()
    • mutt_window_set_root(cols, rows)

INVALIDATE

Flag all the visible windows with WA_REPAINT. This will force the screen to be redrawn on the next LOOP

  • window_invalidate_all()
    • WA_REPAINT for all visible windows
  • clearok() -- no effect until refresh()
  • keypad()

LOOP

Each event loop will trigger the refreshing of the screen.

  • window_redraw()
    • recalc() for all Windows flagged WA_RECALC
    • repaint() for all Windows flagged WA_REPAINT
    • mutt_refresh()
      Finally flush the updates to the screen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment