comparison src/term.c @ 81811:c10410a3aa36

Include unistd.h for ttyname, used in handle_one_term_event. (term_show_mouse_face): Remove unused var `j'. (handle_one_term_event): Remove unused vars `i' and `j'. Don't cast return value of ttyname since it's not necessary.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 11 Jul 2007 15:22:11 +0000
parents 16181a4d64bf
children e6ed0991129c
comparison
equal deleted inserted replaced
81810:63cd48f8fc9f 81811:c10410a3aa36
23 23
24 #include <config.h> 24 #include <config.h>
25 #include <stdio.h> 25 #include <stdio.h>
26 #include <ctype.h> 26 #include <ctype.h>
27 #include <string.h> 27 #include <string.h>
28 #include <unistd.h>
28 29
29 #include "termchar.h" 30 #include "termchar.h"
30 #include "termopts.h" 31 #include "termopts.h"
31 #include "lisp.h" 32 #include "lisp.h"
32 #include "charset.h" 33 #include "charset.h"
2379 2380
2380 #ifdef HAVE_GPM 2381 #ifdef HAVE_GPM
2381 void 2382 void
2382 term_mouse_moveto (int x, int y) 2383 term_mouse_moveto (int x, int y)
2383 { 2384 {
2385 /* TODO: how to set mouse position?
2384 const char *name; 2386 const char *name;
2385 int fd; 2387 int fd;
2386 /* TODO: how to set mouse position?
2387 name = (const char *) ttyname (0); 2388 name = (const char *) ttyname (0);
2388 fd = open (name, O_WRONLY); 2389 fd = open (name, O_WRONLY);
2389 SOME_FUNCTION (x, y, fd); 2390 SOME_FUNCTION (x, y, fd);
2390 close (fd); 2391 close (fd);
2391 last_mouse_x = x; 2392 last_mouse_x = x;
2395 static void 2396 static void
2396 term_show_mouse_face (enum draw_glyphs_face draw) 2397 term_show_mouse_face (enum draw_glyphs_face draw)
2397 { 2398 {
2398 struct window *w = XWINDOW (Qmouse_face_window); 2399 struct window *w = XWINDOW (Qmouse_face_window);
2399 int save_x, save_y; 2400 int save_x, save_y;
2400 int i, j; 2401 int i;
2401 2402
2402 if (/* If window is in the process of being destroyed, don't bother 2403 if (/* If window is in the process of being destroyed, don't bother
2403 to do anything. */ 2404 to do anything. */
2404 w->current_matrix != NULL 2405 w->current_matrix != NULL
2405 /* Recognize when we are called to operate on rows that don't exist 2406 /* Recognize when we are called to operate on rows that don't exist
2915 2916
2916 int 2917 int
2917 handle_one_term_event (Gpm_Event *event, struct input_event* hold_quit) 2918 handle_one_term_event (Gpm_Event *event, struct input_event* hold_quit)
2918 { 2919 {
2919 struct frame *f = SELECTED_FRAME (); 2920 struct frame *f = SELECTED_FRAME ();
2920 int i, j, fd; 2921 int fd;
2921 struct input_event ie; 2922 struct input_event ie;
2922 int do_help = 0; 2923 int do_help = 0;
2923 int count = 0; 2924 int count = 0;
2924 2925
2925 EVENT_INIT (ie); 2926 EVENT_INIT (ie);
2939 2940
2940 arg[0] = arg[2] = (unsigned short) event->x + gpm_zerobased; 2941 arg[0] = arg[2] = (unsigned short) event->x + gpm_zerobased;
2941 arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased; 2942 arg[1] = arg[3] = (unsigned short) event->y + gpm_zerobased;
2942 arg[4] = (unsigned short) 3; 2943 arg[4] = (unsigned short) 3;
2943 2944
2944 name = (const char *) ttyname (0); 2945 name = ttyname (0);
2945 fd = open (name, O_WRONLY); 2946 fd = open (name, O_WRONLY);
2946 ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1); 2947 ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1);
2947 close (fd); 2948 close (fd);
2948 2949
2949 if (!term_mouse_movement (f, event)) 2950 if (!term_mouse_movement (f, event))