Skip to content

Commit

Permalink
#85
Browse files Browse the repository at this point in the history
  • Loading branch information
adamyg committed Sep 26, 2024
1 parent 72ab452 commit d991eda
Show file tree
Hide file tree
Showing 14 changed files with 156 additions and 85 deletions.
13 changes: 7 additions & 6 deletions gr/cmain.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_cmain_c,"$Id: cmain.c,v 1.64 2024/09/21 09:05:16 cvsuser Exp $")
__CIDENT_RCSID(gr_cmain_c,"$Id: cmain.c,v 1.65 2024/09/25 15:51:54 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: cmain.c,v 1.64 2024/09/21 09:05:16 cvsuser Exp $
/* $Id: cmain.c,v 1.65 2024/09/25 15:51:54 cvsuser Exp $
* Main body, startup and command-line processing.
*
*
Expand Down Expand Up @@ -91,7 +91,7 @@ __CIDENT_RCSID(gr_cmain_c,"$Id: cmain.c,v 1.64 2024/09/21 09:05:16 cvsuser Exp $
#endif

#define KBPROTOCOL_DEFAULT "auto"
#define KBPROTOCOL_OPTIONS "=none|auto|basic|cygwin|msterminal|xterm-mok2|mintty-mok2"
#define KBPROTOCOL_OPTIONS "=none|auto|meta|cygwin|msterminal|xterm-mok2|mintty-mok2"

#define MAX_M 32 /* -m switches, including -u switch. */

Expand Down Expand Up @@ -169,14 +169,14 @@ static struct argoption options[] = {

{ "nohilite", arg_none, NULL, 7, "Disable syntax hiliting" },

{ "norawkb", arg_none, NULL, 420, "Disable use of raw kbprotocol; kbprotocol=basic" },
{ "norawkb", arg_none, NULL, 420, "Disable use of raw kbprotocol; kbprotocol=meta" },

{ "kbprotocol", arg_required, NULL, 421, "Enable given keyboard protocol: default=" KBPROTOCOL_DEFAULT,
KBPROTOCOL_OPTIONS },

{ "kbconfig", arg_required, NULL, 422, "Keyboard protocol selection config; format \"term:mode[;..]\"" },

{ "nosigtrap", arg_none, NULL, 17, "Disable signal trapping (for debugging)" },
{ "nosigtrap", arg_none, NULL, 17, "Disable signal trapping (for debugging)" },

{ "term", arg_required, NULL, 308, "Override the TERM setting",
"<termname>" },
Expand Down Expand Up @@ -1034,7 +1034,7 @@ argv_process(const int doerr, int argc, const char **argv)
break;

case 420: /* tty - raw keyboard disabled. */
xf_kbprotocol = KBPROTOCOL_BASIC;
xf_kbprotocol = KBPROTOCOL_META;
break;

case 421: { /* tty - keyboard protocol. */
Expand Down Expand Up @@ -2092,3 +2092,4 @@ usage(int what)
}

/*end*/

19 changes: 17 additions & 2 deletions gr/dialog.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_dialog_c,"$Id: dialog.c,v 1.33 2024/09/12 17:28:50 cvsuser Exp $")
__CIDENT_RCSID(gr_dialog_c,"$Id: dialog.c,v 1.35 2024/09/25 13:59:56 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: dialog.c,v 1.33 2024/09/12 17:28:50 cvsuser Exp $
/* $Id: dialog.c,v 1.35 2024/09/25 13:59:56 cvsuser Exp $
* Dialog manager.
*
*
Expand Down Expand Up @@ -1256,6 +1256,21 @@ dialog_find(int ident)
}


void
widget_clear(DIALOG_t* d)
{
WIDGET_t *first, *w;

if (NULL != (first = CIRCLEQ_FIRST(&d->d_widgetq))) {
w = first;
do {
assert(WIDGET_MAGIC == w->w_magic);
w->w_uflags = 0;
} while (first != (w = dialog_next(d, w)));
}
}


WIDGET_t *
widget_byname(DIALOG_t *d, const char *name)
{
Expand Down
5 changes: 3 additions & 2 deletions gr/dialog.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef GR_DIALOG_H_INCLUDED
#define GR_DIALOG_H_INCLUDED
#include <edidentifier.h>
__CIDENT_RCSID(gr_dialog_h,"$Id: dialog.h,v 1.20 2024/09/12 17:28:50 cvsuser Exp $")
__CIDENT_RCSID(gr_dialog_h,"$Id: dialog.h,v 1.21 2024/09/25 13:58:06 cvsuser Exp $")
__CPRAGMA_ONCE

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: dialog.h,v 1.20 2024/09/12 17:28:50 cvsuser Exp $
/* $Id: dialog.h,v 1.21 2024/09/25 13:58:06 cvsuser Exp $
* Dialog manager public interface.
*
*
Expand Down Expand Up @@ -525,6 +525,7 @@ extern int dialog_count(DIALOG_t *d);
extern WIDGET_t * dialog_next(DIALOG_t *d, WIDGET_t *w);
extern WIDGET_t * dialog_prev(DIALOG_t *d, WIDGET_t *w);

extern void widget_clear(DIALOG_t* d);
extern WIDGET_t * widget_byname(DIALOG_t *d, const char *name);
extern WIDGET_t * widget_byident(DIALOG_t *d, int ident);

Expand Down
5 changes: 3 additions & 2 deletions gr/dialog_tty.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_dialog_tty_c,"$Id: dialog_tty.c,v 1.31 2024/09/12 17:28:50 cvsuser Exp $")
__CIDENT_RCSID(gr_dialog_tty_c,"$Id: dialog_tty.c,v 1.32 2024/09/25 13:58:06 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: dialog_tty.c,v 1.31 2024/09/12 17:28:50 cvsuser Exp $
/* $Id: dialog_tty.c,v 1.32 2024/09/25 13:58:06 cvsuser Exp $
* Dialog manager, TTY interface.
*
*
Expand Down Expand Up @@ -339,6 +339,7 @@ dlg_open(DIALOG_t *d, DialogContext_t *c)
* widget sizing/
* either run the widget packer or grid processing logic.
*/
widget_clear(d);
if (0 == d->d_uflags) {
dialog_send(d, WIDGET_INIT, 0, 0);
dialog_bcast(d, NULL, NULL, FALSE, WIDGET_INIT, 0, 0);
Expand Down
6 changes: 3 additions & 3 deletions gr/keyboard.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_keyboard_c,"$Id: keyboard.c,v 1.79 2024/09/24 15:54:16 cvsuser Exp $")
__CIDENT_RCSID(gr_keyboard_c,"$Id: keyboard.c,v 1.80 2024/09/25 15:51:54 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: keyboard.c,v 1.79 2024/09/24 15:54:16 cvsuser Exp $
/* $Id: keyboard.c,v 1.80 2024/09/25 15:51:54 cvsuser Exp $
* Manipulate key maps and bindings.
*
*
Expand Down Expand Up @@ -391,7 +391,7 @@ static const struct {
#define PROTONAME(__name) __name, sizeof(__name)-1
{ PROTONAME("none"), KBPROTOCOL_NONE },
{ PROTONAME("auto"), KBPROTOCOL_AUTO },
{ PROTONAME("basic"), KBPROTOCOL_BASIC },
{ PROTONAME("meta"), KBPROTOCOL_META },
{ PROTONAME("cygwin"), KBPROTOCOL_CYGWIN },
{ PROTONAME("xterm-mok2"), KBPROTOCOL_XTERM_MOK2 },
{ PROTONAME("mintty-mok2"), KBPROTOCOL_MINTTY_MOK2 },
Expand Down
7 changes: 4 additions & 3 deletions gr/keyboard.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef GR_KEYBOARD_H_INCLUDED
#define GR_KEYBOARD_H_INCLUDED
#include <edidentifier.h>
__CIDENT_RCSID(gr_keyboard_h,"$Id: keyboard.h,v 1.27 2024/09/21 09:05:16 cvsuser Exp $")
__CIDENT_RCSID(gr_keyboard_h,"$Id: keyboard.h,v 1.28 2024/09/25 15:51:54 cvsuser Exp $")
__CPRAGMA_ONCE

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: keyboard.h,v 1.27 2024/09/21 09:05:16 cvsuser Exp $
/* $Id: keyboard.h,v 1.28 2024/09/25 15:51:54 cvsuser Exp $
* Key maps and binding management.
*
*
Expand All @@ -31,7 +31,7 @@ struct IOEvent;

#define KBPROTOCOL_NONE 0
#define KBPROTOCOL_AUTO 0x0001 /* Auto select, based on terminal type */
#define KBPROTOCOL_BASIC 0x0002 /* Meta- only */
#define KBPROTOCOL_META 0x0002 /* Meta- only */
#define KBPROTOCOL_FEATURE 0x0004 /* Terminal feature overrides -- internal only */
#define KBPROTOCOL_VT100_CURSOR 0x0008
#define KBPROTOCOL_XTERM_MOK2 0x0010
Expand Down Expand Up @@ -106,3 +106,4 @@ extern int32_t x_character; /* Current character typed. */
__CEND_DECLS

#endif /*GR_KEYBOARD_H_INCLUDED*/

10 changes: 8 additions & 2 deletions gr/m_terminal.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_m_terminal_c,"$Id: m_terminal.c,v 1.22 2024/07/23 12:52:20 cvsuser Exp $")
__CIDENT_RCSID(gr_m_terminal_c,"$Id: m_terminal.c,v 1.23 2024/09/25 15:51:54 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: m_terminal.c,v 1.22 2024/07/23 12:52:20 cvsuser Exp $
/* $Id: m_terminal.c,v 1.23 2024/09/25 15:51:54 cvsuser Exp $
* Terminal screen and keyboard primitives.
*
*
Expand Down Expand Up @@ -159,6 +159,7 @@ static struct pt_map pt_features[] = {

{ TF_TTY_FAST, PT_MKINT(x_pt.pt_tty_fast), "tty_fast" },
{ TF_TTY_GRAPHICSBOX, PT_MKINT(x_pt.pt_tty_graphicsbox), "tty_graphicsbox" },
{ TF_KBPROTOCOL, PT_MKSTR(x_pt.pt_kbprotocol), "kbprotocol" },

{ TF_SCREEN_ROWS, PT_MKINT(x_pt.pt_screen_rows), "screen_rows" },
{ TF_SCREEN_COLS, PT_MKINT(x_pt.pt_screen_cols), "screen_cols" },
Expand Down Expand Up @@ -504,6 +505,8 @@ do_set_term_characters(void) /* int ([int ident string desc], [string|int] va
! TF_TTY_GRAPHICSBOX tty_graphicsbox Integer When *true* enables use of graphic
box characters.
! TF_KBPROTOCOL kbprotocol String Active kb-protocol.
! TF_SCREEN_ROWS screen_rows Integer Number of screen rows.
! TF_SCREEN_COLS screen_cols Integer Number of screen columns.
Expand Down Expand Up @@ -1389,3 +1392,6 @@ do_get_term_keyboard(void) /* list () */
/*end*/





10 changes: 6 additions & 4 deletions gr/ttycmd.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <edidentifier.h>
__CIDENT_RCSID(gr_ttycmd_c,"$Id: ttycmd.c,v 1.1 2024/09/19 15:43:53 cvsuser Exp $")
__CIDENT_RCSID(gr_ttycmd_c,"$Id: ttycmd.c,v 1.2 2024/09/25 15:51:54 cvsuser Exp $")

/* -*- mode: c; indent-width: 4; -*- */
/* $Id: ttycmd.c,v 1.1 2024/09/19 15:43:53 cvsuser Exp $
/* $Id: ttycmd.c,v 1.2 2024/09/25 15:51:54 cvsuser Exp $
* TTY common command functions
*
*
Expand Down Expand Up @@ -48,7 +48,7 @@ static int isterm(const char *term, const char *name);
int
tty_defaultscheme(void)
{
const char *fgbg, *term = ggetenv("TERM");
const char *fgbg, *term = ggetenv("TERM"); // TODO/TERM_PROGRAM
int isdark = 0;

if (term) {
Expand Down Expand Up @@ -134,7 +134,7 @@ isterm(const char *term, const char *name)
*/
int
tty_identification(const char *RV, int timeoutms)
{
{ // TODO/TERM_PROGRAM
static char xterm_da2_cmd[] = "\033[>c";
const char *xterm_version;
int ret = -1;
Expand Down Expand Up @@ -399,3 +399,5 @@ tty_read(void *ibuffer, int length, int timeoutms)

/*end*/



Loading

0 comments on commit d991eda

Please sign in to comment.