2009-02-05 21:28:18 +03:00
|
|
|
|
|
|
|
/** \file mouse.h
|
|
|
|
* \brief Header: mouse managing
|
|
|
|
*
|
|
|
|
* Events received by clients of this library have their coordinates 0 based
|
|
|
|
*/
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
#ifndef MC__MOUSE_H
|
|
|
|
#define MC__MOUSE_H
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBGPM
|
|
|
|
/* GPM mouse support include file */
|
|
|
|
#include <gpm.h>
|
2010-11-08 13:21:45 +03:00
|
|
|
#endif /* !HAVE_LIBGPM */
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
#ifndef HAVE_LIBGPM
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Equivalent definitions for non-GPM mouse support */
|
|
|
|
/* These lines are modified version from the lines appearing in the */
|
|
|
|
/* gpm.h include file of the Linux General Purpose Mouse server */
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
#define GPM_B_LEFT (1 << 2)
|
2005-02-08 09:57:14 +03:00
|
|
|
#define GPM_B_MIDDLE (1 << 1)
|
|
|
|
#define GPM_B_RIGHT (1 << 0)
|
2004-12-03 22:17:46 +03:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
#define GPM_BARE_EVENTS(ev) ((ev)&0xF)
|
|
|
|
#endif /* !HAVE_LIBGPM */
|
|
|
|
|
|
|
|
/* Mouse wheel events */
|
|
|
|
#ifndef GPM_B_DOWN
|
|
|
|
#define GPM_B_DOWN (1 << 5)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef GPM_B_UP
|
|
|
|
#define GPM_B_UP (1 << 4)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Mouse callback */
|
|
|
|
typedef int (*mouse_h) (Gpm_Event *, void *);
|
|
|
|
|
|
|
|
/*** enums ***************************************************************************************/
|
|
|
|
|
|
|
|
#ifndef HAVE_LIBGPM
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Xterm mouse support supports only GPM_DOWN and GPM_UP */
|
|
|
|
/* If you use others make sure your code also works without them */
|
2010-11-08 13:21:45 +03:00
|
|
|
enum Gpm_Etype
|
|
|
|
{
|
2009-09-17 02:07:04 +04:00
|
|
|
GPM_MOVE = 1,
|
|
|
|
GPM_DRAG = 2, /* exactly one in four is active at a time */
|
|
|
|
GPM_DOWN = 4,
|
|
|
|
GPM_UP = 8,
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
|
2009-09-17 02:07:04 +04:00
|
|
|
GPM_SINGLE = 16, /* at most one in three is set */
|
|
|
|
GPM_DOUBLE = 32,
|
|
|
|
GPM_TRIPLE = 64,
|
2004-12-03 22:17:46 +03:00
|
|
|
|
2009-09-17 02:07:04 +04:00
|
|
|
GPM_MFLAG = 128, /* motion during click? */
|
|
|
|
GPM_HARD = 256 /* if set in the defaultMask, force an already
|
|
|
|
used event to pass over to another handler */
|
1998-02-27 07:54:42 +03:00
|
|
|
};
|
2001-09-17 08:43:58 +04:00
|
|
|
#endif /* !HAVE_LIBGPM */
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2002-09-22 09:49:17 +04:00
|
|
|
/* Constants returned from the mouse callback */
|
2010-11-08 13:21:45 +03:00
|
|
|
enum
|
|
|
|
{ MOU_NORMAL, MOU_REPEAT };
|
2002-09-22 09:49:17 +04:00
|
|
|
|
|
|
|
/* Type of mouse support */
|
2010-11-08 13:21:45 +03:00
|
|
|
typedef enum
|
|
|
|
{
|
2009-09-17 02:07:04 +04:00
|
|
|
MOUSE_NONE, /* Not detected yet */
|
|
|
|
MOUSE_DISABLED, /* Explicitly disabled by -d */
|
|
|
|
MOUSE_GPM, /* Support using GPM on Linux */
|
|
|
|
MOUSE_XTERM, /* Support using xterm-style mouse reporting */
|
2006-03-06 12:28:14 +03:00
|
|
|
MOUSE_XTERM_NORMAL_TRACKING = MOUSE_XTERM,
|
|
|
|
MOUSE_XTERM_BUTTON_EVENT_TRACKING
|
2001-09-17 08:43:58 +04:00
|
|
|
} Mouse_Type;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
|
|
|
|
|
|
#ifndef HAVE_LIBGPM
|
|
|
|
typedef struct Gpm_Event
|
|
|
|
{
|
|
|
|
int buttons, x, y;
|
|
|
|
enum Gpm_Etype type;
|
|
|
|
} Gpm_Event;
|
|
|
|
#endif /* !HAVE_LIBGPM */
|
|
|
|
|
|
|
|
|
|
|
|
/*** global variables defined in .c file *********************************************************/
|
|
|
|
|
2001-09-17 08:43:58 +04:00
|
|
|
/* Type of the currently used mouse */
|
|
|
|
extern Mouse_Type use_mouse_p;
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2001-09-15 20:54:40 +04:00
|
|
|
/* String indicating that a mouse event has occured, usually "\E[M" */
|
2004-08-30 03:27:40 +04:00
|
|
|
extern const char *xmouse_seq;
|
2001-09-15 20:54:40 +04:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** declarations of public functions ************************************************************/
|
|
|
|
|
|
|
|
/* General (i.e. both for xterm and gpm) mouse support definitions */
|
|
|
|
|
2001-09-17 08:43:58 +04:00
|
|
|
void init_mouse (void);
|
|
|
|
void enable_mouse (void);
|
|
|
|
void disable_mouse (void);
|
1998-02-27 07:54:42 +03:00
|
|
|
|
|
|
|
void show_mouse_pointer (int x, int y);
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** inline functions ****************************************************************************/
|
2009-09-17 02:07:04 +04:00
|
|
|
#endif /* MC_MOUSE_H */
|