emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/term.c,v


From: Nick Roberts
Subject: [Emacs-diffs] Changes to emacs/src/term.c,v
Date: Wed, 30 May 2007 05:19:56 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Nick Roberts <nickrob>  07/05/30 05:19:56

Index: term.c
===================================================================
RCS file: /sources/emacs/emacs/src/term.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -b -r1.180 -r1.181
--- term.c      26 May 2007 17:21:14 -0000      1.180
+++ term.c      30 May 2007 05:19:55 -0000      1.181
@@ -425,7 +425,7 @@
 static int mouse_face_beg_row, mouse_face_beg_col;
 static int mouse_face_end_row, mouse_face_end_col;
 static int mouse_face_past_end;
-static Lisp_Object mouse_face_window;
+static Lisp_Object Qmouse_face_window;
 static int mouse_face_face_id;
 
 /* FRAME and X, Y position of mouse when last checked for
@@ -2382,10 +2382,23 @@
  ***********************************************************************/
 
 #ifdef HAVE_GPM
+void term_mouse_moveto (int x, int y)
+{
+  const char *name;
+  int fd;
+  name = (const char *) ttyname (0);
+  fd = open (name, O_WRONLY);
+  /* TODO: how to set mouse position?
+     SOME_FUNCTION (x, y, fd);  */
+  close (fd);
+  last_mouse_x = x;
+  last_mouse_y = y;
+}
+
 static void
 term_show_mouse_face (enum draw_glyphs_face draw)
 {
-  struct window *w = XWINDOW (mouse_face_window);
+  struct window *w = XWINDOW (Qmouse_face_window);
   int save_x, save_y;
   int i, j;
 
@@ -2461,12 +2474,12 @@
 static void
 term_clear_mouse_face ()
 {
-  if (!NILP (mouse_face_window))
+  if (!NILP (Qmouse_face_window))
     term_show_mouse_face (DRAW_NORMAL_TEXT);
 
   mouse_face_beg_row = mouse_face_beg_col = -1;
   mouse_face_end_row = mouse_face_end_col = -1;
-  mouse_face_window = Qnil;
+  Qmouse_face_window = Qnil;
 }
 
 /* Find the glyph matrix position of buffer position POS in window W.
@@ -2567,7 +2580,7 @@
   if (!WINDOWP (window))
     return;
 
-  if (!EQ (window, mouse_face_window))
+  if (!EQ (window, Qmouse_face_window))
     term_clear_mouse_face ();
 
   w = XWINDOW (window);
@@ -2650,7 +2663,7 @@
        noverlays = sort_overlays (overlay_vec, noverlays, w);
 
        /* Check mouse-face highlighting.  */
-       if (!(EQ (window, mouse_face_window)
+       if (!(EQ (window, Qmouse_face_window)
              && y >= mouse_face_beg_row
              && y <= mouse_face_end_row
              && (y > mouse_face_beg_row
@@ -2700,7 +2713,7 @@
                  = !fast_find_position (w, XFASTINT (after),
                                         &mouse_face_end_col,
                                         &mouse_face_end_row);
-               mouse_face_window = window;
+               Qmouse_face_window = window;
 
                mouse_face_face_id
                  = face_at_buffer_position (w, pos, 0, 0,
@@ -2735,7 +2748,7 @@
                  = !fast_find_position (w, XFASTINT (after),
                                         &mouse_face_end_col,
                                         &mouse_face_end_row);
-               mouse_face_window = window;
+               Qmouse_face_window = window;
 
                mouse_face_face_id
                  = face_at_buffer_position (w, pos, 0, 0,
@@ -2822,33 +2835,31 @@
    Set *time to the time the mouse was at the returned position.
 
    This should clear mouse_moved until the next motion
-   event arrives.
-
-   NOT CURRENTLY INVOKED: see mouse_position_hook below.  */
+   event arrives.  */
 static void
 term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
                     enum scroll_bar_part *part, Lisp_Object *x,
                     Lisp_Object *y, unsigned long *time)
 {
-  Gpm_Event event;
   struct timeval now;
-  int i;
-
-  BLOCK_INPUT;
+  Lisp_Object frame, window;
+  struct window *w;
 
   *fp = SELECTED_FRAME ();
+  (*fp)->mouse_moved = 0;
 
   *bar_window = Qnil;
   *part = 0;
 
-  i = Gpm_GetSnapshot (&event);
+  XSETINT (*x, last_mouse_x); 
+  XSETINT (*y, last_mouse_y);
+  XSETFRAME (frame, *fp);
+  window = Fwindow_at (*x, *y, frame);
 
-  XSETINT (*x, event.x);
-  XSETINT (*y, event.y);
+  XSETINT (*x, last_mouse_x - WINDOW_LEFT_EDGE_COL (XWINDOW (window)));
+  XSETINT (*y, last_mouse_y - WINDOW_TOP_EDGE_LINE (XWINDOW (window)));
   gettimeofday(&now, 0);
   *time = (now.tv_sec * 1000) + (now.tv_usec / 1000);
-
-  UNBLOCK_INPUT;
 }
 
 /* Prepare a mouse-event in *RESULT for placement in the input queue.
@@ -2947,7 +2958,7 @@
     name = (const char *) ttyname (0);
     fd = open (name, O_WRONLY);
     ioctl (fd, TIOCLINUX, buf + sizeof (short) - 1);
-    close(fd);
+    close (fd);
 
     term_mouse_movement (f, event);
 
@@ -2962,7 +2973,6 @@
   else {
     f->mouse_moved = 0;
     term_mouse_click (&ie, event, f);
-    //kbd_buffer_store_event_hold (&ie, hold_quit);
   }
 
  done:
@@ -3046,11 +3056,8 @@
   encode_terminal_bufsize = 0;
 
 #ifdef HAVE_GPM
-  /* TODO: Can't get Gpm_Snapshot in term_mouse_position to work: test with
-     (mouse-position).  Also set-mouse-position won't work as is.  */
-  /* mouse_position_hook = term_mouse_position;  */
-
-  mouse_face_window = Qnil;
+  mouse_position_hook = term_mouse_position;
+  Qmouse_face_window = Qnil;
 #endif
 
 #ifdef WINDOWSNT
@@ -3503,6 +3510,8 @@
 #ifdef HAVE_GPM
   defsubr (&Sterm_open_connection);
   defsubr (&Sterm_close_connection);
+
+  staticpro (&Qmouse_face_window);
 #endif /* HAVE_GPM */
 
   fullscreen_hook = NULL;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]