emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/xterm.c


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/xterm.c
Date: Mon, 10 Oct 2005 14:58:45 -0400

Index: emacs/src/xterm.c
diff -c emacs/src/xterm.c:1.877 emacs/src/xterm.c:1.878
*** emacs/src/xterm.c:1.877     Fri Oct  7 07:40:18 2005
--- emacs/src/xterm.c   Mon Oct 10 18:58:43 2005
***************
*** 3582,3587 ****
--- 3582,3589 ----
  static XMotionEvent last_mouse_motion_event;
  static Lisp_Object last_mouse_motion_frame;
  
+ static void remember_mouse_glyph P_ ((struct frame *, int, int));
+ 
  static void
  note_mouse_movement (frame, event)
       FRAME_PTR frame;
***************
*** 3607,3612 ****
--- 3609,3616 ----
        frame->mouse_moved = 1;
        last_mouse_scroll_bar = Qnil;
        note_mouse_highlight (frame, event->x, event->y);
+       /* Remember which glyph we're now on.  */
+       remember_mouse_glyph (frame, event->x, event->y);
      }
  }
  
***************
*** 3677,3682 ****
--- 3681,3724 ----
  }
  
  
+ /* Remember which glyph the mouse is over.
+  */
+ static void
+ remember_mouse_glyph (f1, win_x, win_y)
+      FRAME_PTR f1;
+      int win_x, win_y;
+ {
+   int width, height, gx, gy;
+ 
+   /* Try getting the rectangle of the actual glyph.  */
+   if (!glyph_rect (f1, win_x, win_y, &last_mouse_glyph))
+     {
+       /* If there is no glyph under the mouse, then we divide the screen
+        into a grid of the smallest glyph in the frame, and use that
+        as our "glyph".  */
+       width = FRAME_SMALLEST_CHAR_WIDTH (f1);
+       height = FRAME_SMALLEST_FONT_HEIGHT (f1);
+       gx = win_x;
+       gy = win_y;
+ 
+       /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
+        round down even for negative values.  */
+       if (gx < 0)
+       gx -= width - 1;
+       if (gy < 0)
+       gy -= height - 1;
+ 
+       gx = gx / width * width;
+       gy = gy / width * width;
+ 
+       last_mouse_glyph.width  = width;
+       last_mouse_glyph.height = height;
+       last_mouse_glyph.x = gx;
+       last_mouse_glyph.y = gy;
+     }
+ }
+ 
+ 
  /* Return the current position of the mouse.
     *FP should be a frame which indicates which display to ask about.
  
***************
*** 3863,3894 ****
               on it, i.e. into the same rectangles that matrices on
               the frame are divided into.  */
  
!           int width, height, gx, gy;
!           XRectangle rect;
! 
!           if (glyph_rect (f1, win_x, win_y, &rect))
!             last_mouse_glyph = rect;
!           else
!             {
!               width = FRAME_SMALLEST_CHAR_WIDTH (f1);
!               height = FRAME_SMALLEST_FONT_HEIGHT (f1);
!               gx = win_x;
!               gy = win_y;
! 
!               /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
!                  round down even for negative values.  */
!               if (gx < 0)
!                 gx -= width - 1;
!               if (gy < 0)
!                 gy -= height - 1;
!               gx = (gx + width - 1) / width * width;
!               gy = (gy + height - 1) / height * height;
! 
!               last_mouse_glyph.width  = width;
!               last_mouse_glyph.height = height;
!               last_mouse_glyph.x = gx;
!               last_mouse_glyph.y = gy;
!             }
  
            *bar_window = Qnil;
            *part = 0;
--- 3905,3911 ----
               on it, i.e. into the same rectangles that matrices on
               the frame are divided into.  */
  
!           remember_mouse_glyph (f1, win_x, win_y);
  
            *bar_window = Qnil;
            *part = 0;




reply via email to

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