note on mouse code; prepare mygetenv for deletion

This commit is contained in:
anon 2024-11-10 12:49:23 +01:00
parent e0e79f5043
commit c9f9d7a876
2 changed files with 21 additions and 24 deletions

View File

@ -239,7 +239,7 @@ void entercurses(void) {
noecho(); /* don't echo input characters */ noecho(); /* don't echo input characters */
curs_set(0); curs_set(0);
clear(); /* clear the screen */ clear(); /* clear the screen */
mouseinit(); /* initialize any mouse interface */ // mouseinit(); /* initialize any mouse interface */
// drawscrollbar(topline, nextline); // drawscrollbar(topline, nextline);
keypad(stdscr, TRUE); /* enable the keypad */ keypad(stdscr, TRUE); /* enable the keypad */
// fixkeypad(); /* fix for getch() intermittently returning garbage */ // fixkeypad(); /* fix for getch() intermittently returning garbage */
@ -258,7 +258,7 @@ void exitcurses(void) {
incurses = false; incurses = false;
/* restore the mouse */ /* restore the mouse */
mousecleanup(); // mousecleanup();
fflush(stdout); fflush(stdout);
} }

View File

@ -35,6 +35,14 @@
* mouse functions * mouse functions
*/ */
/* NOTE: the mouse functionallity has been void of anyone,
* but those on the most esoteric of systems
* for the past 20 years.
* as of now, non-of the code here should ever execute
* this file will be kept here as a reference for a
* future complete rewrite of mouse support
*/
extern int LINES; extern int LINES;
#define FLDLINE (LINES - FIELDS - 1 - 1) /* first input field line */ #define FLDLINE (LINES - FIELDS - 1 - 1) /* first input field line */
@ -89,12 +97,10 @@ static int getcoordinate(void);
static int getpercent(void); static int getpercent(void);
/* see if there is a mouse interface */ /* see if there is a mouse interface */
void mouseinit(void) { void mouseinit(void) {
char *term; char *term = ""; // mygetenv("TERM", ""); // NOTE: this function no longer exists
/* see if this is emacsterm or viterm */ /* see if this is emacsterm or viterm */
term = mygetenv("TERM", "");
if(strcmp(term, "emacsterm") == 0 || strcmp(term, "viterm") == 0) { if(strcmp(term, "emacsterm") == 0 || strcmp(term, "viterm") == 0) {
emacsviterm = true; emacsviterm = true;
mouse = true; mouse = true;
@ -102,7 +108,7 @@ void mouseinit(void) {
/* the MOUSE enviroment variable is for 5620 terminal programs that have /* the MOUSE enviroment variable is for 5620 terminal programs that have
mouse support but the TERM environment variable is the same as a mouse support but the TERM environment variable is the same as a
terminal without a mouse, such as myx */ terminal without a mouse, such as myx */
else if(strcmp(mygetenv("MOUSE", ""), "myx") == 0) { else if(strcmp("" /* XXX mygetenv("MOUSE", "")*/, "myx") == 0) {
mouse = true; mouse = true;
} }
#if UNIXPC #if UNIXPC
@ -147,7 +153,6 @@ void mouseinit(void) {
} }
/* load the correct mouse menu */ /* load the correct mouse menu */
void mousemenu(void) { void mousemenu(void) {
if(mouse == true) { if(mouse == true) {
if(input_mode == INPUT_CHANGE) { if(input_mode == INPUT_CHANGE) {
@ -159,7 +164,6 @@ void mousemenu(void) {
} }
/* download a menu */ /* download a menu */
static void loadmenu(MENU *menu) { static void loadmenu(MENU *menu) {
int i; int i;
@ -189,7 +193,6 @@ static void loadmenu(MENU *menu) {
} }
/* reinitialize the mouse in case curses changed the attributes */ /* reinitialize the mouse in case curses changed the attributes */
void mousereinit(void) { void mousereinit(void) {
if(emacsviterm == true) { if(emacsviterm == true) {
@ -201,7 +204,6 @@ void mousereinit(void) {
} }
/* restore the mouse attributes */ /* restore the mouse attributes */
void mousecleanup(void) { void mousecleanup(void) {
int i; int i;
@ -217,7 +219,6 @@ void mousecleanup(void) {
} }
/* draw the scrollbar */ /* draw the scrollbar */
void drawscrollbar(int top, int bot) { void drawscrollbar(int top, int bot) {
int p1, p2; int p1, p2;
@ -238,7 +239,6 @@ void drawscrollbar(int top, int bot) {
} }
/* get the mouse information */ /* get the mouse information */
MOUSE *getmouseaction(char leading_char) { MOUSE *getmouseaction(char leading_char) {
static MOUSE m; static MOUSE m;
@ -341,7 +341,6 @@ MOUSE *getmouseaction(char leading_char) {
#endif /* not UNIXPC */ #endif /* not UNIXPC */
if(mouse == true && leading_char == ctrl('X')) { if(mouse == true && leading_char == ctrl('X')) {
switch(getch()) { switch(getch()) {
case ctrl('_'): /* click */ case ctrl('_'): /* click */
if((m.button = getch()) == '0') { /* if scrollbar */ if((m.button = getch()) == '0') { /* if scrollbar */
@ -370,7 +369,6 @@ MOUSE *getmouseaction(char leading_char) {
} }
/* get a row or column coordinate from a mouse button click or sweep */ /* get a row or column coordinate from a mouse button click or sweep */
static int getcoordinate(void) { static int getcoordinate(void) {
int c, next; int c, next;
@ -385,13 +383,12 @@ static int getcoordinate(void) {
} }
/* get a percentage */ /* get a percentage */
static int getpercent(void) { static int getpercent(void) {
int c; int c = getch();
if(c < 16) { return 0; }
if(c > 120) { return 100; }
c = getch();
if(c < 16) { return (0); }
if(c > 120) { return (100); }
return (c - 16); return (c - 16);
} }
@ -399,22 +396,22 @@ int process_mouse() {
int i; int i;
MOUSE *p; MOUSE *p;
if((p = getmouseaction(DUMMYCHAR)) == NULL) { if((p = getmouseaction(DUMMYCHAR)) == NULL) {
return (false); /* unknown control sequence */ return false; /* unknown control sequence */
} }
/* if the button number is a scrollbar tag */ /* if the button number is a scrollbar tag */
if(p->button == '0') { if(p->button == '0') {
// scrollbar(p); // XXX // scrollbar(p); // XXX
return (false); return false;
} }
/* ignore a sweep */ /* ignore a sweep */
if(p->x2 >= 0) { return (false); } if(p->x2 >= 0) { return false; }
/* if this is a line selection */ /* if this is a line selection */
if(p->y1 > FLDLINE) { if(p->y1 > FLDLINE) {
/* find the selected line */ /* find the selected line */
/* note: the selection is forced into range */ /* note: the selection is forced into range */
for(i = disprefs - 1; i > 0; --i) { for(i = disprefs - 1; i > 0; --i) {
if(p->y1 >= displine[i]) { return (false); } if(p->y1 >= displine[i]) { return false; }
} }
/* display it in the file with the editor */ /* display it in the file with the editor */
editref(i); editref(i);
@ -422,7 +419,7 @@ int process_mouse() {
field = p->y1 - FLDLINE; field = p->y1 - FLDLINE;
/* force it into range */ /* force it into range */
if(field >= FIELDS) { field = FIELDS - 1; } if(field >= FIELDS) { field = FIELDS - 1; }
return (false); return false;
} }
return false; return false;