3 * \brief Header: mouse managing
5 * Events received by clients of this library have their coordinates 0 based
12 /* GPM mouse support include file */
14 #endif /* !HAVE_LIBGPM */
17 /*** typedefs(not structures) and defined constants **********************************************/
20 /* Equivalent definitions for non-GPM mouse support */
21 /* These lines are modified version from the lines appearing in the */
22 /* gpm.h include file of the Linux General Purpose Mouse server */
24 #define GPM_B_LEFT (1 << 2)
25 #define GPM_B_MIDDLE (1 << 1)
26 #define GPM_B_RIGHT (1 << 0)
28 #define GPM_BARE_EVENTS(ev) ((ev)&0xF)
29 #endif /* !HAVE_LIBGPM */
31 /* Mouse wheel events */
33 #define GPM_B_DOWN (1 << 5)
37 #define GPM_B_UP (1 << 4)
40 /*** enums ***************************************************************************************/
43 /* Xterm mouse support supports only GPM_DOWN and GPM_UP */
44 /* If you use others make sure your code also works without them */
48 GPM_DRAG
= 2, /* exactly one in four is active at a time */
53 GPM_SINGLE
= 16, /* at most one in three is set */
57 GPM_MFLAG
= 128, /* motion during click? */
58 GPM_HARD
= 256 /* if set in the defaultMask, force an already
59 used event to pass over to another handler */
61 #endif /* !HAVE_LIBGPM */
63 /* Constants returned from the mouse callback */
70 /* Type of mouse support */
73 MOUSE_NONE
, /* Not detected yet */
74 MOUSE_DISABLED
, /* Explicitly disabled by -d */
75 MOUSE_GPM
, /* Support using GPM on Linux */
76 MOUSE_XTERM
, /* Support using xterm-style mouse reporting */
77 MOUSE_XTERM_NORMAL_TRACKING
= MOUSE_XTERM
,
78 MOUSE_XTERM_BUTTON_EVENT_TRACKING
81 /*** structures declarations (and typedefs of structures)*****************************************/
84 typedef struct Gpm_Event
89 #endif /* !HAVE_LIBGPM */
92 typedef int (*mouse_h
) (Gpm_Event
*, void *);
94 /*** global variables defined in .c file *********************************************************/
96 /* Type of the currently used mouse */
97 extern Mouse_Type use_mouse_p
;
99 /* String indicating that a mouse event has occured, usually "\E[M" */
100 extern const char *xmouse_seq
;
102 /*** declarations of public functions ************************************************************/
104 /* General (i.e. both for xterm and gpm) mouse support definitions */
106 void init_mouse (void);
107 void enable_mouse (void);
108 void disable_mouse (void);
110 void show_mouse_pointer (int x
, int y
);
112 /*** inline functions ****************************************************************************/
113 #endif /* MC_MOUSE_H */