/[emacs]/emacs/src/xterm.c
ViewVC logotype

Diff of /emacs/src/xterm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.879 by kfstorm, Mon Oct 10 22:54:19 2005 UTC revision 1.880 by kfstorm, Tue Oct 11 22:37:01 2005 UTC
# Line 3582  construct_mouse_click (result, event, f) Line 3582  construct_mouse_click (result, event, f)
3582  static XMotionEvent last_mouse_motion_event;  static XMotionEvent last_mouse_motion_event;
3583  static Lisp_Object last_mouse_motion_frame;  static Lisp_Object last_mouse_motion_frame;
3584    
 static void remember_mouse_glyph P_ ((struct frame *, int, int));  
   
3585  static void  static void
3586  note_mouse_movement (frame, event)  note_mouse_movement (frame, event)
3587       FRAME_PTR frame;       FRAME_PTR frame;
# Line 3610  note_mouse_movement (frame, event) Line 3608  note_mouse_movement (frame, event)
3608        last_mouse_scroll_bar = Qnil;        last_mouse_scroll_bar = Qnil;
3609        note_mouse_highlight (frame, event->x, event->y);        note_mouse_highlight (frame, event->x, event->y);
3610        /* Remember which glyph we're now on.  */        /* Remember which glyph we're now on.  */
3611        remember_mouse_glyph (frame, event->x, event->y);        remember_mouse_glyph (frame, event->x, event->y, &last_mouse_glyph);
3612      }      }
3613  }  }
3614    
# Line 3630  redo_mouse_highlight () Line 3628  redo_mouse_highlight ()
3628  }  }
3629    
3630    
 static int glyph_rect P_ ((struct frame *f, int, int, XRectangle *));  
   
   
 /* Try to determine frame pixel position and size of the glyph under  
    frame pixel coordinates X/Y on frame F .  Return the position and  
    size in *RECT.  Value is non-zero if we could compute these  
    values.  */  
   
 static int  
 glyph_rect (f, x, y, rect)  
      struct frame *f;  
      int x, y;  
      XRectangle *rect;  
 {  
   Lisp_Object window;  
   struct window *w;  
   struct glyph_row *r, *end_row;  
   enum window_part part;  
   
   window = window_from_coordinates (f, x, y, &part, &x, &y, 0);  
   if (NILP (window))  
     return 0;  
   
   w = XWINDOW (window);  
   r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);  
   end_row = r + w->current_matrix->nrows - 1;  
   
   if (part != ON_TEXT)  
     return 0;  
   
   for (; r < end_row && r->enabled_p; ++r)  
     {  
       if (r->y >= y)  
         {  
           struct glyph *g = r->glyphs[TEXT_AREA];  
           struct glyph *end = g + r->used[TEXT_AREA];  
           int gx = r->x;  
           while (g < end && gx < x)  
             gx += g->pixel_width, ++g;  
           if (g < end)  
             {  
               rect->width = g->pixel_width;  
               rect->height = r->height;  
               rect->x = WINDOW_TO_FRAME_PIXEL_X (w, gx);  
               rect->y = WINDOW_TO_FRAME_PIXEL_Y (w, r->y);  
               return 1;  
             }  
           break;  
         }  
     }  
   
   return 0;  
 }  
   
   
 /* 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;  
     }  
 }  
   
3631    
3632  /* Return the current position of the mouse.  /* Return the current position of the mouse.
3633     *FP should be a frame which indicates which display to ask about.     *FP should be a frame which indicates which display to ask about.
# Line 3909  XTmouse_position (fp, insist, bar_window Line 3815  XTmouse_position (fp, insist, bar_window
3815                 on it, i.e. into the same rectangles that matrices on                 on it, i.e. into the same rectangles that matrices on
3816                 the frame are divided into.  */                 the frame are divided into.  */
3817    
3818              remember_mouse_glyph (f1, win_x, win_y);              remember_mouse_glyph (f1, win_x, win_y, &last_mouse_glyph);
3819    
3820              *bar_window = Qnil;              *bar_window = Qnil;
3821              *part = 0;              *part = 0;

Legend:
Removed from v.1.879  
changed lines
  Added in v.1.880

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26