diff --git a/Misc/NEWS.d/next/Library/2020-01-13-23-37-58.bpo-39273.m5hzxV.rst b/Misc/NEWS.d/next/Library/2020-01-13-23-37-58.bpo-39273.m5hzxV.rst new file mode 100644 index 00000000000..c942da07da3 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-01-13-23-37-58.bpo-39273.m5hzxV.rst @@ -0,0 +1,2 @@ +The ``BUTTON5_*`` constants are now exposed in the :mod:`curses` module if +available. diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index c2ce3a968fa..0246c23941b 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -4691,6 +4691,14 @@ PyInit__curses(void) SetDictInt("BUTTON4_DOUBLE_CLICKED", BUTTON4_DOUBLE_CLICKED); SetDictInt("BUTTON4_TRIPLE_CLICKED", BUTTON4_TRIPLE_CLICKED); +#if NCURSES_MOUSE_VERSION > 1 + SetDictInt("BUTTON5_PRESSED", BUTTON5_PRESSED); + SetDictInt("BUTTON5_RELEASED", BUTTON5_RELEASED); + SetDictInt("BUTTON5_CLICKED", BUTTON5_CLICKED); + SetDictInt("BUTTON5_DOUBLE_CLICKED", BUTTON5_DOUBLE_CLICKED); + SetDictInt("BUTTON5_TRIPLE_CLICKED", BUTTON5_TRIPLE_CLICKED); +#endif + SetDictInt("BUTTON_SHIFT", BUTTON_SHIFT); SetDictInt("BUTTON_CTRL", BUTTON_CTRL); SetDictInt("BUTTON_ALT", BUTTON_ALT);