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

Diff of /emacs/src/w32term.c

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

revision 1.183 by kfstorm, Fri Mar 21 21:47:46 2003 UTC revision 1.184 by kfstorm, Fri Mar 21 22:56:51 2003 UTC
# Line 2800  x_get_keysym_name (keysym) Line 2800  x_get_keysym_name (keysym)
2800    
2801  /* Mouse clicks and mouse movement.  Rah.  */  /* Mouse clicks and mouse movement.  Rah.  */
2802    
 /* Given a pixel position (PIX_X, PIX_Y) on frame F, return glyph  
    co-ordinates in (*X, *Y).  Set *BOUNDS to the rectangle that the  
    glyph at X, Y occupies, if BOUNDS != 0.  If NOCLIP is non-zero, do  
    not force the value into range.  */  
   
 void  
 pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)  
      FRAME_PTR f;  
      register int pix_x, pix_y;  
      register int *x, *y;  
      RECT *bounds;  
      int noclip;  
 {  
   /* Support tty mode: if Vwindow_system is nil, behave correctly. */  
   if (NILP (Vwindow_system))  
     {  
       *x = pix_x;  
       *y = pix_y;  
       return;  
     }  
   
   /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to round down  
      even for negative values.  */  
   if (pix_x < 0)  
     pix_x -= FONT_WIDTH (FRAME_FONT (f)) - 1;  
   if (pix_y < 0)  
     pix_y -= (f)->output_data.w32->line_height - 1;  
   
   pix_x = PIXEL_TO_CHAR_COL (f, pix_x);  
   pix_y = PIXEL_TO_CHAR_ROW (f, pix_y);  
   
   if (bounds)  
     {  
       bounds->left = CHAR_TO_PIXEL_COL (f, pix_x);  
       bounds->top = CHAR_TO_PIXEL_ROW (f, pix_y);  
       bounds->right  = bounds->left + FONT_WIDTH  (FRAME_FONT (f)) - 1;  
       bounds->bottom = bounds->top + f->output_data.w32->line_height - 1;  
     }  
   
   if (!noclip)  
     {  
       if (pix_x < 0)  
         pix_x = 0;  
       else if (pix_x > FRAME_WINDOW_WIDTH (f))  
         pix_x = FRAME_WINDOW_WIDTH (f);  
   
       if (pix_y < 0)  
         pix_y = 0;  
       else if (pix_y > f->height)  
         pix_y = f->height;  
     }  
   
   *x = pix_x;  
   *y = pix_y;  
 }  
   
   
 /* Given HPOS/VPOS in the current matrix of W, return corresponding  
    frame-relative pixel positions in *FRAME_X and *FRAME_Y.  If we  
    can't tell the positions because W's display is not up to date,  
    return 0.  */  
   
 int  
 glyph_to_pixel_coords (w, hpos, vpos, frame_x, frame_y)  
      struct window *w;  
      int hpos, vpos;  
      int *frame_x, *frame_y;  
 {  
   int success_p;  
   
   xassert (hpos >= 0 && hpos < w->current_matrix->matrix_w);  
   xassert (vpos >= 0 && vpos < w->current_matrix->matrix_h);  
   
   if (display_completed)  
     {  
       struct glyph_row *row = MATRIX_ROW (w->current_matrix, vpos);  
       struct glyph *glyph = row->glyphs[TEXT_AREA];  
       struct glyph *end = glyph + min (hpos, row->used[TEXT_AREA]);  
   
       *frame_y = row->y;  
       *frame_x = row->x;  
       while (glyph < end)  
         {  
           *frame_x += glyph->pixel_width;  
           ++glyph;  
         }  
   
       success_p = 1;  
     }  
   else  
     {  
       *frame_y = *frame_x = 0;  
       success_p = 0;  
     }  
   
   *frame_y = WINDOW_TO_FRAME_PIXEL_Y (w, *frame_y);  
   *frame_x = WINDOW_TO_FRAME_PIXEL_X (w, *frame_x);  
   return success_p;  
 }  
   
2803  /* Parse a button MESSAGE. The button index is returned in PBUTTON, and  /* Parse a button MESSAGE. The button index is returned in PBUTTON, and
2804     the state in PUP. XBUTTON provides extra information for extended mouse     the state in PUP. XBUTTON provides extra information for extended mouse
2805     button messages. Returns FALSE if unable to parse the message.  */     button messages. Returns FALSE if unable to parse the message.  */

Legend:
Removed from v.1.183  
changed lines
  Added in v.1.184

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