diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-01-06 13:00:30 +0300 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2026-01-06 11:36:38 +0100 |
| commit | e55bd8e619aad30c119e8e17894337021fb16af8 (patch) | |
| tree | bb6b2a7730b47e19f7108f6bb1d4e8671e9fd0b9 | |
| parent | 68d19d800cd037a8efb210c6ebc52cf23c11ad5e (diff) | |
PDCurses: fixed modifiers (CTRL, ALT, SHIFT) and mouse support on XCurses
* While xcurses-config does define PDC_WIDE, it does not
define PDC_NCMOUSE, which we currently rely on so that
NCURSES_MOUSE_VERSION is set correctly.
Therefore we check for it just like when using --with-interface=pdcurses.
* The modifiers were broken on all variants of PDCurses.
This was a regression from v2.4.0.
| -rw-r--r-- | configure.ac | 6 | ||||
| -rw-r--r-- | src/interface-curses/interface.c | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 5ac7aad..460862c 100644 --- a/configure.ac +++ b/configure.ac @@ -334,6 +334,8 @@ case $INTERFACE in xcurses) AC_CHECK_PROG(XCURSES_CONFIG, xcurses-config, xcurses-config) + # NOTE: `xcurses-config --cflags` is expected to set + # -DPDC_WIDE and -DPDC_FORCE_UTF8 (if these features are enabled). if [[ "x$CURSES_CFLAGS" = "x" -a "x$XCURSES_CONFIG" != "x" ]]; then CURSES_CFLAGS=`$XCURSES_CONFIG --cflags` fi @@ -353,6 +355,10 @@ case $INTERFACE in # It is crucial to define XCURSES before including curses.h. AC_DEFINE(XCURSES, 1, [Enable PDCurses/XCurses extensions]) + AC_CHECK_FUNC([has_mouse], [ + AC_DEFINE(PDC_NCMOUSE, 1, [PDCurses built with ncurses mouse API]) + ]) + AC_DEFINE(PDCURSES_GUI, 1, [PDCurses with GUI window]) ;; diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index bc48b5e..9ace2ee 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -278,8 +278,8 @@ teco_color_attr(gshort fg, gshort bg) * Basic support for monochrome terminals: * Every background, that is not black is assumed to be a * dark-on-bright area, rendered in reverse. - * This will at least work with the terminal.tes - * color scheme. + * This will at least work with the terminal.tes and contrast.tes + * color schemes. */ return bg != COLOR_BLACK ? A_REVERSE : 0; } @@ -2031,7 +2031,8 @@ teco_interface_blocking_getch(void) gboolean new_mousekey = (teco_ed & TECO_ED_MOUSEKEY) != 0; if (new_mousekey != old_mousekey) { old_mousekey = new_mousekey; - mmask_t mmask = BUTTON_EVENT(PRESSED) | BUTTON_EVENT(RELEASED); + mmask_t mmask = BUTTON_EVENT(PRESSED) | BUTTON_EVENT(RELEASED) | + BUTTON_SHIFT | BUTTON_CTRL | BUTTON_ALT; #ifdef __PDCURSES__ /* * On PDCurses it's crucial NOT to mask for BUTTONX_CLICKED. |
