Ticket #2762: mc ignores second directory argument.
[midnight-commander.git] / lib / tty / mouse.h
blob638eca49dbadb064402171ec9b462673045d1d5b
2 /** \file mouse.h
3 * \brief Header: mouse managing
5 * Events received by clients of this library have their coordinates 0 based
6 */
8 #ifndef MC__MOUSE_H
9 #define MC__MOUSE_H
11 #ifdef HAVE_LIBGPM
12 /* GPM mouse support include file */
13 #include <gpm.h>
14 #endif /* !HAVE_LIBGPM */
17 /*** typedefs(not structures) and defined constants **********************************************/
19 #ifndef HAVE_LIBGPM
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 */
32 #ifndef GPM_B_DOWN
33 #define GPM_B_DOWN (1 << 5)
34 #endif
36 #ifndef GPM_B_UP
37 #define GPM_B_UP (1 << 4)
38 #endif
40 /*** enums ***************************************************************************************/
42 #ifndef HAVE_LIBGPM
43 /* Xterm mouse support supports only GPM_DOWN and GPM_UP */
44 /* If you use others make sure your code also works without them */
45 enum Gpm_Etype
47 GPM_MOVE = 1,
48 GPM_DRAG = 2, /* exactly one in four is active at a time */
49 GPM_DOWN = 4,
50 GPM_UP = 8,
53 GPM_SINGLE = 16, /* at most one in three is set */
54 GPM_DOUBLE = 32,
55 GPM_TRIPLE = 64,
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 */
64 enum
66 MOU_NORMAL,
67 MOU_REPEAT
70 /* Type of mouse support */
71 typedef enum
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
79 } Mouse_Type;
81 /*** structures declarations (and typedefs of structures)*****************************************/
83 #ifndef HAVE_LIBGPM
84 typedef struct Gpm_Event
86 int buttons, x, y;
87 enum Gpm_Etype type;
88 } Gpm_Event;
89 #endif /* !HAVE_LIBGPM */
91 /* Mouse callback */
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 */