2 Copyright (C) 1994 Miguel de Icaza.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /* Events received by clients of this library have their coordinates 0 */
24 #include <sys/types.h>
34 #include "key.h" /* define sequence */
36 int mouse_enabled
= 0;
40 void show_mouse_pointer (int x
, int y
)
42 if (use_mouse_p
== MOUSE_GPM
) {
43 Gpm_DrawPointer (x
, y
, gpm_consolefd
);
46 #endif /* HAVE_LIBGPM */
48 void init_mouse (void)
50 switch (use_mouse_p
) {
53 use_mouse_p
= MOUSE_GPM
;
55 #endif /* HAVE_LIBGPM */
57 define_sequence (MCKEY_MOUSE
, xmouse_seq
, MCKEY_NOACTION
);
65 void enable_mouse (void)
71 switch (use_mouse_p
) {
78 conn
.eventMask
= ~GPM_MOVE
;
79 conn
.defaultMask
= GPM_MOVE
;
83 mouse_d
= Gpm_Open (&conn
, 0);
85 use_mouse_p
= MOUSE_NONE
;
91 #endif /* HAVE_LIBGPM */
93 /* save old highlight mouse tracking */
94 printf(ESC_STR
"[?1001s");
96 /* enable mouse tracking */
97 printf(ESC_STR
"[?1000h");
107 void disable_mouse (void)
109 if (!mouse_enabled
) {
115 switch (use_mouse_p
) {
122 /* disable mouse tracking */
123 printf(ESC_STR
"[?1000l");
125 /* restore old highlight mouse tracking */
126 printf(ESC_STR
"[?1001r");