CURSES_MOUSE(3)

CURSES_MOUSE(3) | Library Functions Manual | CURSES_MOUSE(3)

# NAME

`has_mouse`, `getmouse`, `ungetmouse`, `mousemask`, `wenclose`, `mouse_trafo`, `wmouse_trafo`, `mouseinterval` — Curses mouse interface

# LIBRARY

Curses Library (libcurses, -lcurses)

# SYNOPSIS

`#include <curses.h>`

bool
`has_mouse`(void);

int
`getmouse`(MEVENT *event);

int
`ungetmouse`(MEVENT *event);

mmask_t
`mousemask`(mmask_t newmask, mmask_t *oldmask);

bool
`wenclose`(const WINDOW *win, int y, int x);

bool
`mouse_trafo`(int *y, int *x, bool to_screen);

bool
`wmouse_trafo`(const WINDOW *win, int *y, int *x, bool to_screen);

int
`mouseinterval`(int erval);

# DESCRIPTION

This is the curses interface to mouse events. Mouse events are reported via the `KEY_MOUSE` value in the wgetch(3) input stream.

The `has_mouse`() function returns true if the mouse support has been initialised for the terminal, otherwise false.

The `getmouse`() function reads a mouse event. The x and y values are screen relative and the state mask will have exactly one bit set to represent the event type. The `ungetmouse`() function behave like ungetch(3) and pushes the mouse event into the input stream.

The `mousemask`() function sets the mouse events to be reported. By default, there are no mouse events reported. It returns a mask indicating which of the specified mouse events can be reported, zero indicating a failure. If oldmask is given, it is filled with the previous mouse event mask.

The `wenclose`() function returns true if the screen relative x and y co-ordinates are enclosed by the window win, otherwise false.

The `wmouse_trafo`() function transforms the x and y co-ordinates from screen relative to window relative or vice versa depending on the value of to_screen. If the co-ordinates are not enclosed by the window win then false is returned, otherwise the x and y values are transformed and true is returned. The `mouse_trainfo`() function calls `wmouse_trainfo`() using stdscr for win.

The `mouseinterval`() function sets the maximum time that can elapse between press and release events, which determins a click. The value is in thousands of seconds. The default value is one fifth of a second. The returned value is the old value.

# RETURN VALUES

Unless otherwise noted, the functions that return an int will return one of the following values:

`OK`
  The function completed successfully.
`ERR`
  An error occurred in the function.

# SEE ALSO

wsmouse(4)

# STANDARDS

These functions are ncurses extensions to the Curses library.

# HISTORY

The mouse functions were added in NetBSD 10.0.

# BUGS

There is currently no actual mouse support, `has_mouse`() will always return false.

March 22, 2020 | NetBSD 11.0