From 0b48fb6e353564f46ab9ed0bbb2a60aeb65ccd5e Mon Sep 17 00:00:00 2001 From: sf-mensch Date: Thu, 2 Dec 2021 21:41:29 +0000 Subject: [PATCH] Merged revision 3413 from trunk: corrections mainly for mouse handling, fixing [bugs:#608], [bugs:#700] libcob: * screenio.c (BUTTON3_DOUBLE_CLICKED): fix value for BUTTON3_DOUBLE_CLICKED * screenio.c (field_accept): pass mouse position on KEY_MOUSE * screenio.c (cob_display_formatted_text): fix early return for broken data * common.c (set_config_val): pass COB_MOUSE_INTERVAL changes to screenio.c --- copy/screenio.cpy | 8 ++++---- libcob/ChangeLog | 8 ++++++++ libcob/common.c | 6 +++++- libcob/screenio.c | 17 +++++++++++++++-- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/copy/screenio.cpy b/copy/screenio.cpy index 64b35161f..8f92397ff 100644 --- a/copy/screenio.cpy +++ b/copy/screenio.cpy @@ -1,5 +1,5 @@ - *> Copyright (C) 2008-2012, 2015-2016, - *> 2019 Free Software Foundation, Inc. + *> Copyright (C) 2008-2012, 2015-2016, 2019, 2021 + *> Free Software Foundation, Inc. *> Written by Roger While, Simon Sobisch *> *> This file is part of GnuCOBOL. @@ -186,8 +186,8 @@ *>78 COB-SCR-CTRL-WHEEL-RIGHT VALUE 2091. *reserved* 78 COB-SCR-ALT-WHEEL-UP VALUE 2092. 78 COB-SCR-ALT-WHEEL-DOWN VALUE 2093. - *>78 COB-SCR-ALT-WHEEL-LEFT VALUE 2082. *reserved* - *>78 COB-SCR-ALT-WHEEL-RIGHT VALUE 2083. *reserved* + *>78 COB-SCR-ALT-WHEEL-LEFT VALUE 2094. *reserved* + *>78 COB-SCR-ALT-WHEEL-RIGHT VALUE 2095. *reserved* *> Input validation - Values 8xxx 78 COB-SCR-NO-FIELD VALUE 8000. 78 COB-SCR-TIME-OUT VALUE 8001. diff --git a/libcob/ChangeLog b/libcob/ChangeLog index ad42c2d4a..a3d6c38d3 100644 --- a/libcob/ChangeLog +++ b/libcob/ChangeLog @@ -732,6 +732,14 @@ a key that has all SUPPRESS character and skip the record. This will handle old VBISAM which do not support key suppression. +2019-12-11 Simon Sobisch + + Fix Bug #608, #700 + * screenio.c (BUTTON3_DOUBLE_CLICKED): fix value for BUTTON3_DOUBLE_CLICKED + * screenio.c (field_accept): pass mouse position on KEY_MOUSE + * screenio.c (cob_display_formatted_text): fix early return for broken data + * common.c (set_config_val): pass COB_MOUSE_INTERVAL changes to screenio.c + 2019-11-18 Ron Norman * common.h, fileio.c (fextfh.c, fbdb.c): Updates to support diff --git a/libcob/common.c b/libcob/common.c index a2352dbe9..f985a111a 100644 --- a/libcob/common.c +++ b/libcob/common.c @@ -6584,7 +6584,11 @@ set_config_val (char *value, int pos) return 1; } set_value (data, data_len, numval); - if (strcmp (gc_conf[pos].env_name, "COB_MOUSE_FLAGS") == 0) { + if (strcmp (gc_conf[pos].env_name, "COB_MOUSE_FLAGS") == 0 +#ifdef HAVE_MOUSEINTERVAL /* possibly add an internal option for mouse support, too */ + || strcmp (gc_conf[pos].env_name, "COB_MOUSE_INTERVAL") == 0 +#endif + ) { cob_settings_screenio (); } diff --git a/libcob/screenio.c b/libcob/screenio.c index 80cb37cca..22f91c359 100644 --- a/libcob/screenio.c +++ b/libcob/screenio.c @@ -1431,8 +1431,8 @@ mouse_to_exception_code (mmask_t mask) { else if (mask & BUTTON3_PRESSED) fret = 2047; else if (mask & BUTTON3_CLICKED) fret = 2047; else if (mask & BUTTON3_RELEASED) fret = 2048; - else if (mask & BUTTON3_DOUBLE_CLICKED) fret = 2048; - else if (mask & BUTTON3_TRIPLE_CLICKED) fret = 2048; + else if (mask & BUTTON3_DOUBLE_CLICKED) fret = 2049; + else if (mask & BUTTON3_TRIPLE_CLICKED) fret = 2049; #if defined COB_HAS_MOUSEWHEEL else if (mask & BUTTON4_PRESSED) fret = 2080; else if (mask & BUTTON5_PRESSED) fret = 2081; @@ -2962,6 +2962,19 @@ field_accept (cob_field *f, const int sline, const int scolumn, cob_field *fgc, /* End key. */ fret = 2015; goto field_return; +#ifdef NCURSES_MOUSE_VERSION + case KEY_MOUSE: + { + int mline = mevent.y; + int mcolumn = mevent.x; + mevent.bstate &= cob_mask_accept; + if (mevent.bstate != 0) { + fret = mouse_to_exception_code (mevent.bstate); + cob_move_cursor (mline, mcolumn); // move cursor to pass position + goto field_return; + } + } +#endif default: (void)flushinp (); cob_beep ();