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
);
63 void enable_mouse (void)
69 switch (use_mouse_p
) {
76 conn
.eventMask
= ~GPM_MOVE
;
77 conn
.defaultMask
= GPM_MOVE
;
81 mouse_d
= Gpm_Open (&conn
, 0);
83 use_mouse_p
= MOUSE_NONE
;
89 #endif /* HAVE_LIBGPM */
91 /* save old highlight mouse tracking */
92 printf(ESC_STR
"[?1001s");
94 /* enable mouse tracking */
95 printf(ESC_STR
"[?1000h");
103 void disable_mouse (void)
105 if (!mouse_enabled
) {
111 switch (use_mouse_p
) {
118 /* disable mouse tracking */
119 printf(ESC_STR
"[?1000l");
121 /* restore old highlight mouse tracking */
122 printf(ESC_STR
"[?1001r");