home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / shell / dialog-0.000 / dialog-0 / dialog-0.6c / old / gpm-xterm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-07  |  3.6 KB  |  122 lines

  1.  
  2. /*
  3.  * gpm-xterm.h - pseudo client for non-Linux xterm only mouse support.
  4.  *               This code has been extracted from libgpm-0.18 and then
  5.  *               took its own way.
  6.  *
  7.  * Copyright 1994   rubini@ipvvis.unipv.it (Alessandro Rubini)
  8.  * Copyright 1994   miguel@roxanne.nuclecu.unam.mx (Miguel de Icaza)
  9.  *
  10.  *   This program is free software; you can redistribute it and/or modify
  11.  *   it under the terms of the GNU General Public License as published by
  12.  *   the Free Software Foundation; either version 2 of the License, or
  13.  *   (at your option) any later version.
  14.  *
  15.  *   This program is distributed in the hope that it will be useful,
  16.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *   GNU General Public License for more details.
  19.  *
  20.  *   You should have received a copy of the GNU General Public License
  21.  *   along with this program; if not, write to the Free Software
  22.  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  ********/
  24.  
  25. #ifndef _GPM_XTERM_H_
  26. #define _GPM_XTERM_H_
  27.  
  28. /*....................................... Xtermish stuff */
  29. #define GPM_XTERM_ON \
  30.   printf("%c[?1001s",27), fflush(stdout), /* save old hilit tracking */ \
  31.   printf("%c[?1000h",27), fflush(stdout)    /* enable mouse tracking */
  32.  
  33. #define GPM_XTERM_OFF \
  34.   printf("%c[?10001",27), fflush(stdout), /* disable mouse tracking */ \
  35.   printf("%c[?1001r",27), fflush(stdout)    /* restore old hilittracking */
  36.  
  37. /*....................................... Cfg buttons */
  38.  
  39. #define GPM_B_LEFT      4
  40. #define GPM_B_MIDDLE    2
  41. #define GPM_B_RIGHT     1
  42.  
  43. /*....................................... The event types */
  44.  
  45. enum Gpm_Etype {
  46.     GPM_MOVE = 1,
  47.     GPM_DRAG = 2,        /* exactly one in four is active at a time */
  48.     GPM_DOWN = 4,
  49.     GPM_UP = 8,
  50.  
  51. #define GPM_BARE_EVENTS(ev) ((ev)&0xF)
  52.  
  53.     GPM_SINGLE = 16,        /* at most one in three is set */
  54.     GPM_DOUBLE = 32,
  55.     GPM_TRIPLE = 64,        /* WARNING: I depend on the values */
  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.  
  62. /*....................................... The event data structure */
  63.  
  64. enum Gpm_Margin {
  65.     GPM_TOP = 1, GPM_BOT = 2, GPM_LFT = 4, GPM_RGT = 8
  66. };
  67.  
  68.  
  69. typedef struct Gpm_Event {
  70.     unsigned char buttons, modifiers;    /* try to be a multiple of 4 */
  71.     unsigned short vc;
  72.     short dx, dy, x, y;
  73.     enum Gpm_Etype type;
  74.     int clicks;
  75.     enum Gpm_Margin margin;
  76. } Gpm_Event;
  77.  
  78. /*....................................... The connection data structure */
  79.  
  80. #define GPM_MAGIC 0x47706D4C    /* "GpmL" */
  81. typedef struct Gpm_Connect {
  82.     unsigned short eventMask, defaultMask;
  83.     unsigned short minMod, maxMod;
  84.     int pid;
  85.     int vc;
  86. } Gpm_Connect;
  87.  
  88.  
  89. /*....................................... Global variables for the client */
  90.  
  91. extern int gpm_flag, gpm_ctlfd, gpm_fd, gpm_hflag, gpm_morekeys;
  92.  
  93. typedef int Gpm_Handler (Gpm_Event * event, void *clientdata);
  94.  
  95. extern Gpm_Handler *gpm_handler;
  96. extern void *gpm_data;
  97.  
  98. extern int Gpm_Open (Gpm_Connect *, int);
  99. extern int Gpm_Close (void);
  100. extern int Gpm_Getc (FILE *);
  101. #define    Gpm_Getchar() Gpm_Getc(stdin)
  102. extern int Gpm_Repeat (int millisec);
  103.  
  104. /* #include <curses.h> Hmm... risky... */
  105.  
  106. extern int Gpm_Wgetch ();
  107. #define Gpm_Getch() (Gpm_Wgetch(NULL))
  108.  
  109. /* disable the functions available in libgpm but not here */
  110. #define    Gpm_FitValuesM(x, y, margin)
  111. #define    Gpm_FitValues(x,y)
  112. #define    Gpm_FitEvent(ePtr)
  113.  
  114. #define Gpm_DrawPointer(x,y,fd)
  115. #define GPM_DRAWPOINTER(ePtr)
  116.  
  117. /* This material comes from gpmCfg.h */
  118. #define SELECT_TIME 60
  119.  
  120.  
  121. #endif /* _GPM_XTERM_H_ */
  122.