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

Diff of /emacs/src/window.c

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

revision 1.436 by schwab, Tue Feb 18 00:18:04 2003 UTC revision 1.437 by kfstorm, Fri Mar 21 13:52:06 2003 UTC
# Line 48  Boston, MA 02111-1307, USA.  */ Line 48  Boston, MA 02111-1307, USA.  */
48  #include "macterm.h"  #include "macterm.h"
49  #endif  #endif
50    
 /* Values returned from coordinates_in_window.  */  
   
 enum window_part  
 {  
   ON_NOTHING,  
   ON_TEXT,  
   ON_MODE_LINE,  
   ON_VERTICAL_BORDER,  
   ON_HEADER_LINE,  
   ON_LEFT_FRINGE,  
   ON_RIGHT_FRINGE,  
   ON_LEFT_MARGIN,  
   ON_RIGHT_MARGIN  
 };  
   
51    
52  Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;  Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_configuration_p;
53  Lisp_Object Qwindow_size_fixed;  Lisp_Object Qwindow_size_fixed;
# Line 507  and BOTTOM is one more than the bottommo Line 492  and BOTTOM is one more than the bottommo
492  }  }
493    
494  /* Test if the character at column *X, row *Y is within window W.  /* Test if the character at column *X, row *Y is within window W.
495     If it is not, return 0;     If it is not, return ON_NOTHING;
496     if it is in the window's text area,     if it is in the window's text area,
497        set *x and *y to its location relative to the upper left corner        set *x and *y to its location relative to the upper left corner
498           of the window, and           of the window, and
499        return 1;        return ON_TEXT;
500     if it is on the window's modeline, return 2;     if it is on the window's modeline, return ON_MODE_LINE;
501     if it is on the border between the window and its right sibling,     if it is on the border between the window and its right sibling,
502        return 3.        return ON_VERTICAL_BORDER.
503     if it is on the window's top line, return 4;     if it is on the window's top line, return ON_HEADER_LINE;
504     if it is in left or right fringe of the window,     if it is in left or right fringe of the window,
505     return 5 or 6, and convert *X and *Y to window-relative coordinates;        return ON_LEFT_FRINGE or ON_RIGHT_FRINGE, and convert *X and *Y
506          to window-relative coordinates;
507     if it is in the marginal area to the left/right of the window,     if it is in the marginal area to the left/right of the window,
508     return 7 or 8, and convert *X and *Y to window-relative coordinates.        return ON_LEFT_MARGIN or ON_RIGHT_MARGIN, and convert *X and *Y
509          to window-relative coordinates.
510    
511     X and Y are frame relative pixel coordinates.  */     X and Y are frame relative pixel coordinates.  */
512    
# Line 786  If they are in the windows's left or rig Line 773  If they are in the windows's left or rig
773  struct check_window_data  struct check_window_data
774  {  {
775    Lisp_Object *window;    Lisp_Object *window;
776    int *x, *y, *part;    int *x, *y;
777      enum window_part *part;
778  };  };
779    
780  static int  static int
# Line 801  check_window_containing (w, user_data) Line 789  check_window_containing (w, user_data)
789    found = coordinates_in_window (w, cw->x, cw->y);    found = coordinates_in_window (w, cw->x, cw->y);
790    if (found != ON_NOTHING)    if (found != ON_NOTHING)
791      {      {
792        *cw->part = found - 1;        *cw->part = found;
793        XSETWINDOW (*cw->window, w);        XSETWINDOW (*cw->window, w);
794        continue_p = 0;        continue_p = 0;
795      }      }
# Line 811  check_window_containing (w, user_data) Line 799  check_window_containing (w, user_data)
799    
800    
801  /* Find the window containing frame-relative pixel position X/Y and  /* Find the window containing frame-relative pixel position X/Y and
802     return it as a Lisp_Object.  If X, Y is on the window's modeline,     return it as a Lisp_Object.  If X, Y is on one of the window's
803     set *PART to 1; if it is on the separating line between the window     special `window_part' elements, set *PART to the id of that element.
804     and its right sibling, set it to 2; otherwise set it to 0.  If     If there is no window under X, Y return nil and leave *PART
    there is no window under X, Y return nil and leave *PART  
805     unmodified.  TOOL_BAR_P non-zero means detect tool-bar windows.     unmodified.  TOOL_BAR_P non-zero means detect tool-bar windows.
806    
807     This function was previously implemented with a loop cycling over     This function was previously implemented with a loop cycling over
# Line 830  Lisp_Object Line 817  Lisp_Object
817  window_from_coordinates (f, x, y, part, tool_bar_p)  window_from_coordinates (f, x, y, part, tool_bar_p)
818       struct frame *f;       struct frame *f;
819       int x, y;       int x, y;
820       int *part;       enum window_part *part;
821       int tool_bar_p;       int tool_bar_p;
822  {  {
823    Lisp_Object window;    Lisp_Object window;
824    struct check_window_data cw;    struct check_window_data cw;
825      enum window_part dummy;
826    
827      if (part == 0)
828        part = &dummy;
829    
830    window = Qnil;    window = Qnil;
831    cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part;    cw.window = &window, cw.x = &x, cw.y = &y; cw.part = part;
# Line 849  window_from_coordinates (f, x, y, part, Line 840  window_from_coordinates (f, x, y, part,
840        && (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y)        && (coordinates_in_window (XWINDOW (f->tool_bar_window), &x, &y)
841            != ON_NOTHING))            != ON_NOTHING))
842      {      {
843        *part = 0;        *part = ON_TEXT;
844        window = f->tool_bar_window;        window = f->tool_bar_window;
845      }      }
846    
# Line 864  column 0.  */) Line 855  column 0.  */)
855       (x, y, frame)       (x, y, frame)
856       Lisp_Object x, y, frame;       Lisp_Object x, y, frame;
857  {  {
   int part;  
858    struct frame *f;    struct frame *f;
859    
860    if (NILP (frame))    if (NILP (frame))
# Line 879  column 0.  */) Line 869  column 0.  */)
869    return window_from_coordinates (f,    return window_from_coordinates (f,
870                                    PIXEL_X_FROM_CANON_X (f, x),                                    PIXEL_X_FROM_CANON_X (f, x),
871                                    PIXEL_Y_FROM_CANON_Y (f, y),                                    PIXEL_Y_FROM_CANON_Y (f, y),
872                                    &part, 0);                                    0, 0);
873  }  }
874    
875  DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0,  DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0,

Legend:
Removed from v.1.436  
changed lines
  Added in v.1.437

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