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

Diff of /emacs/src/macterm.c

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

revision 1.44 by monnier, Sat May 17 21:17:44 2003 UTC revision 1.45 by kfstorm, Sat May 24 22:00:34 2003 UTC
# Line 306  static void XTframe_rehighlight P_ ((str Line 306  static void XTframe_rehighlight P_ ((str
306  static void x_frame_rehighlight P_ ((struct x_display_info *));  static void x_frame_rehighlight P_ ((struct x_display_info *));
307  static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));  static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
308  static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int));  static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int));
309  static void x_clip_to_row P_ ((struct window *, struct glyph_row *,  static void x_clip_to_row P_ ((struct window *, struct glyph_row *, GC));
                                GC, int));  
310  static void x_flush P_ ((struct frame *f));  static void x_flush P_ ((struct frame *f));
311  static void x_update_begin P_ ((struct frame *));  static void x_update_begin P_ ((struct frame *));
312  static void x_update_window_begin P_ ((struct window *));  static void x_update_window_begin P_ ((struct window *));
# Line 1273  x_after_update_window_line (desired_row) Line 1272  x_after_update_window_line (desired_row)
1272        XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),        XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
1273                    0, y, width, height, 0);                    0, y, width, height, 0);
1274        XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),        XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
1275                    f->output_data.mac->pixel_width - width, y,                    FRAME_PIXEL_WIDTH (f) - width, y,
1276                    width, height, 0);                    width, height, 0);
1277    
1278        UNBLOCK_INPUT;        UNBLOCK_INPUT;
# Line 1300  x_draw_fringe_bitmap (w, row, p) Line 1299  x_draw_fringe_bitmap (w, row, p)
1299    struct face *face = p->face;    struct face *face = p->face;
1300    
1301    /* Must clip because of partially visible lines.  */    /* Must clip because of partially visible lines.  */
1302    x_clip_to_row (w, row, gc, 1);    x_clip_to_row (w, row, gc);
1303    
1304    if (p->bx >= 0)    if (p->bx >= 0)
1305      {      {
# Line 2352  x_draw_glyph_string_box (s) Line 2351  x_draw_glyph_string_box (s)
2351    if (s->row->full_width_p    if (s->row->full_width_p
2352        && !s->w->pseudo_window_p)        && !s->w->pseudo_window_p)
2353      {      {
2354        last_x += FRAME_X_RIGHT_FRINGE_WIDTH (s->f);        last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
2355        if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f))        if (s->area != RIGHT_MARGIN_AREA
2356          last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f);            || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
2357            last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
2358      }      }
2359    
2360    /* The glyph that may have a right box line.  */    /* The glyph that may have a right box line.  */
# Line 2744  x_draw_stretch_glyph_string (s) Line 2744  x_draw_stretch_glyph_string (s)
2744      {      {
2745        /* If `x-stretch-block-cursor' is nil, don't draw a block cursor        /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
2746           as wide as the stretch glyph.  */           as wide as the stretch glyph.  */
2747        int width = min (CANON_X_UNIT (s->f), s->background_width);        int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width);
2748    
2749        /* Draw cursor.  */        /* Draw cursor.  */
2750        x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height);        x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height);
# Line 3147  x_scroll_run (w, run) Line 3147  x_scroll_run (w, run)
3147       without mode lines.  Include in this box the left and right       without mode lines.  Include in this box the left and right
3148       fringes of W.  */       fringes of W.  */
3149    window_box (w, -1, &x, &y, &width, &height);    window_box (w, -1, &x, &y, &width, &height);
   width += FRAME_X_FRINGE_WIDTH (f);  
   x -= FRAME_X_LEFT_FRINGE_WIDTH (f);  
3150    
3151    from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);    from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);
3152    to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);    to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);
# Line 3591  glyph_rect (f, x, y, rect) Line 3589  glyph_rect (f, x, y, rect)
3589  {  {
3590    Lisp_Object window;    Lisp_Object window;
3591    
3592    window = window_from_coordinates (f, x, y, 0, 0);    window = window_from_coordinates (f, x, y, 0, &x, &y, 0);
3593    
3594    if (!NILP (window))    if (!NILP (window))
3595      {      {
3596        struct window *w = XWINDOW (window);        struct window *w = XWINDOW (window);
3597        struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);        struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
3598        struct glyph_row *end = r + w->current_matrix->nrows - 1;        struct glyph_row *end = r + w->current_matrix->nrows - 1;
3599    
       frame_to_window_pixel_xy (w, &x, &y);  
   
3600        for (; r < end && r->enabled_p; ++r)        for (; r < end && r->enabled_p; ++r)
3601          if (r->y <= y && r->y + r->height > y)          if (r->y <= y && r->y + r->height > y)
3602            {            {
# Line 3614  glyph_rect (f, x, y, rect) Line 3611  glyph_rect (f, x, y, rect)
3611              if (x < r->x)              if (x < r->x)
3612                {                {
3613                  /* x is to the left of the first glyph in the row.  */                  /* x is to the left of the first glyph in the row.  */
3614                  rect->left = XINT (w->left);                  /* Shouldn't this be a pixel value?
3615                       WINDOW_LEFT_EDGE_X (w) seems to be the right value.
3616                       ++KFS */
3617                    rect->left = WINDOW_LEFT_EDGE_COL (w);
3618                  rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x);                  rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x);
3619                  return 1;                  return 1;
3620                }                }
# Line 3630  glyph_rect (f, x, y, rect) Line 3630  glyph_rect (f, x, y, rect)
3630    
3631              /* x is to the right of the last glyph in the row.  */              /* x is to the right of the last glyph in the row.  */
3632              rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);              rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);
3633              rect->right = XINT (w->left) + XINT (w->width);              /* Shouldn't this be a pixel value?  
3634                   WINDOW_RIGHT_EDGE_X (w) seems to be the right value.
3635                   ++KFS */
3636                rect->right = WINDOW_RIGHT_EDGE_COL (w);
3637              return 1;              return 1;
3638            }            }
3639      }      }
# Line 3652  remember_mouse_glyph (f1, gx, gy) Line 3655  remember_mouse_glyph (f1, gx, gy)
3655        int width = FRAME_SMALLEST_CHAR_WIDTH (f1);        int width = FRAME_SMALLEST_CHAR_WIDTH (f1);
3656        int height = FRAME_SMALLEST_FONT_HEIGHT (f1);        int height = FRAME_SMALLEST_FONT_HEIGHT (f1);
3657    
3658        /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to        /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
3659           round down even for negative values.  */           round down even for negative values.  */
3660        if (gx < 0)        if (gx < 0)
3661          gx -= width - 1;          gx -= width - 1;
# Line 3938  XTset_vertical_scroll_bar (w, portion, w Line 3941  XTset_vertical_scroll_bar (w, portion, w
3941    struct frame *f = XFRAME (w->frame);    struct frame *f = XFRAME (w->frame);
3942    struct scroll_bar *bar;    struct scroll_bar *bar;
3943    int top, height, left, sb_left, width, sb_width, disp_top, disp_height;    int top, height, left, sb_left, width, sb_width, disp_top, disp_height;
3944    int window_x, window_y, window_width, window_height;    int window_y, window_height;
3945    
3946    /* Get window dimensions.  */    /* Get window dimensions.  */
3947    window_box (w, -1, &window_x, &window_y, &window_width, &window_height);    window_box (w, -1, 0, &window_y, 0, &window_height);
3948    top = window_y;    top = window_y;
3949  #ifdef MAC_OSX  #ifdef MAC_OSX
3950    width = 16;    width = 16;
3951  #else  #else
3952    width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f);    width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
3953  #endif  #endif
3954    height = window_height;    height = window_height;
3955    
3956    /* Compute the left edge of the scroll bar area.  */    /* Compute the left edge of the scroll bar area.  */
3957    if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))    left = WINDOW_SCROLL_BAR_AREA_X (w);
     left = XINT (w->left) + XINT (w->width) - FRAME_SCROLL_BAR_COLS (f);  
   else  
     left = XFASTINT (w->left);  
   left *= CANON_X_UNIT (f);  
   left += FRAME_INTERNAL_BORDER_WIDTH (f);  
3958    
3959    /* Compute the width of the scroll bar which might be less than    /* Compute the width of the scroll bar which might be less than
3960       the width of the area reserved for the scroll bar.  */       the width of the area reserved for the scroll bar.  */
3961    if (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0)    if (WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) > 0)
3962      sb_width = FRAME_SCROLL_BAR_PIXEL_WIDTH (f);      sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
3963    else    else
3964      sb_width = width;      sb_width = width;
3965    
3966    /* Compute the left edge of the scroll bar.  */    /* Compute the left edge of the scroll bar.  */
3967    if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))    if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
3968      sb_left = left + width - sb_width - (width - sb_width) / 2;      sb_left = left + width - sb_width - (width - sb_width) / 2;
3969    else    else
3970      sb_left = left + (width - sb_width) / 2;      sb_left = left + (width - sb_width) / 2;
# Line 3979  XTset_vertical_scroll_bar (w, portion, w Line 3977  XTset_vertical_scroll_bar (w, portion, w
3977        disp_top = -1;        disp_top = -1;
3978        disp_height++;        disp_height++;
3979      }      }
3980    else if (disp_top == PIXEL_HEIGHT (f) - 16)    else if (disp_top == FRAME_PIXEL_HEIGHT (f) - 16)
3981      {      {
3982        disp_top++;        disp_top++;
3983        disp_height--;        disp_height--;
3984      }      }
3985    
3986    if (sb_left + sb_width == PIXEL_WIDTH (f))    if (sb_left + sb_width == FRAME_PIXEL_WIDTH (f))
3987      sb_left++;      sb_left++;
3988    
3989    /* Does the scroll bar exist yet?  */    /* Does the scroll bar exist yet?  */
# Line 4021  XTset_vertical_scroll_bar (w, portion, w Line 4019  XTset_vertical_scroll_bar (w, portion, w
4019               wide as the area reserved for it .  This makes sure a               wide as the area reserved for it .  This makes sure a
4020               previous mode line display is cleared after C-x 2 C-x 1, for               previous mode line display is cleared after C-x 2 C-x 1, for
4021               example.  */               example.  */
4022            int area_width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f);            int area_width = WINDOW_SCROLL_BAR_AREA_WIDTH (w);
4023            XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),            XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
4024                        left, top, area_width, height, 0);                        left, top, area_width, height, 0);
4025    
4026  #if 0  #if 0
4027            if (sb_left + sb_width >= PIXEL_WIDTH (f))            if (sb_left + sb_width >= FRAME_PIXEL_WIDTH (f))
4028              XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),              XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
4029                          sb_left - 1, top, 1, height, 0);                          sb_left - 1, top, 1, height, 0);
4030  #endif  #endif
# Line 4369  x_scroll_bar_report_motion (fp, bar_wind Line 4367  x_scroll_bar_report_motion (fp, bar_wind
4367    
4368  /* Set clipping for output in glyph row ROW.  W is the window in which  /* Set clipping for output in glyph row ROW.  W is the window in which
4369     we operate.  GC is the graphics context to set clipping in.     we operate.  GC is the graphics context to set clipping in.
    WHOLE_LINE_P non-zero means include the areas used for truncation  
    mark display and alike in the clipping rectangle.  
4370    
4371     ROW may be a text row or, e.g., a mode line.  Text rows must be     ROW may be a text row or, e.g., a mode line.  Text rows must be
4372     clipped to the interior of the window dedicated to text display,     clipped to the interior of the window dedicated to text display,
4373     mode lines must be clipped to the whole window.  */     mode lines must be clipped to the whole window.  */
4374    
4375  static void  static void
4376  x_clip_to_row (w, row, gc, whole_line_p)  x_clip_to_row (w, row, gc)
4377       struct window *w;       struct window *w;
4378       struct glyph_row *row;       struct glyph_row *row;
4379       GC gc;       GC gc;
      int whole_line_p;  
4380  {  {
4381    struct frame *f = XFRAME (WINDOW_FRAME (w));    struct frame *f = XFRAME (WINDOW_FRAME (w));
4382    Rect clip_rect;    Rect clip_rect;
4383    int window_x, window_y, window_width, window_height;    int window_y, window_width;
4384    
4385    window_box (w, -1, &window_x, &window_y, &window_width, &window_height);    window_box (w, -1, 0, &window_y, &window_width, 0);
4386    
4387    clip_rect.left = WINDOW_TO_FRAME_PIXEL_X (w, 0);    clip_rect.left = WINDOW_TO_FRAME_PIXEL_X (w, 0);
4388    clip_rect.top = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);    clip_rect.top = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
# Line 4395  x_clip_to_row (w, row, gc, whole_line_p) Line 4390  x_clip_to_row (w, row, gc, whole_line_p)
4390    clip_rect.right = clip_rect.left + window_width;    clip_rect.right = clip_rect.left + window_width;
4391    clip_rect.bottom = clip_rect.top + row->visible_height;    clip_rect.bottom = clip_rect.top + row->visible_height;
4392    
   /* If clipping to the whole line, including trunc marks, extend  
      the rectangle to the left and increase its width.  */  
   if (whole_line_p)  
     {  
       clip_rect.left -= FRAME_X_LEFT_FRINGE_WIDTH (f);  
       clip_rect.right += FRAME_X_FRINGE_WIDTH (f);  
     }  
   
4393    mac_set_clip_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), &clip_rect);    mac_set_clip_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), &clip_rect);
4394  }  }
4395    
# Line 4442  x_draw_hollow_cursor (w, row) Line 4429  x_draw_hollow_cursor (w, row)
4429    wd = cursor_glyph->pixel_width - 1;    wd = cursor_glyph->pixel_width - 1;
4430    if (cursor_glyph->type == STRETCH_GLYPH    if (cursor_glyph->type == STRETCH_GLYPH
4431        && !x_stretch_cursor_p)        && !x_stretch_cursor_p)
4432      wd = min (CANON_X_UNIT (f), wd);      wd = min (FRAME_COLUMN_WIDTH (f), wd);
4433    
4434    /* The foreground of cursor_gc is typically the same as the normal    /* The foreground of cursor_gc is typically the same as the normal
4435       background color, which can cause the cursor box to be invisible.  */       background color, which can cause the cursor box to be invisible.  */
# Line 4455  x_draw_hollow_cursor (w, row) Line 4442  x_draw_hollow_cursor (w, row)
4442    gc = dpyinfo->scratch_cursor_gc;    gc = dpyinfo->scratch_cursor_gc;
4443    
4444    /* Set clipping, draw the rectangle, and reset clipping again.  */    /* Set clipping, draw the rectangle, and reset clipping again.  */
4445    x_clip_to_row (w, row, gc, 0);    x_clip_to_row (w, row, gc);
4446    mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h);    mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h);
4447    mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f));    mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f));
4448  }  }
# Line 4511  x_draw_bar_cursor (w, row, width) Line 4498  x_draw_bar_cursor (w, row, width)
4498          width = FRAME_CURSOR_WIDTH (f);          width = FRAME_CURSOR_WIDTH (f);
4499    
4500        x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);        x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
4501        x_clip_to_row (w, row, gc, 0);        x_clip_to_row (w, row, gc);
4502        XFillRectangle (dpy, window, gc,        XFillRectangle (dpy, window, gc,
4503                        x,                        x,
4504                        WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),                        WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
# Line 4685  x_new_font (f, fontname) Line 4672  x_new_font (f, fontname)
4672    FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;    FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
4673    FRAME_FONTSET (f) = -1;    FRAME_FONTSET (f) = -1;
4674    
4675      FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f));
4676      FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
4677    
4678      compute_fringe_widths (f, 1);
4679    
4680    /* Compute the scroll bar width in character columns.  */    /* Compute the scroll bar width in character columns.  */
4681    if (f->scroll_bar_pixel_width > 0)    if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
4682      {      {
4683        int wid = FONT_WIDTH (FRAME_FONT (f));        int wid = FRAME_COLUMN_WIDTH (f);
4684        f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid;        FRAME_CONFIG_SCROLL_BAR_COLS (f)
4685            = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid-1) / wid;
4686      }      }
4687    else    else
4688      {      {
4689        int wid = FONT_WIDTH (FRAME_FONT (f));        int wid = FRAME_COLUMN_WIDTH (f);
4690        f->scroll_bar_cols = (14 + wid - 1) / wid;        FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
4691      }      }
4692    
4693    /* Now make the frame display the given font.  */    /* Now make the frame display the given font.  */
4694    if (FRAME_MAC_WINDOW (f) != 0)    if (FRAME_MAC_WINDOW (f) != 0)
4695      {      {
4696        XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->normal_gc,        XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->normal_gc,
4697                  f->output_data.mac->font);                  FRAME_FONT (f));
4698        XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->reverse_gc,        XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->reverse_gc,
4699                  f->output_data.mac->font);                  FRAME_FONT (f));
4700        XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->cursor_gc,        XSetFont (FRAME_MAC_DISPLAY (f), f->output_data.mac->cursor_gc,
4701                  f->output_data.mac->font);                  FRAME_FONT (f));
4702    
       frame_update_line_height (f);  
4703        if (NILP (tip_frame) || XFRAME (tip_frame) != f)        if (NILP (tip_frame) || XFRAME (tip_frame) != f)
4704          x_set_window_size (f, 0, f->width, f->height);          x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
4705      }      }
   else  
     /* If we are setting a new frame's font for the first time,  
        there are no faces yet, so this font's height is the line height.  */  
     f->output_data.mac->line_height = FONT_HEIGHT (FRAME_FONT (f));  
4706    
4707    return build_string (fontp->full_name);    return build_string (fontp->full_name);
4708  }  }
# Line 4776  x_calc_absolute_position (f) Line 4764  x_calc_absolute_position (f)
4764       struct frame *f;       struct frame *f;
4765  {  {
4766    Point pt;    Point pt;
4767    int flags = f->output_data.mac->size_hint_flags;    int flags = f->size_hint_flags;
4768    
4769    pt.h = pt.v = 0;    pt.h = pt.v = 0;
4770    
# Line 4810  x_calc_absolute_position (f) Line 4798  x_calc_absolute_position (f)
4798    /* Treat negative positions as relative to the leftmost bottommost    /* Treat negative positions as relative to the leftmost bottommost
4799       position that fits on the screen.  */       position that fits on the screen.  */
4800    if (flags & XNegative)    if (flags & XNegative)
4801      f->output_data.mac->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width      f->left_pos = (FRAME_MAC_DISPLAY_INFO (f)->width
4802                                - 2 * f->output_data.mac->border_width - pt.h                     - 2 * f->border_width - pt.h
4803                                - PIXEL_WIDTH (f)                     - FRAME_PIXEL_WIDTH (f)
4804                                + f->output_data.mac->left_pos);                     + f->left_pos);
4805    /* NTEMACS_TODO: Subtract menubar height?  */    /* NTEMACS_TODO: Subtract menubar height?  */
4806    if (flags & YNegative)    if (flags & YNegative)
4807      f->output_data.mac->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height      f->top_pos = (FRAME_MAC_DISPLAY_INFO (f)->height
4808                               - 2 * f->output_data.mac->border_width - pt.v                    - 2 * f->border_width - pt.v
4809                               - PIXEL_HEIGHT (f)                    - FRAME_PIXEL_HEIGHT (f)
4810                               + f->output_data.mac->top_pos);                    + f->top_pos);
4811    /* The left_pos and top_pos    /* The left_pos and top_pos
4812       are now relative to the top and left screen edges,       are now relative to the top and left screen edges,
4813       so the flags should correspond.  */       so the flags should correspond.  */
4814    f->output_data.mac->size_hint_flags &= ~ (XNegative | YNegative);    f->size_hint_flags &= ~ (XNegative | YNegative);
4815  }  }
4816    
4817  /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position,  /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position,
# Line 4842  x_set_offset (f, xoff, yoff, change_grav Line 4830  x_set_offset (f, xoff, yoff, change_grav
4830    
4831    if (change_gravity > 0)    if (change_gravity > 0)
4832      {      {
4833        f->output_data.mac->top_pos = yoff;        f->top_pos = yoff;
4834        f->output_data.mac->left_pos = xoff;        f->left_pos = xoff;
4835        f->output_data.mac->size_hint_flags &= ~ (XNegative | YNegative);        f->size_hint_flags &= ~ (XNegative | YNegative);
4836        if (xoff < 0)        if (xoff < 0)
4837          f->output_data.mac->size_hint_flags |= XNegative;          f->size_hint_flags |= XNegative;
4838        if (yoff < 0)        if (yoff < 0)
4839          f->output_data.mac->size_hint_flags |= YNegative;          f->size_hint_flags |= YNegative;
4840        f->output_data.mac->win_gravity = NorthWestGravity;        f->win_gravity = NorthWestGravity;
4841      }      }
4842    x_calc_absolute_position (f);    x_calc_absolute_position (f);
4843    
4844    BLOCK_INPUT;    BLOCK_INPUT;
4845    x_wm_set_size_hint (f, (long) 0, 0);    x_wm_set_size_hint (f, (long) 0, 0);
4846    
4847    modified_left = f->output_data.mac->left_pos;    modified_left = f->left_pos;
4848    modified_top = f->output_data.mac->top_pos;    modified_top = f->top_pos;
4849    
4850    MoveWindow (f->output_data.mac->mWP, modified_left + 6,    MoveWindow (f->output_data.mac->mWP, modified_left + 6,
4851                modified_top + 42, false);                modified_top + 42, false);
# Line 4881  x_set_window_size (f, change_gravity, co Line 4869  x_set_window_size (f, change_gravity, co
4869    BLOCK_INPUT;    BLOCK_INPUT;
4870    
4871    check_frame_size (f, &rows, &cols);    check_frame_size (f, &rows, &cols);
4872    f->output_data.mac->vertical_scroll_bar_extra    f->scroll_bar_actual_width
4873      = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)      = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f);
        ? 0  
        : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.mac->font)));  
4874    
4875    compute_fringe_widths (f, 0);    compute_fringe_widths (f, 0);
4876    
4877    pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);    pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
4878    pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows);    pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
4879    
4880    f->output_data.mac->win_gravity = NorthWestGravity;    f->win_gravity = NorthWestGravity;
4881    x_wm_set_size_hint (f, (long) 0, 0);    x_wm_set_size_hint (f, (long) 0, 0);
4882    
4883    SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0);    SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0);
# Line 4910  x_set_window_size (f, change_gravity, co Line 4896  x_set_window_size (f, change_gravity, co
4896       We pass 1 for DELAY since we can't run Lisp code inside of       We pass 1 for DELAY since we can't run Lisp code inside of
4897       a BLOCK_INPUT.  */       a BLOCK_INPUT.  */
4898    change_frame_size (f, rows, cols, 0, 1, 0);    change_frame_size (f, rows, cols, 0, 1, 0);
4899    PIXEL_WIDTH (f) = pixelwidth;    FRAME_PIXEL_WIDTH (f) = pixelwidth;
4900    PIXEL_HEIGHT (f) = pixelheight;    FRAME_PIXEL_HEIGHT (f) = pixelheight;
4901    
4902    /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to    /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
4903       receive in the ConfigureNotify event; if we get what we asked       receive in the ConfigureNotify event; if we get what we asked
# Line 4944  x_set_mouse_position (f, x, y) Line 4930  x_set_mouse_position (f, x, y)
4930  {  {
4931    int pix_x, pix_y;    int pix_x, pix_y;
4932    
4933    pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH  (f->output_data.mac->font) / 2;    pix_x = FRAME_COL_TO_PIXEL_X (f, x) + FRAME_COLUMN_WIDTH (f) / 2;
4934    pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->output_data.mac->line_height / 2;    pix_y = FRAME_LINE_TO_PIXEL_Y (f, y) + FRAME_LINE_HEIGHT (f) / 2;
4935    
4936    if (pix_x < 0) pix_x = 0;    if (pix_x < 0) pix_x = 0;
4937    if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f);    if (pix_x > FRAME_PIXEL_WIDTH (f)) pix_x = FRAME_PIXEL_WIDTH (f);
4938    
4939    if (pix_y < 0) pix_y = 0;    if (pix_y < 0) pix_y = 0;
4940    if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f);    if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f);
4941    
4942    x_set_mouse_pixel_position (f, pix_x, pix_y);    x_set_mouse_pixel_position (f, pix_x, pix_y);
4943  }  }
# Line 5050  x_make_frame_visible (f) Line 5036  x_make_frame_visible (f)
5036           before the window gets really visible.  */           before the window gets really visible.  */
5037        if (! FRAME_ICONIFIED_P (f)        if (! FRAME_ICONIFIED_P (f)
5038            && ! f->output_data.mac->asked_for_visible)            && ! f->output_data.mac->asked_for_visible)
5039          x_set_offset (f, f->output_data.mac->left_pos,          x_set_offset (f, f->left_pos, f->top_pos, 0);
                       f->output_data.mac->top_pos, 0);  
5040    
5041        f->output_data.mac->asked_for_visible = 1;        f->output_data.mac->asked_for_visible = 1;
5042    
# Line 5228  x_wm_set_size_hint (f, flags, user_posit Line 5213  x_wm_set_size_hint (f, flags, user_posit
5213    /* Setting PMaxSize caused various problems.  */    /* Setting PMaxSize caused various problems.  */
5214    size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */;    size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */;
5215    
5216    size_hints.x = f->output_data.x->left_pos;    size_hints.x = f->left_pos;
5217    size_hints.y = f->output_data.x->top_pos;    size_hints.y = f->top_pos;
5218    
5219  #ifdef USE_X_TOOLKIT  #ifdef USE_X_TOOLKIT
5220    XtSetArg (al[ac], XtNwidth, &widget_width); ac++;    XtSetArg (al[ac], XtNwidth, &widget_width); ac++;
# Line 5238  x_wm_set_size_hint (f, flags, user_posit Line 5223  x_wm_set_size_hint (f, flags, user_posit
5223    size_hints.height = widget_height;    size_hints.height = widget_height;
5224    size_hints.width = widget_width;    size_hints.width = widget_width;
5225  #else /* not USE_X_TOOLKIT */  #else /* not USE_X_TOOLKIT */
5226    size_hints.height = PIXEL_HEIGHT (f);    size_hints.height = FRAME_PIXEL_HEIGHT (f);
5227    size_hints.width = PIXEL_WIDTH (f);    size_hints.width = FRAME_PIXEL_WIDTH (f);
5228  #endif /* not USE_X_TOOLKIT */  #endif /* not USE_X_TOOLKIT */
5229    
5230    size_hints.width_inc = FONT_WIDTH (f->output_data.x->font);    size_hints.width_inc = FRAME_COLUMN_WIDTH (f);
5231    size_hints.height_inc = f->output_data.x->line_height;    size_hints.height_inc = FRAME_LINE_HEIGHT (f);
5232    size_hints.max_width    size_hints.max_width
5233      = FRAME_X_DISPLAY_INFO (f)->width - CHAR_TO_PIXEL_WIDTH (f, 0);      = FRAME_X_DISPLAY_INFO (f)->width - FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
5234    size_hints.max_height    size_hints.max_height
5235      = FRAME_X_DISPLAY_INFO (f)->height - CHAR_TO_PIXEL_HEIGHT (f, 0);      = FRAME_X_DISPLAY_INFO (f)->height - FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0);
5236    
5237    /* Calculate the base and minimum sizes.    /* Calculate the base and minimum sizes.
5238    
# Line 5258  x_wm_set_size_hint (f, flags, user_posit Line 5243  x_wm_set_size_hint (f, flags, user_posit
5243      int base_width, base_height;      int base_width, base_height;
5244      int min_rows = 0, min_cols = 0;      int min_rows = 0, min_cols = 0;
5245    
5246      base_width = CHAR_TO_PIXEL_WIDTH (f, 0);      base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
5247      base_height = CHAR_TO_PIXEL_HEIGHT (f, 0);      base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0);
5248    
5249      check_frame_size (f, &min_rows, &min_cols);      check_frame_size (f, &min_rows, &min_cols);
5250    
# Line 5334  x_wm_set_size_hint (f, flags, user_posit Line 5319  x_wm_set_size_hint (f, flags, user_posit
5319  #endif  #endif
5320    
5321  #ifdef PWinGravity  #ifdef PWinGravity
5322    size_hints.win_gravity = f->output_data.x->win_gravity;    size_hints.win_gravity = f->win_gravity;
5323    size_hints.flags |= PWinGravity;    size_hints.flags |= PWinGravity;
5324    
5325    if (user_position)    if (user_position)
# Line 7016  do_grow_window (WindowPtr w, EventRecord Line 7001  do_grow_window (WindowPtr w, EventRecord
7001    /* see if it really changed size */    /* see if it really changed size */
7002    if (grow_size != 0)    if (grow_size != 0)
7003      {      {
7004        rows = PIXEL_TO_CHAR_HEIGHT (f, HiWord (grow_size));        rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, HiWord (grow_size));
7005        columns = PIXEL_TO_CHAR_WIDTH (f, LoWord (grow_size));        columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, LoWord (grow_size));
7006    
7007        x_set_window_size (f, 0, columns, rows);        x_set_window_size (f, 0, columns, rows);
7008      }      }
# Line 7069  do_zoom_window (WindowPtr w, int zoom_in Line 7054  do_zoom_window (WindowPtr w, int zoom_in
7054          InsetRect (&zoom_rect, 8, 4);  /* not too tight */          InsetRect (&zoom_rect, 8, 4);  /* not too tight */
7055    
7056          zoom_rect.right = zoom_rect.left          zoom_rect.right = zoom_rect.left
7057            + CHAR_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);            + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7058    
7059          SetWindowStandardState (w, &zoom_rect);          SetWindowStandardState (w, &zoom_rect);
7060        }        }
# Line 7091  do_zoom_window (WindowPtr w, int zoom_in Line 7076  do_zoom_window (WindowPtr w, int zoom_in
7076        InsetRect (&zoom_rect, 8, 4);  /* not too tight */        InsetRect (&zoom_rect, 8, 4);  /* not too tight */
7077    
7078        zoom_rect.right = zoom_rect.left        zoom_rect.right = zoom_rect.left
7079          + CHAR_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);          + FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
7080    
7081        (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState        (**((WStateDataHandle) ((WindowPeek) w)->dataHandle)).stdState
7082          = zoom_rect;          = zoom_rect;
# Line 7106  do_zoom_window (WindowPtr w, int zoom_in Line 7091  do_zoom_window (WindowPtr w, int zoom_in
7091  #else  #else
7092    port_rect = w->portRect;    port_rect = w->portRect;
7093  #endif  #endif
7094    rows = PIXEL_TO_CHAR_HEIGHT (f, port_rect.bottom - port_rect.top);    rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, port_rect.bottom - port_rect.top);
7095    columns = PIXEL_TO_CHAR_WIDTH (f, port_rect.right - port_rect.left);    columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, port_rect.right - port_rect.left);
7096    x_set_window_size (mwp->mFP, 0, columns, rows);    x_set_window_size (mwp->mFP, 0, columns, rows);
7097    
7098    SetPort (save_port);    SetPort (save_port);
# Line 8256  NewMacWindow (FRAME_PTR fp) Line 8241  NewMacWindow (FRAME_PTR fp)
8241    
8242    mwp->fontset = -1;    mwp->fontset = -1;
8243    
8244    SizeWindow (mwp->mWP, mwp->pixel_width, mwp->pixel_height, false);    SizeWindow (mwp->mWP, FRAME_PIXEL_WIDTH (fp), FRAME_PIXEL_HEIGHT (fp), false);
8245    ShowWindow (mwp->mWP);    ShowWindow (mwp->mWP);
8246    
8247  }  }
# Line 8277  make_mac_frame (struct frame *f) Line 8262  make_mac_frame (struct frame *f)
8262    f->output_data.mac->mouse_pixel = 0xff00ff;    f->output_data.mac->mouse_pixel = 0xff00ff;
8263    f->output_data.mac->cursor_foreground_pixel = 0x0000ff;    f->output_data.mac->cursor_foreground_pixel = 0x0000ff;
8264    
8265    f->output_data.mac->fontset = -1;    FRAME_FONTSET (f) = -1;
8266    f->output_data.mac->scroll_bar_foreground_pixel = -1;    f->output_data.mac->scroll_bar_foreground_pixel = -1;
8267    f->output_data.mac->scroll_bar_background_pixel = -1;    f->output_data.mac->scroll_bar_background_pixel = -1;
   f->output_data.mac->left_pos = 4;  
   f->output_data.mac->top_pos = 4;  
   f->output_data.mac->border_width = 0;  
8268    f->output_data.mac->explicit_parent = 0;    f->output_data.mac->explicit_parent = 0;
8269      f->left_pos = 4;
8270      f->top_pos = 4;
8271      f->border_width = 0;
8272    
8273    f->output_data.mac->internal_border_width = 0;    f->internal_border_width = 0;
8274    
8275    f->output_method = output_mac;    f->output_method = output_mac;
8276    
8277    f->auto_raise = 1;    f->auto_raise = 1;
8278    f->auto_lower = 1;    f->auto_lower = 1;
8279    
8280    f->new_width = 0;    f->new_text_cols = 0;
8281    f->new_height = 0;    f->new_text_lines = 0;
8282  }  }
8283    
8284  void  void
# Line 8307  make_mac_terminal_frame (struct frame *f Line 8292  make_mac_terminal_frame (struct frame *f
8292    f->output_data.mac = (struct mac_output *)    f->output_data.mac = (struct mac_output *)
8293      xmalloc (sizeof (struct mac_output));      xmalloc (sizeof (struct mac_output));
8294    bzero (f->output_data.mac, sizeof (struct mac_output));    bzero (f->output_data.mac, sizeof (struct mac_output));
8295    f->output_data.mac->fontset = -1;    FRAME_FONTSET (f) = -1;
8296    f->output_data.mac->scroll_bar_foreground_pixel = -1;    f->output_data.mac->scroll_bar_foreground_pixel = -1;
8297    f->output_data.mac->scroll_bar_background_pixel = -1;    f->output_data.mac->scroll_bar_background_pixel = -1;
8298    
8299    XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f);    XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f);
8300    
8301    f->width = 96;    FRAME_COLS (f) = 96;
8302    f->height = 4;    FRAME_LINES (f) = 4;
8303    
8304    make_mac_frame (f);    make_mac_frame (f);
8305    

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.45

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