aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2003-05-24 22:10:17 +0000
committerKim F. Storm2003-05-24 22:10:17 +0000
commit0899d58cb7271248b482bfff217f32b87c1d5c67 (patch)
tree23098b97828c2d66e5245dd58b9764bf9a9a633e /src
parent9882535b5cf98d099a126c2bc02f956b9e5168c9 (diff)
downloademacs-0899d58cb7271248b482bfff217f32b87c1d5c67.tar.gz
emacs-0899d58cb7271248b482bfff217f32b87c1d5c67.zip
Make (several) trivial substitutions for renamed and
new macros in dispextern.h, frame.h and window.h. (x_draw_glyph_string_box): Adapt to per-window fringes and scroll-bars. (scroll_run): Adapt to new fringe position. (glyph_rect): Use window coordinates returned from window_from_coordinates rather than frame_to_window_pixel_xy. (XTset_vertical_scroll_bar): Adapt to per-window fringes and scroll-bars. (handle_one_xevent): Simplify a USE_GTK conditional. (x_clip_to_row): Remove superfluous whole_line_p arg and code (fringes are now inside margins, i.e. always in the clipping area). All callers changed. (x_new_font): Set FRAME_COLUMN_WIDTH and FRAME_LINE_HEIGHT directly, then call compute_fringe_widths. Don't call frame_update_line_height.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c313
1 files changed, 143 insertions, 170 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 1d28bb5b92a..842a81afc38 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -346,8 +346,7 @@ static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
346static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int, 346static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int,
347 enum text_cursor_kinds)); 347 enum text_cursor_kinds));
348 348
349static void x_clip_to_row P_ ((struct window *, struct glyph_row *, 349static void x_clip_to_row P_ ((struct window *, struct glyph_row *, GC));
350 GC, int));
351static void x_flush P_ ((struct frame *f)); 350static void x_flush P_ ((struct frame *f));
352static void x_update_begin P_ ((struct frame *)); 351static void x_update_begin P_ ((struct frame *));
353static void x_update_window_begin P_ ((struct window *)); 352static void x_update_window_begin P_ ((struct window *));
@@ -675,7 +674,7 @@ x_after_update_window_line (desired_row)
675 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 674 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
676 0, y, width, height, False); 675 0, y, width, height, False);
677 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 676 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
678 f->output_data.x->pixel_width - width, 677 FRAME_PIXEL_WIDTH (f) - width,
679 y, width, height, False); 678 y, width, height, False);
680 UNBLOCK_INPUT; 679 UNBLOCK_INPUT;
681 } 680 }
@@ -694,7 +693,7 @@ x_draw_fringe_bitmap (w, row, p)
694 struct face *face = p->face; 693 struct face *face = p->face;
695 694
696 /* Must clip because of partially visible lines. */ 695 /* Must clip because of partially visible lines. */
697 x_clip_to_row (w, row, gc, 1); 696 x_clip_to_row (w, row, gc);
698 697
699 if (p->bx >= 0) 698 if (p->bx >= 0)
700 { 699 {
@@ -2078,9 +2077,10 @@ x_draw_glyph_string_box (s)
2078 if (s->row->full_width_p 2077 if (s->row->full_width_p
2079 && !s->w->pseudo_window_p) 2078 && !s->w->pseudo_window_p)
2080 { 2079 {
2081 last_x += FRAME_X_RIGHT_FRINGE_WIDTH (s->f); 2080 last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
2082 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f)) 2081 if (s->area != RIGHT_MARGIN_AREA
2083 last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f); 2082 || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
2083 last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
2084 } 2084 }
2085 2085
2086 /* The glyph that may have a right box line. */ 2086 /* The glyph that may have a right box line. */
@@ -2468,7 +2468,7 @@ x_draw_stretch_glyph_string (s)
2468 { 2468 {
2469 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor 2469 /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
2470 as wide as the stretch glyph. */ 2470 as wide as the stretch glyph. */
2471 int width = min (CANON_X_UNIT (s->f), s->background_width); 2471 int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width);
2472 2472
2473 /* Draw cursor. */ 2473 /* Draw cursor. */
2474 x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height); 2474 x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height);
@@ -2821,12 +2821,12 @@ XTflash (f)
2821 2821
2822 { 2822 {
2823 /* Get the height not including a menu bar widget. */ 2823 /* Get the height not including a menu bar widget. */
2824 int height = CHAR_TO_PIXEL_HEIGHT (f, FRAME_HEIGHT (f)); 2824 int height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, FRAME_LINES (f));
2825 /* Height of each line to flash. */ 2825 /* Height of each line to flash. */
2826 int flash_height = FRAME_LINE_HEIGHT (f); 2826 int flash_height = FRAME_LINE_HEIGHT (f);
2827 /* These will be the left and right margins of the rectangles. */ 2827 /* These will be the left and right margins of the rectangles. */
2828 int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f); 2828 int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
2829 int flash_right = PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f); 2829 int flash_right = FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
2830 2830
2831 int width; 2831 int width;
2832 2832
@@ -2854,7 +2854,7 @@ XTflash (f)
2854 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 2854 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
2855 flash_left, 2855 flash_left,
2856 (FRAME_INTERNAL_BORDER_WIDTH (f) 2856 (FRAME_INTERNAL_BORDER_WIDTH (f)
2857 + FRAME_TOOL_BAR_LINES (f) * CANON_Y_UNIT (f)), 2857 + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)),
2858 width, flash_height); 2858 width, flash_height);
2859 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 2859 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
2860 flash_left, 2860 flash_left,
@@ -2908,7 +2908,7 @@ XTflash (f)
2908 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 2908 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
2909 flash_left, 2909 flash_left,
2910 (FRAME_INTERNAL_BORDER_WIDTH (f) 2910 (FRAME_INTERNAL_BORDER_WIDTH (f)
2911 + FRAME_TOOL_BAR_LINES (f) * CANON_Y_UNIT (f)), 2911 + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)),
2912 width, flash_height); 2912 width, flash_height);
2913 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc, 2913 XFillRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), gc,
2914 flash_left, 2914 flash_left,
@@ -3000,8 +3000,6 @@ x_scroll_run (w, run)
3000 without mode lines. Include in this box the left and right 3000 without mode lines. Include in this box the left and right
3001 fringe of W. */ 3001 fringe of W. */
3002 window_box (w, -1, &x, &y, &width, &height); 3002 window_box (w, -1, &x, &y, &width, &height);
3003 width += FRAME_X_FRINGE_WIDTH (f);
3004 x -= FRAME_X_LEFT_FRINGE_WIDTH (f);
3005 3003
3006 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y); 3004 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);
3007 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); 3005 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);
@@ -3576,15 +3574,13 @@ glyph_rect (f, x, y, rect)
3576 Lisp_Object window; 3574 Lisp_Object window;
3577 int found = 0; 3575 int found = 0;
3578 3576
3579 window = window_from_coordinates (f, x, y, 0, 0); 3577 window = window_from_coordinates (f, x, y, 0, &x, &y, 0);
3580 if (!NILP (window)) 3578 if (!NILP (window))
3581 { 3579 {
3582 struct window *w = XWINDOW (window); 3580 struct window *w = XWINDOW (window);
3583 struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); 3581 struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
3584 struct glyph_row *end = r + w->current_matrix->nrows - 1; 3582 struct glyph_row *end = r + w->current_matrix->nrows - 1;
3585 3583
3586 frame_to_window_pixel_xy (w, &x, &y);
3587
3588 for (; !found && r < end && r->enabled_p; ++r) 3584 for (; !found && r < end && r->enabled_p; ++r)
3589 if (r->y >= y) 3585 if (r->y >= y)
3590 { 3586 {
@@ -3804,7 +3800,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
3804 gx = win_x; 3800 gx = win_x;
3805 gy = win_y; 3801 gy = win_y;
3806 3802
3807 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to 3803 /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
3808 round down even for negative values. */ 3804 round down even for negative values. */
3809 if (gx < 0) 3805 if (gx < 0)
3810 gx -= width - 1; 3806 gx -= width - 1;
@@ -4590,7 +4586,7 @@ x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
4590 its size, the update will often happen too late. 4586 its size, the update will often happen too late.
4591 If you don't believe it, check out revision 1.650 of xterm.c to see 4587 If you don't believe it, check out revision 1.650 of xterm.c to see
4592 what hoops we were going through and the still poor behavior we got. */ 4588 what hoops we were going through and the still poor behavior we got. */
4593 portion = XFASTINT (XWINDOW (bar->window)->height) * 30; 4589 portion = WINDOW_TOTAL_LINES (XWINDOW (bar->window)) * 30;
4594 /* When the thumb is at the bottom, position == whole. 4590 /* When the thumb is at the bottom, position == whole.
4595 So we need to increase `whole' to make space for the thumb. */ 4591 So we need to increase `whole' to make space for the thumb. */
4596 whole += portion; 4592 whole += portion;
@@ -4958,37 +4954,32 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
4958 struct frame *f = XFRAME (w->frame); 4954 struct frame *f = XFRAME (w->frame);
4959 struct scroll_bar *bar; 4955 struct scroll_bar *bar;
4960 int top, height, left, sb_left, width, sb_width; 4956 int top, height, left, sb_left, width, sb_width;
4961 int window_x, window_y, window_width, window_height; 4957 int window_y, window_height;
4962 4958
4963 /* Get window dimensions. */ 4959 /* Get window dimensions. */
4964 window_box (w, -1, &window_x, &window_y, &window_width, &window_height); 4960 window_box (w, -1, 0, &window_y, 0, &window_height);
4965 top = window_y; 4961 top = window_y;
4966 width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f); 4962 width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
4967 height = window_height; 4963 height = window_height;
4968 4964
4969 /* Compute the left edge of the scroll bar area. */ 4965 /* Compute the left edge of the scroll bar area. */
4970 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) 4966 left = WINDOW_SCROLL_BAR_AREA_X (w);
4971 left = XINT (w->left) + XINT (w->width) - FRAME_SCROLL_BAR_COLS (f);
4972 else
4973 left = XFASTINT (w->left);
4974 left *= CANON_X_UNIT (f);
4975 left += FRAME_INTERNAL_BORDER_WIDTH (f);
4976 4967
4977 /* Compute the width of the scroll bar which might be less than 4968 /* Compute the width of the scroll bar which might be less than
4978 the width of the area reserved for the scroll bar. */ 4969 the width of the area reserved for the scroll bar. */
4979 if (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0) 4970 if (WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) > 0)
4980 sb_width = FRAME_SCROLL_BAR_PIXEL_WIDTH (f); 4971 sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
4981 else 4972 else
4982 sb_width = width; 4973 sb_width = width;
4983 4974
4984 /* Compute the left edge of the scroll bar. */ 4975 /* Compute the left edge of the scroll bar. */
4985#ifdef USE_TOOLKIT_SCROLL_BARS 4976#ifdef USE_TOOLKIT_SCROLL_BARS
4986 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) 4977 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
4987 sb_left = left + width - sb_width - (width - sb_width) / 2; 4978 sb_left = left + width - sb_width - (width - sb_width) / 2;
4988 else 4979 else
4989 sb_left = left + (width - sb_width) / 2; 4980 sb_left = left + (width - sb_width) / 2;
4990#else 4981#else
4991 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) 4982 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
4992 sb_left = left + width - sb_width; 4983 sb_left = left + width - sb_width;
4993 else 4984 else
4994 sb_left = left; 4985 sb_left = left;
@@ -5073,11 +5064,11 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5073 previous mode line display is cleared after C-x 2 C-x 1, for 5064 previous mode line display is cleared after C-x 2 C-x 1, for
5074 example. */ 5065 example. */
5075 { 5066 {
5076 int area_width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f); 5067 int area_width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
5077 int rest = area_width - sb_width; 5068 int rest = area_width - sb_width;
5078 if (rest > 0 && height > 0) 5069 if (rest > 0 && height > 0)
5079 { 5070 {
5080 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) 5071 if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
5081 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5072 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5082 left + area_width - rest, top, 5073 left + area_width - rest, top,
5083 rest, height, False); 5074 rest, height, False);
@@ -5864,8 +5855,8 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
5864 5855
5865 if (f) 5856 if (f)
5866 { 5857 {
5867 f->output_data.x->left_pos = new_x; 5858 f->left_pos = new_x;
5868 f->output_data.x->top_pos = new_y; 5859 f->top_pos = new_y;
5869 } 5860 }
5870 } 5861 }
5871#ifdef HACK_EDITRES 5862#ifdef HACK_EDITRES
@@ -5992,8 +5983,8 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
5992 int x, y; 5983 int x, y;
5993 f->output_data.x->parent_desc = event.xreparent.parent; 5984 f->output_data.x->parent_desc = event.xreparent.parent;
5994 x_real_positions (f, &x, &y); 5985 x_real_positions (f, &x, &y);
5995 f->output_data.x->left_pos = x; 5986 f->left_pos = x;
5996 f->output_data.x->top_pos = y; 5987 f->top_pos = y;
5997 } 5988 }
5998 goto OTHER; 5989 goto OTHER;
5999 break; 5990 break;
@@ -6012,9 +6003,8 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
6012 SET_FRAME_GARBAGED (f); 6003 SET_FRAME_GARBAGED (f);
6013 } 6004 }
6014 else 6005 else
6015 expose_frame (x_window_to_frame (dpyinfo, 6006 expose_frame (f,
6016 event.xexpose.window), 6007 event.xexpose.x, event.xexpose.y,
6017 event.xexpose.x, event.xexpose.y,
6018 event.xexpose.width, event.xexpose.height); 6008 event.xexpose.width, event.xexpose.height);
6019 } 6009 }
6020 else 6010 else
@@ -6659,7 +6649,7 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
6659 6649
6660 window = window_from_coordinates (f, 6650 window = window_from_coordinates (f,
6661 event.xmotion.x, event.xmotion.y, 6651 event.xmotion.x, event.xmotion.y,
6662 0, 0); 6652 0, 0, 0, 0);
6663 6653
6664 /* Window will be selected only when it is not selected now and 6654 /* Window will be selected only when it is not selected now and
6665 last mouse movement event was not in it. Minibuffer window 6655 last mouse movement event was not in it. Minibuffer window
@@ -6730,11 +6720,12 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
6730 do this one, the right one will come later. 6720 do this one, the right one will come later.
6731 The toolkit version doesn't seem to need this, but we 6721 The toolkit version doesn't seem to need this, but we
6732 need to reset it below. */ 6722 need to reset it below. */
6733 int dont_resize = 6723 int dont_resize
6734 ((f->output_data.x->want_fullscreen & FULLSCREEN_WAIT) 6724 = ((f->want_fullscreen & FULLSCREEN_WAIT)
6735 && FRAME_NEW_WIDTH (f) != 0); 6725 && f->new_text_cols != 0);
6736 int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height); 6726 int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, event.xconfigure.height);
6737 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width); 6727 int columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, event.xconfigure.width);
6728
6738 if (dont_resize) 6729 if (dont_resize)
6739 goto OTHER; 6730 goto OTHER;
6740 6731
@@ -6745,10 +6736,10 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
6745 /* Even if the number of character rows and columns has 6736 /* Even if the number of character rows and columns has
6746 not changed, the font size may have changed, so we need 6737 not changed, the font size may have changed, so we need
6747 to check the pixel dimensions as well. */ 6738 to check the pixel dimensions as well. */
6748 if (columns != f->width 6739 if (columns != FRAME_COLS (f)
6749 || rows != f->height 6740 || rows != FRAME_LINES (f)
6750 || event.xconfigure.width != f->output_data.x->pixel_width 6741 || event.xconfigure.width != FRAME_PIXEL_WIDTH (f)
6751 || event.xconfigure.height != f->output_data.x->pixel_height) 6742 || event.xconfigure.height != FRAME_PIXEL_HEIGHT (f))
6752 { 6743 {
6753 change_frame_size (f, rows, columns, 0, 1, 0); 6744 change_frame_size (f, rows, columns, 0, 1, 0);
6754 SET_FRAME_GARBAGED (f); 6745 SET_FRAME_GARBAGED (f);
@@ -6757,28 +6748,25 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
6757#endif /* not USE_GTK */ 6748#endif /* not USE_GTK */
6758#endif 6749#endif
6759 6750
6760 f->output_data.x->pixel_width = event.xconfigure.width; 6751 FRAME_PIXEL_WIDTH (f) = event.xconfigure.width;
6761 f->output_data.x->pixel_height = event.xconfigure.height; 6752 FRAME_PIXEL_HEIGHT (f) = event.xconfigure.height;
6762 6753
6763#ifdef USE_GTK 6754#ifdef USE_GTK
6764 /* GTK creates windows but doesn't map them. 6755 /* GTK creates windows but doesn't map them.
6765 Only get real positions and check fullscreen when mapped. */ 6756 Only get real positions and check fullscreen when mapped. */
6766 if (FRAME_GTK_OUTER_WIDGET (f) 6757 if (FRAME_GTK_OUTER_WIDGET (f)
6767 && GTK_WIDGET_MAPPED (FRAME_GTK_OUTER_WIDGET (f))) 6758 && GTK_WIDGET_MAPPED (FRAME_GTK_OUTER_WIDGET (f)))
6768 {
6769#endif 6759#endif
6770 /* What we have now is the position of Emacs's own window. 6760 {
6771 Convert that to the position of the window manager window. */ 6761 /* What we have now is the position of Emacs's own window.
6772 x_real_positions (f, &f->output_data.x->left_pos, 6762 Convert that to the position of the window manager window. */
6773 &f->output_data.x->top_pos); 6763 x_real_positions (f, &f->left_pos, &f->top_pos);
6774 6764
6775 x_check_fullscreen_move (f); 6765 x_check_fullscreen_move (f);
6776 if (f->output_data.x->want_fullscreen & FULLSCREEN_WAIT) 6766 if (f->want_fullscreen & FULLSCREEN_WAIT)
6777 f->output_data.x->want_fullscreen &= 6767 f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
6778 ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
6779#ifdef USE_GTK
6780 } 6768 }
6781#endif 6769
6782#ifdef HAVE_X_I18N 6770#ifdef HAVE_X_I18N
6783 if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea)) 6771 if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMStatusArea))
6784 xic_set_statusarea (f); 6772 xic_set_statusarea (f);
@@ -6788,7 +6776,7 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
6788 { 6776 {
6789 /* Since the WM decorations come below top_pos now, 6777 /* Since the WM decorations come below top_pos now,
6790 we must put them below top_pos in the future. */ 6778 we must put them below top_pos in the future. */
6791 f->output_data.x->win_gravity = NorthWestGravity; 6779 f->win_gravity = NorthWestGravity;
6792 x_wm_set_size_hint (f, (long) 0, 0); 6780 x_wm_set_size_hint (f, (long) 0, 0);
6793 } 6781 }
6794 } 6782 }
@@ -6816,13 +6804,13 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
6816 { 6804 {
6817 /* Is this in the tool-bar? */ 6805 /* Is this in the tool-bar? */
6818 if (WINDOWP (f->tool_bar_window) 6806 if (WINDOWP (f->tool_bar_window)
6819 && XFASTINT (XWINDOW (f->tool_bar_window)->height)) 6807 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)))
6820 { 6808 {
6821 Lisp_Object window; 6809 Lisp_Object window;
6822 int x = event.xbutton.x; 6810 int x = event.xbutton.x;
6823 int y = event.xbutton.y; 6811 int y = event.xbutton.y;
6824 6812
6825 window = window_from_coordinates (f, x, y, 0, 1); 6813 window = window_from_coordinates (f, x, y, 0, 0, 0, 1);
6826 if (EQ (window, f->tool_bar_window)) 6814 if (EQ (window, f->tool_bar_window))
6827 { 6815 {
6828 if (event.xbutton.type == ButtonPress) 6816 if (event.xbutton.type == ButtonPress)
@@ -6905,7 +6893,7 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish)
6905 /* Verify the event is really within the menu bar 6893 /* Verify the event is really within the menu bar
6906 and not just sent to it due to grabbing. */ 6894 and not just sent to it due to grabbing. */
6907 && event.xbutton.x >= 0 6895 && event.xbutton.x >= 0
6908 && event.xbutton.x < f->output_data.x->pixel_width 6896 && event.xbutton.x < FRAME_PIXEL_WIDTH (f)
6909 && event.xbutton.y >= 0 6897 && event.xbutton.y >= 0
6910 && event.xbutton.y < f->output_data.x->menubar_height 6898 && event.xbutton.y < f->output_data.x->menubar_height
6911 && event.xbutton.same_screen) 6899 && event.xbutton.same_screen)
@@ -7206,25 +7194,22 @@ XTread_socket (sd, bufp, numchars, expected)
7206 7194
7207/* Set clipping for output in glyph row ROW. W is the window in which 7195/* Set clipping for output in glyph row ROW. W is the window in which
7208 we operate. GC is the graphics context to set clipping in. 7196 we operate. GC is the graphics context to set clipping in.
7209 WHOLE_LINE_P non-zero means include the areas used for truncation
7210 mark display and alike in the clipping rectangle.
7211 7197
7212 ROW may be a text row or, e.g., a mode line. Text rows must be 7198 ROW may be a text row or, e.g., a mode line. Text rows must be
7213 clipped to the interior of the window dedicated to text display, 7199 clipped to the interior of the window dedicated to text display,
7214 mode lines must be clipped to the whole window. */ 7200 mode lines must be clipped to the whole window. */
7215 7201
7216static void 7202static void
7217x_clip_to_row (w, row, gc, whole_line_p) 7203x_clip_to_row (w, row, gc)
7218 struct window *w; 7204 struct window *w;
7219 struct glyph_row *row; 7205 struct glyph_row *row;
7220 GC gc; 7206 GC gc;
7221 int whole_line_p;
7222{ 7207{
7223 struct frame *f = XFRAME (WINDOW_FRAME (w)); 7208 struct frame *f = XFRAME (WINDOW_FRAME (w));
7224 XRectangle clip_rect; 7209 XRectangle clip_rect;
7225 int window_x, window_y, window_width, window_height; 7210 int window_y, window_width;
7226 7211
7227 window_box (w, -1, &window_x, &window_y, &window_width, &window_height); 7212 window_box (w, -1, 0, &window_y, &window_width, 0);
7228 7213
7229 clip_rect.x = WINDOW_TO_FRAME_PIXEL_X (w, 0); 7214 clip_rect.x = WINDOW_TO_FRAME_PIXEL_X (w, 0);
7230 clip_rect.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); 7215 clip_rect.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
@@ -7232,14 +7217,6 @@ x_clip_to_row (w, row, gc, whole_line_p)
7232 clip_rect.width = window_width; 7217 clip_rect.width = window_width;
7233 clip_rect.height = row->visible_height; 7218 clip_rect.height = row->visible_height;
7234 7219
7235 /* If clipping to the whole line, including trunc marks, extend
7236 the rectangle to the left and increase its width. */
7237 if (whole_line_p)
7238 {
7239 clip_rect.x -= FRAME_X_LEFT_FRINGE_WIDTH (f);
7240 clip_rect.width += FRAME_X_FRINGE_WIDTH (f);
7241 }
7242
7243 XSetClipRectangles (FRAME_X_DISPLAY (f), gc, 0, 0, &clip_rect, 1, Unsorted); 7220 XSetClipRectangles (FRAME_X_DISPLAY (f), gc, 0, 0, &clip_rect, 1, Unsorted);
7244} 7221}
7245 7222
@@ -7279,7 +7256,7 @@ x_draw_hollow_cursor (w, row)
7279 wd = cursor_glyph->pixel_width - 1; 7256 wd = cursor_glyph->pixel_width - 1;
7280 if (cursor_glyph->type == STRETCH_GLYPH 7257 if (cursor_glyph->type == STRETCH_GLYPH
7281 && !x_stretch_cursor_p) 7258 && !x_stretch_cursor_p)
7282 wd = min (CANON_X_UNIT (f), wd); 7259 wd = min (FRAME_COLUMN_WIDTH (f), wd);
7283 w->phys_cursor_width = wd; 7260 w->phys_cursor_width = wd;
7284 7261
7285 /* The foreground of cursor_gc is typically the same as the normal 7262 /* The foreground of cursor_gc is typically the same as the normal
@@ -7293,7 +7270,7 @@ x_draw_hollow_cursor (w, row)
7293 gc = dpyinfo->scratch_cursor_gc; 7270 gc = dpyinfo->scratch_cursor_gc;
7294 7271
7295 /* Set clipping, draw the rectangle, and reset clipping again. */ 7272 /* Set clipping, draw the rectangle, and reset clipping again. */
7296 x_clip_to_row (w, row, gc, 0); 7273 x_clip_to_row (w, row, gc);
7297 XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h); 7274 XDrawRectangle (dpy, FRAME_X_WINDOW (f), gc, x, y, wd, h);
7298 XSetClipMask (dpy, gc, None); 7275 XSetClipMask (dpy, gc, None);
7299} 7276}
@@ -7365,7 +7342,7 @@ x_draw_bar_cursor (w, row, width, kind)
7365 width = min (cursor_glyph->pixel_width, width); 7342 width = min (cursor_glyph->pixel_width, width);
7366 7343
7367 w->phys_cursor_width = width; 7344 w->phys_cursor_width = width;
7368 x_clip_to_row (w, row, gc, 0); 7345 x_clip_to_row (w, row, gc);
7369 7346
7370 if (kind == BAR_CURSOR) 7347 if (kind == BAR_CURSOR)
7371 XFillRectangle (dpy, window, gc, 7348 XFillRectangle (dpy, window, gc,
@@ -7884,46 +7861,44 @@ x_new_font (f, fontname)
7884 if (!fontp) 7861 if (!fontp)
7885 return Qnil; 7862 return Qnil;
7886 7863
7887 f->output_data.x->font = (XFontStruct *) (fontp->font); 7864 FRAME_FONT (f) = (XFontStruct *) (fontp->font);
7888 f->output_data.x->baseline_offset = fontp->baseline_offset; 7865 FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
7889 f->output_data.x->fontset = -1; 7866 FRAME_FONTSET (f) = -1;
7867
7868 FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f));
7869 FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
7890 7870
7891 compute_fringe_widths (f, 1); 7871 compute_fringe_widths (f, 1);
7892 7872
7893 /* Compute the scroll bar width in character columns. */ 7873 /* Compute the scroll bar width in character columns. */
7894 if (f->scroll_bar_pixel_width > 0) 7874 if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
7895 { 7875 {
7896 int wid = FONT_WIDTH (f->output_data.x->font); 7876 int wid = FRAME_COLUMN_WIDTH (f);
7897 f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid; 7877 FRAME_CONFIG_SCROLL_BAR_COLS (f)
7878 = (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid-1) / wid;
7898 } 7879 }
7899 else 7880 else
7900 { 7881 {
7901 int wid = FONT_WIDTH (f->output_data.x->font); 7882 int wid = FRAME_COLUMN_WIDTH (f);
7902 f->scroll_bar_cols = (14 + wid - 1) / wid; 7883 FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
7903 } 7884 }
7904 7885
7905 /* Now make the frame display the given font. */ 7886 /* Now make the frame display the given font. */
7906 if (FRAME_X_WINDOW (f) != 0) 7887 if (FRAME_X_WINDOW (f) != 0)
7907 { 7888 {
7908 XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc, 7889 XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc,
7909 f->output_data.x->font->fid); 7890 FRAME_FONT (f)->fid);
7910 XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->reverse_gc, 7891 XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->reverse_gc,
7911 f->output_data.x->font->fid); 7892 FRAME_FONT (f)->fid);
7912 XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->cursor_gc, 7893 XSetFont (FRAME_X_DISPLAY (f), f->output_data.x->cursor_gc,
7913 f->output_data.x->font->fid); 7894 FRAME_FONT (f)->fid);
7914
7915 frame_update_line_height (f);
7916 7895
7917 /* Don't change the size of a tip frame; there's no point in 7896 /* Don't change the size of a tip frame; there's no point in
7918 doing it because it's done in Fx_show_tip, and it leads to 7897 doing it because it's done in Fx_show_tip, and it leads to
7919 problems because the tip frame has no widget. */ 7898 problems because the tip frame has no widget. */
7920 if (NILP (tip_frame) || XFRAME (tip_frame) != f) 7899 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
7921 x_set_window_size (f, 0, f->width, f->height); 7900 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
7922 } 7901 }
7923 else
7924 /* If we are setting a new frame's font for the first time,
7925 there are no faces yet, so this font's height is the line height. */
7926 f->output_data.x->line_height = FONT_HEIGHT (f->output_data.x->font);
7927 7902
7928 return build_string (fontp->full_name); 7903 return build_string (fontp->full_name);
7929} 7904}
@@ -7944,7 +7919,7 @@ x_new_fontset (f, fontsetname)
7944 if (fontset < 0) 7919 if (fontset < 0)
7945 return Qnil; 7920 return Qnil;
7946 7921
7947 if (f->output_data.x->fontset == fontset) 7922 if (FRAME_FONTSET (f) == fontset)
7948 /* This fontset is already set in frame F. There's nothing more 7923 /* This fontset is already set in frame F. There's nothing more
7949 to do. */ 7924 to do. */
7950 return fontset_name (fontset); 7925 return fontset_name (fontset);
@@ -7956,7 +7931,7 @@ x_new_fontset (f, fontsetname)
7956 return Qnil; 7931 return Qnil;
7957 7932
7958 /* Since x_new_font doesn't update any fontset information, do it now. */ 7933 /* Since x_new_font doesn't update any fontset information, do it now. */
7959 f->output_data.x->fontset = fontset; 7934 FRAME_FONTSET (f) = fontset;
7960 7935
7961#ifdef HAVE_X_I18N 7936#ifdef HAVE_X_I18N
7962 if (FRAME_XIC (f) 7937 if (FRAME_XIC (f)
@@ -8191,7 +8166,7 @@ x_calc_absolute_position (f)
8191{ 8166{
8192 Window child; 8167 Window child;
8193 int win_x = 0, win_y = 0; 8168 int win_x = 0, win_y = 0;
8194 int flags = f->output_data.x->size_hint_flags; 8169 int flags = f->size_hint_flags;
8195 int this_window; 8170 int this_window;
8196 8171
8197 /* We have nothing to do if the current position 8172 /* We have nothing to do if the current position
@@ -8249,13 +8224,13 @@ x_calc_absolute_position (f)
8249 /* Treat negative positions as relative to the leftmost bottommost 8224 /* Treat negative positions as relative to the leftmost bottommost
8250 position that fits on the screen. */ 8225 position that fits on the screen. */
8251 if (flags & XNegative) 8226 if (flags & XNegative)
8252 f->output_data.x->left_pos = (FRAME_X_DISPLAY_INFO (f)->width 8227 f->left_pos = (FRAME_X_DISPLAY_INFO (f)->width
8253 - 2 * f->output_data.x->border_width - win_x 8228 - 2 * f->border_width - win_x
8254 - PIXEL_WIDTH (f) 8229 - FRAME_PIXEL_WIDTH (f)
8255 + f->output_data.x->left_pos); 8230 + f->left_pos);
8256 8231
8257 { 8232 {
8258 int height = PIXEL_HEIGHT (f); 8233 int height = FRAME_PIXEL_HEIGHT (f);
8259 8234
8260#if defined USE_X_TOOLKIT && defined USE_MOTIF 8235#if defined USE_X_TOOLKIT && defined USE_MOTIF
8261 /* Something is fishy here. When using Motif, starting Emacs with 8236 /* Something is fishy here. When using Motif, starting Emacs with
@@ -8274,17 +8249,17 @@ x_calc_absolute_position (f)
8274#endif 8249#endif
8275 8250
8276 if (flags & YNegative) 8251 if (flags & YNegative)
8277 f->output_data.x->top_pos = (FRAME_X_DISPLAY_INFO (f)->height 8252 f->top_pos = (FRAME_X_DISPLAY_INFO (f)->height
8278 - 2 * f->output_data.x->border_width 8253 - 2 * f->border_width
8279 - win_y 8254 - win_y
8280 - height 8255 - height
8281 + f->output_data.x->top_pos); 8256 + f->top_pos);
8282 } 8257 }
8283 8258
8284 /* The left_pos and top_pos 8259 /* The left_pos and top_pos
8285 are now relative to the top and left screen edges, 8260 are now relative to the top and left screen edges,
8286 so the flags should correspond. */ 8261 so the flags should correspond. */
8287 f->output_data.x->size_hint_flags &= ~ (XNegative | YNegative); 8262 f->size_hint_flags &= ~ (XNegative | YNegative);
8288} 8263}
8289 8264
8290/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, 8265/* CHANGE_GRAVITY is 1 when calling from Fset_frame_position,
@@ -8303,30 +8278,30 @@ x_set_offset (f, xoff, yoff, change_gravity)
8303 8278
8304 if (change_gravity > 0) 8279 if (change_gravity > 0)
8305 { 8280 {
8306 f->output_data.x->top_pos = yoff; 8281 f->top_pos = yoff;
8307 f->output_data.x->left_pos = xoff; 8282 f->left_pos = xoff;
8308 f->output_data.x->size_hint_flags &= ~ (XNegative | YNegative); 8283 f->size_hint_flags &= ~ (XNegative | YNegative);
8309 if (xoff < 0) 8284 if (xoff < 0)
8310 f->output_data.x->size_hint_flags |= XNegative; 8285 f->size_hint_flags |= XNegative;
8311 if (yoff < 0) 8286 if (yoff < 0)
8312 f->output_data.x->size_hint_flags |= YNegative; 8287 f->size_hint_flags |= YNegative;
8313 f->output_data.x->win_gravity = NorthWestGravity; 8288 f->win_gravity = NorthWestGravity;
8314 } 8289 }
8315 x_calc_absolute_position (f); 8290 x_calc_absolute_position (f);
8316 8291
8317 BLOCK_INPUT; 8292 BLOCK_INPUT;
8318 x_wm_set_size_hint (f, (long) 0, 0); 8293 x_wm_set_size_hint (f, (long) 0, 0);
8319 8294
8320 modified_left = f->output_data.x->left_pos; 8295 modified_left = f->left_pos;
8321 modified_top = f->output_data.x->top_pos; 8296 modified_top = f->top_pos;
8322#if 0 /* Running on psilocin (Debian), and displaying on the NCD X-terminal, 8297#if 0 /* Running on psilocin (Debian), and displaying on the NCD X-terminal,
8323 this seems to be unnecessary and incorrect. rms, 4/17/97. */ 8298 this seems to be unnecessary and incorrect. rms, 4/17/97. */
8324 /* It is a mystery why we need to add the border_width here 8299 /* It is a mystery why we need to add the border_width here
8325 when the frame is already visible, but experiment says we do. */ 8300 when the frame is already visible, but experiment says we do. */
8326 if (change_gravity != 0) 8301 if (change_gravity != 0)
8327 { 8302 {
8328 modified_left += f->output_data.x->border_width; 8303 modified_left += f->border_width;
8329 modified_top += f->output_data.x->border_width; 8304 modified_top += f->border_width;
8330 } 8305 }
8331#endif 8306#endif
8332 8307
@@ -8341,12 +8316,11 @@ static void
8341x_check_fullscreen (f) 8316x_check_fullscreen (f)
8342 struct frame *f; 8317 struct frame *f;
8343{ 8318{
8344 if (f->output_data.x->want_fullscreen & FULLSCREEN_BOTH) 8319 if (f->want_fullscreen & FULLSCREEN_BOTH)
8345 { 8320 {
8346 int width, height, ign; 8321 int width, height, ign;
8347 8322
8348 x_real_positions (f, &f->output_data.x->left_pos, 8323 x_real_positions (f, &f->left_pos, &f->top_pos);
8349 &f->output_data.x->top_pos);
8350 8324
8351 x_fullscreen_adjust (f, &width, &height, &ign, &ign); 8325 x_fullscreen_adjust (f, &width, &height, &ign, &ign);
8352 8326
@@ -8354,14 +8328,14 @@ x_check_fullscreen (f)
8354 when setting WM manager hints. 8328 when setting WM manager hints.
8355 If the frame is visible already, the position is checked by 8329 If the frame is visible already, the position is checked by
8356 x_check_fullscreen_move. */ 8330 x_check_fullscreen_move. */
8357 if (f->width != width || f->height != height) 8331 if (FRAME_COLS (f) != width || FRAME_LINES (f) != height)
8358 { 8332 {
8359 change_frame_size (f, height, width, 0, 1, 0); 8333 change_frame_size (f, height, width, 0, 1, 0);
8360 SET_FRAME_GARBAGED (f); 8334 SET_FRAME_GARBAGED (f);
8361 cancel_mouse_face (f); 8335 cancel_mouse_face (f);
8362 8336
8363 /* Wait for the change of frame size to occur */ 8337 /* Wait for the change of frame size to occur */
8364 f->output_data.x->want_fullscreen |= FULLSCREEN_WAIT; 8338 f->want_fullscreen |= FULLSCREEN_WAIT;
8365 } 8339 }
8366 } 8340 }
8367} 8341}
@@ -8376,22 +8350,21 @@ static void
8376x_check_fullscreen_move (f) 8350x_check_fullscreen_move (f)
8377 struct frame *f; 8351 struct frame *f;
8378{ 8352{
8379 if (f->output_data.x->want_fullscreen & FULLSCREEN_MOVE_WAIT) 8353 if (f->want_fullscreen & FULLSCREEN_MOVE_WAIT)
8380 { 8354 {
8381 int expect_top = f->output_data.x->top_pos; 8355 int expect_top = f->top_pos;
8382 int expect_left = f->output_data.x->left_pos; 8356 int expect_left = f->left_pos;
8383 8357
8384 if (f->output_data.x->want_fullscreen & FULLSCREEN_HEIGHT) 8358 if (f->want_fullscreen & FULLSCREEN_HEIGHT)
8385 expect_top = 0; 8359 expect_top = 0;
8386 if (f->output_data.x->want_fullscreen & FULLSCREEN_WIDTH) 8360 if (f->want_fullscreen & FULLSCREEN_WIDTH)
8387 expect_left = 0; 8361 expect_left = 0;
8388 8362
8389 if (expect_top != f->output_data.x->top_pos 8363 if (expect_top != f->top_pos || expect_left != f->left_pos)
8390 || expect_left != f->output_data.x->left_pos)
8391 x_set_offset (f, expect_left, expect_top, 1); 8364 x_set_offset (f, expect_left, expect_top, 1);
8392 8365
8393 /* Just do this once */ 8366 /* Just do this once */
8394 f->output_data.x->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT; 8367 f->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT;
8395 } 8368 }
8396} 8369}
8397 8370
@@ -8410,19 +8383,19 @@ x_set_window_size_1 (f, change_gravity, cols, rows)
8410 int pixelwidth, pixelheight; 8383 int pixelwidth, pixelheight;
8411 8384
8412 check_frame_size (f, &rows, &cols); 8385 check_frame_size (f, &rows, &cols);
8413 f->output_data.x->vertical_scroll_bar_extra 8386 f->scroll_bar_actual_width
8414 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) 8387 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
8415 ? 0 8388 ? 0
8416 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 8389 : FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0
8417 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) 8390 ? FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
8418 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.x->font))); 8391 : (FRAME_CONFIG_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f)));
8419 8392
8420 compute_fringe_widths (f, 0); 8393 compute_fringe_widths (f, 0);
8421 8394
8422 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); 8395 pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
8423 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); 8396 pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
8424 8397
8425 f->output_data.x->win_gravity = NorthWestGravity; 8398 f->win_gravity = NorthWestGravity;
8426 x_wm_set_size_hint (f, (long) 0, 0); 8399 x_wm_set_size_hint (f, (long) 0, 0);
8427 8400
8428 XSync (FRAME_X_DISPLAY (f), False); 8401 XSync (FRAME_X_DISPLAY (f), False);
@@ -8443,8 +8416,8 @@ x_set_window_size_1 (f, change_gravity, cols, rows)
8443 We pass 1 for DELAY since we can't run Lisp code inside of 8416 We pass 1 for DELAY since we can't run Lisp code inside of
8444 a BLOCK_INPUT. */ 8417 a BLOCK_INPUT. */
8445 change_frame_size (f, rows, cols, 0, 1, 0); 8418 change_frame_size (f, rows, cols, 0, 1, 0);
8446 PIXEL_WIDTH (f) = pixelwidth; 8419 FRAME_PIXEL_WIDTH (f) = pixelwidth;
8447 PIXEL_HEIGHT (f) = pixelheight; 8420 FRAME_PIXEL_HEIGHT (f) = pixelheight;
8448 8421
8449 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to 8422 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
8450 receive in the ConfigureNotify event; if we get what we asked 8423 receive in the ConfigureNotify event; if we get what we asked
@@ -8518,14 +8491,14 @@ x_set_mouse_position (f, x, y)
8518{ 8491{
8519 int pix_x, pix_y; 8492 int pix_x, pix_y;
8520 8493
8521 pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH (f->output_data.x->font) / 2; 8494 pix_x = FRAME_COL_TO_PIXEL_X (f, x) + FRAME_COLUMN_WIDTH (f) / 2;
8522 pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->output_data.x->line_height / 2; 8495 pix_y = FRAME_LINE_TO_PIXEL_Y (f, y) + FRAME_LINE_HEIGHT (f) / 2;
8523 8496
8524 if (pix_x < 0) pix_x = 0; 8497 if (pix_x < 0) pix_x = 0;
8525 if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f); 8498 if (pix_x > FRAME_PIXEL_WIDTH (f)) pix_x = FRAME_PIXEL_WIDTH (f);
8526 8499
8527 if (pix_y < 0) pix_y = 0; 8500 if (pix_y < 0) pix_y = 0;
8528 if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f); 8501 if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f);
8529 8502
8530 BLOCK_INPUT; 8503 BLOCK_INPUT;
8531 8504
@@ -8652,7 +8625,7 @@ x_make_frame_visible (f)
8652 before the window gets really visible. */ 8625 before the window gets really visible. */
8653 if (! FRAME_ICONIFIED_P (f) 8626 if (! FRAME_ICONIFIED_P (f)
8654 && ! f->output_data.x->asked_for_visible) 8627 && ! f->output_data.x->asked_for_visible)
8655 x_set_offset (f, f->output_data.x->left_pos, f->output_data.x->top_pos, 0); 8628 x_set_offset (f, f->left_pos, f->top_pos, 0);
8656 8629
8657 f->output_data.x->asked_for_visible = 1; 8630 f->output_data.x->asked_for_visible = 1;
8658 8631
@@ -8690,8 +8663,8 @@ x_make_frame_visible (f)
8690 will set it when they are handled. */ 8663 will set it when they are handled. */
8691 int previously_visible = f->output_data.x->has_been_visible; 8664 int previously_visible = f->output_data.x->has_been_visible;
8692 8665
8693 original_left = f->output_data.x->left_pos; 8666 original_left = f->left_pos;
8694 original_top = f->output_data.x->top_pos; 8667 original_top = f->top_pos;
8695 8668
8696 /* This must come after we set COUNT. */ 8669 /* This must come after we set COUNT. */
8697 UNBLOCK_INPUT; 8670 UNBLOCK_INPUT;
@@ -8708,7 +8681,7 @@ x_make_frame_visible (f)
8708 and we don't want to override it. */ 8681 and we don't want to override it. */
8709 8682
8710 if (! FRAME_VISIBLE_P (f) && ! FRAME_ICONIFIED_P (f) 8683 if (! FRAME_VISIBLE_P (f) && ! FRAME_ICONIFIED_P (f)
8711 && f->output_data.x->win_gravity == NorthWestGravity 8684 && f->win_gravity == NorthWestGravity
8712 && previously_visible) 8685 && previously_visible)
8713 { 8686 {
8714 Drawable rootw; 8687 Drawable rootw;
@@ -8949,7 +8922,7 @@ x_iconify_frame (f)
8949 /* Make sure the X server knows where the window should be positioned, 8922 /* Make sure the X server knows where the window should be positioned,
8950 in case the user deiconifies with the window manager. */ 8923 in case the user deiconifies with the window manager. */
8951 if (! FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f)) 8924 if (! FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f))
8952 x_set_offset (f, f->output_data.x->left_pos, f->output_data.x->top_pos, 0); 8925 x_set_offset (f, f->left_pos, f->top_pos, 0);
8953 8926
8954 /* Since we don't know which revision of X we're running, we'll use both 8927 /* Since we don't know which revision of X we're running, we'll use both
8955 the X11R3 and X11R4 techniques. I don't know if this is a good idea. */ 8928 the X11R3 and X11R4 techniques. I don't know if this is a good idea. */
@@ -9164,8 +9137,8 @@ x_wm_set_size_hint (f, flags, user_position)
9164 /* Setting PMaxSize caused various problems. */ 9137 /* Setting PMaxSize caused various problems. */
9165 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; 9138 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */;
9166 9139
9167 size_hints.x = f->output_data.x->left_pos; 9140 size_hints.x = f->left_pos;
9168 size_hints.y = f->output_data.x->top_pos; 9141 size_hints.y = f->top_pos;
9169 9142
9170#ifdef USE_X_TOOLKIT 9143#ifdef USE_X_TOOLKIT
9171 XtSetArg (al[ac], XtNwidth, &widget_width); ac++; 9144 XtSetArg (al[ac], XtNwidth, &widget_width); ac++;
@@ -9174,16 +9147,16 @@ x_wm_set_size_hint (f, flags, user_position)
9174 size_hints.height = widget_height; 9147 size_hints.height = widget_height;
9175 size_hints.width = widget_width; 9148 size_hints.width = widget_width;
9176#else /* not USE_X_TOOLKIT */ 9149#else /* not USE_X_TOOLKIT */
9177 size_hints.height = PIXEL_HEIGHT (f); 9150 size_hints.height = FRAME_PIXEL_HEIGHT (f);
9178 size_hints.width = PIXEL_WIDTH (f); 9151 size_hints.width = FRAME_PIXEL_WIDTH (f);
9179#endif /* not USE_X_TOOLKIT */ 9152#endif /* not USE_X_TOOLKIT */
9180 9153
9181 size_hints.width_inc = FONT_WIDTH (f->output_data.x->font); 9154 size_hints.width_inc = FRAME_COLUMN_WIDTH (f);
9182 size_hints.height_inc = f->output_data.x->line_height; 9155 size_hints.height_inc = FRAME_LINE_HEIGHT (f);
9183 size_hints.max_width 9156 size_hints.max_width
9184 = FRAME_X_DISPLAY_INFO (f)->width - CHAR_TO_PIXEL_WIDTH (f, 0); 9157 = FRAME_X_DISPLAY_INFO (f)->width - FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
9185 size_hints.max_height 9158 size_hints.max_height
9186 = FRAME_X_DISPLAY_INFO (f)->height - CHAR_TO_PIXEL_HEIGHT (f, 0); 9159 = FRAME_X_DISPLAY_INFO (f)->height - FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0);
9187 9160
9188 /* Calculate the base and minimum sizes. 9161 /* Calculate the base and minimum sizes.
9189 9162
@@ -9194,8 +9167,8 @@ x_wm_set_size_hint (f, flags, user_position)
9194 int base_width, base_height; 9167 int base_width, base_height;
9195 int min_rows = 0, min_cols = 0; 9168 int min_rows = 0, min_cols = 0;
9196 9169
9197 base_width = CHAR_TO_PIXEL_WIDTH (f, 0); 9170 base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0);
9198 base_height = CHAR_TO_PIXEL_HEIGHT (f, 0); 9171 base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 0);
9199 9172
9200 check_frame_size (f, &min_rows, &min_cols); 9173 check_frame_size (f, &min_rows, &min_cols);
9201 9174
@@ -9270,7 +9243,7 @@ x_wm_set_size_hint (f, flags, user_position)
9270#endif 9243#endif
9271 9244
9272#ifdef PWinGravity 9245#ifdef PWinGravity
9273 size_hints.win_gravity = f->output_data.x->win_gravity; 9246 size_hints.win_gravity = f->win_gravity;
9274 size_hints.flags |= PWinGravity; 9247 size_hints.flags |= PWinGravity;
9275 9248
9276 if (user_position) 9249 if (user_position)