git: installer(8): Implement form field change callback mechanism

Aaron LI aly at crater.dragonflybsd.org
Mon Feb 23 23:29:54 PST 2026


commit e8cd692241589e69369315a345ce2b9344235a74
Author: Aaron LI <aly at aaronly.me>
Date:   Sun Feb 22 21:10:35 2026 +0800

    installer(8): Implement form field change callback mechanism
    
    Implement a callback mechanism for form field change.  This allows the
    backend to dynamically update the dependent form fields when user
    modifies one field.
    
    The whole interaction flow is:
    1. Set the callback function for a form field;
    2. The frontend presents the form;
    3. User fills the field and changes focus;
    4. The frontend sends the FIELD_CHANGED message and waits for the reply;
    5. The backend handles the message, triggers the callback, and replies
       the FIELD_CHANGED_ACK message with the full dataset;
    6. The frontend applies the dataset to present the updated form.
    
    For example, when user fills the interface IP address, the callback will
    auto fill the default router / gateway address.
    
    TODO: The following low-priority features are missing:
    - Update a "multiple" form with multiple datasets;
    - Encode and report callback errors.
    
    Credit: Github Copilot with Claude Haiku 4.5

Summary of changes:
 usr.sbin/installer/dfuife_curses/curses_form.c   | 79 +++++++++++++++++++-
 usr.sbin/installer/dfuife_curses/curses_form.h   |  3 +
 usr.sbin/installer/dfuife_curses/curses_widget.c | 11 +++
 usr.sbin/installer/dfuife_curses/curses_widget.h |  1 +
 usr.sbin/installer/dfuife_curses/curses_xlat.c   | 46 +++++++++++-
 usr.sbin/installer/dfuife_curses/curses_xlat.h   |  3 +
 usr.sbin/installer/dfuife_curses/main.c          |  6 +-
 usr.sbin/installer/libdfui/connection.c          | 92 ++++++++++++++++++++----
 usr.sbin/installer/libdfui/decode.c              |  5 ++
 usr.sbin/installer/libdfui/dfui.h                | 35 +++++++++
 usr.sbin/installer/libdfui/encode.c              |  5 ++
 usr.sbin/installer/libdfui/encoding.h            |  4 +-
 usr.sbin/installer/libdfui/form.c                | 63 ++++++++++++++++
 13 files changed, 328 insertions(+), 25 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e8cd692241589e69369315a345ce2b9344235a74


-- 
DragonFly BSD source repository


More information about the Commits mailing list