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 */
22 #include <sys/types.h>
31 #include "key.h" /* define sequence */
33 int mouse_enabled
= 0;
37 void show_mouse_pointer (int x
, int y
)
39 if (use_mouse_p
== MOUSE_GPM
) {
40 Gpm_DrawPointer (x
, y
, gpm_consolefd
);
43 #endif /* HAVE_LIBGPM */
45 void init_mouse (void)
47 switch (use_mouse_p
) {
50 use_mouse_p
= MOUSE_GPM
;
52 #endif /* HAVE_LIBGPM */
54 define_sequence (MCKEY_MOUSE
, xmouse_seq
, MCKEY_NOACTION
);
62 void enable_mouse (void)
68 switch (use_mouse_p
) {
75 conn
.eventMask
= ~GPM_MOVE
;
76 conn
.defaultMask
= GPM_MOVE
;
80 mouse_d
= Gpm_Open (&conn
, 0);
82 use_mouse_p
= MOUSE_NONE
;
88 #endif /* HAVE_LIBGPM */
90 /* save old highlight mouse tracking */
91 printf(ESC_STR
"[?1001s");
93 /* enable mouse tracking */
94 printf(ESC_STR
"[?1000h");
104 void disable_mouse (void)
106 if (!mouse_enabled
) {
112 switch (use_mouse_p
) {
119 /* disable mouse tracking */
120 printf(ESC_STR
"[?1000l");
122 /* restore old highlight mouse tracking */
123 printf(ESC_STR
"[?1001r");