root/lib/tty/mouse.h

/* [previous][next][first][last][top][bottom][index][help]  */

INCLUDED FROM


   1 
   2 /** \file mouse.h
   3  *  \brief Header: mouse managing
   4  *
   5  *  Events received by clients of this library have their coordinates 0 based
   6  */
   7 
   8 #ifndef MC__MOUSE_H
   9 #define MC__MOUSE_H
  10 
  11 #ifdef HAVE_LIBGPM
  12 /* GPM mouse support include file */
  13 #include <gpm.h>
  14 #endif /* !HAVE_LIBGPM */
  15 
  16 
  17 /*** typedefs(not structures) and defined constants **********************************************/
  18 
  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 */
  23 
  24 #define GPM_B_LEFT      (1 << 2)
  25 #define GPM_B_MIDDLE    (1 << 1)
  26 #define GPM_B_RIGHT     (1 << 0)
  27 
  28 #define GPM_BARE_EVENTS(ev) ((ev)&0xF)
  29 #endif /* !HAVE_LIBGPM */
  30 
  31 /* Mouse wheel events */
  32 #ifndef GPM_B_DOWN
  33 #define GPM_B_DOWN      (1 << 5)
  34 #endif
  35 
  36 #ifndef GPM_B_UP
  37 #define GPM_B_UP        (1 << 4)
  38 #endif
  39 
  40 /*** enums ***************************************************************************************/
  41 
  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
  46 {
  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,
  51 
  52 
  53     GPM_SINGLE = 16,            /* at most one in three is set */
  54     GPM_DOUBLE = 32,
  55     GPM_TRIPLE = 64,
  56 
  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 */
  60 };
  61 #endif /* !HAVE_LIBGPM */
  62 
  63 /* Constants returned from the mouse callback */
  64 enum
  65 {
  66     MOU_UNHANDLED = 0,
  67     MOU_NORMAL,
  68     MOU_REPEAT
  69 };
  70 
  71 /* Type of mouse support */
  72 typedef enum
  73 {
  74     MOUSE_NONE,                 /* Not detected yet */
  75     MOUSE_DISABLED,             /* Explicitly disabled by -d */
  76     MOUSE_GPM,                  /* Support using GPM on Linux */
  77     MOUSE_XTERM,                /* Support using xterm-style mouse reporting */
  78     MOUSE_XTERM_NORMAL_TRACKING = MOUSE_XTERM,
  79     MOUSE_XTERM_BUTTON_EVENT_TRACKING
  80 } Mouse_Type;
  81 
  82 /*** structures declarations (and typedefs of structures)*****************************************/
  83 
  84 #ifndef HAVE_LIBGPM
  85 typedef struct Gpm_Event
  86 {
  87     int buttons, x, y;
  88     enum Gpm_Etype type;
  89 } Gpm_Event;
  90 #endif /* !HAVE_LIBGPM */
  91 
  92 /*** global variables defined in .c file *********************************************************/
  93 
  94 /* Type of the currently used mouse */
  95 extern Mouse_Type use_mouse_p;
  96 
  97 /* To be used when gpm_fd were initially >= 0 */
  98 extern int mouse_fd;
  99 
 100 /* String indicating that a mouse event has occurred, usually "\E[M" */
 101 extern const char *xmouse_seq;
 102 
 103 /* String indicating that an SGR extended mouse event has occurred, namely "\E[<" */
 104 extern const char *xmouse_extended_seq;
 105 
 106 /*** declarations of public functions ************************************************************/
 107 
 108 /* General (i.e. both for xterm and gpm) mouse support definitions */
 109 
 110 void init_mouse (void);
 111 void enable_mouse (void);
 112 void disable_mouse (void);
 113 
 114 void show_mouse_pointer (int x, int y);
 115 
 116 /*** inline functions ****************************************************************************/
 117 #endif /* MC_MOUSE_H */

/* [previous][next][first][last][top][bottom][index][help]  */