changed includes from ../mhl/ to <mhl/...>
[midnight-commander.git] / src / mouse.h
blob1ee85a17c32a0a186879e84455058cc54b1b4b96
1 #ifndef MC_MOUSE_H
2 #define MC_MOUSE_H
4 #ifdef HAVE_LIBGPM
6 /* GPM mouse support include file */
7 #include <gpm.h>
9 #else
11 /* Equivalent definitions for non-GPM mouse support */
12 /* These lines are modified version from the lines appearing in the */
13 /* gpm.h include file of the Linux General Purpose Mouse server */
15 #define GPM_B_LEFT (1 << 2)
16 #define GPM_B_MIDDLE (1 << 1)
17 #define GPM_B_RIGHT (1 << 0)
19 /* Xterm mouse support supports only GPM_DOWN and GPM_UP */
20 /* If you use others make sure your code also works without them */
21 enum Gpm_Etype {
22 GPM_MOVE=1,
23 GPM_DRAG=2, /* exactly one in four is active at a time */
24 GPM_DOWN=4,
25 GPM_UP= 8,
27 #define GPM_BARE_EVENTS(ev) ((ev)&0xF)
29 GPM_SINGLE=16, /* at most one in three is set */
30 GPM_DOUBLE=32,
31 GPM_TRIPLE=64,
33 GPM_MFLAG=128, /* motion during click? */
34 GPM_HARD=256 /* if set in the defaultMask, force an already
35 used event to pass over to another handler */
38 typedef struct Gpm_Event {
39 int buttons, x, y;
40 enum Gpm_Etype type;
41 } Gpm_Event;
43 #endif /* !HAVE_LIBGPM */
45 /* General (i.e. both for xterm and gpm) mouse support definitions */
47 /* Constants returned from the mouse callback */
48 enum { MOU_NORMAL, MOU_REPEAT };
50 /* Mouse callback */
51 typedef int (*mouse_h) (Gpm_Event *, void *);
53 /* Type of mouse support */
54 typedef enum {
55 MOUSE_NONE, /* Not detected yet */
56 MOUSE_DISABLED, /* Explicitly disabled by -d */
57 MOUSE_GPM, /* Support using GPM on Linux */
58 MOUSE_XTERM, /* Support using xterm-style mouse reporting */
59 MOUSE_XTERM_NORMAL_TRACKING = MOUSE_XTERM,
60 MOUSE_XTERM_BUTTON_EVENT_TRACKING
61 } Mouse_Type;
63 /* Type of the currently used mouse */
64 extern Mouse_Type use_mouse_p;
66 /* The mouse is currently: 1 - enabled, 0 - disabled */
67 extern int mouse_enabled;
69 /* String indicating that a mouse event has occured, usually "\E[M" */
70 extern const char *xmouse_seq;
72 void init_mouse (void);
73 void enable_mouse (void);
74 void disable_mouse (void);
76 /* Mouse wheel events */
77 #ifndef GPM_B_DOWN
78 #define GPM_B_DOWN (1 << 5)
79 #endif
81 #ifndef GPM_B_UP
82 #define GPM_B_UP (1 << 4)
83 #endif
85 #ifdef HAVE_LIBGPM
87 /* GPM specific mouse support definitions */
88 void show_mouse_pointer (int x, int y);
90 #else
92 /* Mouse support definitions for non-GPM mouse */
93 #define show_mouse_pointer(a,b)
95 #endif
97 #endif