X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Fbase%2Flib_mouse.c;h=b2330c02855ab7e93258a90a30ae621171e3ae5b;hp=6caef327a3c02b404e420da90fc42494d9706e5a;hb=91e462de27aeecd5b1c8965a6dba078f7a438003;hpb=fae162795e065e5901068152e91f2962b6b247f3 diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index 6caef327..b2330c02 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 2018-2021,2022 Thomas E. Dickey * * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * @@ -85,7 +85,7 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_mouse.c,v 1.192 2021/02/14 00:17:09 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.194 2022/01/16 01:15:47 tom Exp $") #include @@ -419,13 +419,22 @@ init_xterm_mouse(SCREEN *sp) } else { int code = tigetnum("XM"); switch (code) { +#ifdef EXP_XTERM_1005 + case 1005: + /* see "xterm+sm+1005" */ + sp->_mouse_xtermcap = "\033[?1005;1000%?%p1%{1}%=%th%el%;"; + sp->_mouse_format = MF_XTERM_1005; + break; +#endif case 1006: + /* see "xterm+sm+1006" */ + sp->_mouse_xtermcap = "\033[?1006;1000%?%p1%{1}%=%th%el%;"; + sp->_mouse_format = MF_SGR1006; break; default: - code = 1000; + sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;"; break; } - sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;"; } } #endif @@ -1560,7 +1569,7 @@ _nc_mouse_parse(SCREEN *sp, int runcount) if (changed) { merge = FALSE; for (b = 1; b <= MAX_BUTTONS; ++b) { - if ((sp->_mouse_mask & MASK_CLICK(b)) + if ((sp->_mouse_mask2 & MASK_CLICK(b)) && (ep->bstate & MASK_PRESS(b))) { next->bstate &= ~MASK_RELEASE(b); next->bstate |= MASK_CLICK(b); @@ -1641,7 +1650,7 @@ _nc_mouse_parse(SCREEN *sp, int runcount) && (next->bstate & BUTTON_CLICKED)) { merge = FALSE; for (b = 1; b <= MAX_BUTTONS; ++b) { - if ((sp->_mouse_mask & MASK_DOUBLE_CLICK(b)) + if ((sp->_mouse_mask2 & MASK_DOUBLE_CLICK(b)) && (ep->bstate & MASK_CLICK(b)) && (next->bstate & MASK_CLICK(b))) { next->bstate &= ~MASK_CLICK(b); @@ -1659,7 +1668,7 @@ _nc_mouse_parse(SCREEN *sp, int runcount) && (next->bstate & BUTTON_CLICKED)) { merge = FALSE; for (b = 1; b <= MAX_BUTTONS; ++b) { - if ((sp->_mouse_mask & MASK_TRIPLE_CLICK(b)) + if ((sp->_mouse_mask2 & MASK_TRIPLE_CLICK(b)) && (ep->bstate & MASK_DOUBLE_CLICK(b)) && (next->bstate & MASK_CLICK(b))) { next->bstate &= ~MASK_CLICK(b); @@ -1719,7 +1728,8 @@ _nc_mouse_parse(SCREEN *sp, int runcount) #endif /* TRACE */ /* after all this, do we have a valid event? */ - return ValidEvent(PREV(first_invalid)); + ep = PREV(first_invalid); + return ValidEvent(ep) && ((ep->bstate & sp->_mouse_mask) != 0); } static void