From b697806bfd5a6756bb4b40776c4499577671a167 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 5 Jan 2026 00:56:11 +0300 Subject: Curses: fixed mouse interactions on PDCurses * There is yet another PDCurses vs. ncurses incompatibility: ncurses has a mouse event queue so you must call getmouse() repeatedly for every KEY_MOUSE, while PDCurses apparently doesn't queue and would end up in an infinite loop. I.e. the program would hang once you press any mouse button. * This forced us to add an PDCurses-specific version of teco_interface_getmouse(). --- src/interface-curses/interface.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/interface-curses') diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index 010515c..0764db3 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -1967,6 +1967,20 @@ teco_interface_process_mevent(MEVENT *event, GError **error) return teco_cmdline_keymacro("MOUSE", -1, error); } +#ifdef __PDCURSES__ + +static gboolean +teco_interface_getmouse(GError **error) +{ + MEVENT event; + + /* in contrast to ncurses, there is no separate mouse event queue */ + return getmouse(&event) != OK || + teco_interface_process_mevent(&event, error); +} + +#else /* __PDCURSES__ */ + static gboolean teco_interface_getmouse(GError **error) { @@ -1979,6 +1993,8 @@ teco_interface_getmouse(GError **error) return TRUE; } +#endif /* !__PDCURSES__ */ + #endif /* NCURSES_MOUSE_VERSION >= 2 */ static gint -- cgit v1.2.3