changeset 51204:082b768216a0

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. (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. (w32_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.
author Kim F. Storm <storm@cua.dk>
date Sat, 24 May 2003 22:06:19 +0000
parents f04f396f6f9f
children e53316f7017e
files src/w32term.c
diffstat 1 files changed, 111 insertions(+), 127 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32term.c	Sat May 24 22:04:14 2003 +0000
+++ b/src/w32term.c	Sat May 24 22:06:19 2003 +0000
@@ -256,8 +256,7 @@
 static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
 static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int,
 				   enum text_cursor_kinds));
-static void w32_clip_to_row P_ ((struct window *, struct glyph_row *,
-                                 HDC, int));
+static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, HDC));
 
 static Lisp_Object Qvendor_specific_keysyms;
 
@@ -653,7 +652,7 @@
       {
 	HDC hdc = get_frame_dc (f);
 	w32_clear_area (f, hdc, 0, y, width, height);
-	w32_clear_area (f, hdc, f->output_data.w32->pixel_width - width,
+	w32_clear_area (f, hdc, FRAME_PIXEL_WIDTH (f) - width,
 			y, width, height);
 	release_frame_dc (f, hdc);
       }
@@ -680,7 +679,7 @@
   hdc = get_frame_dc (f);
 
   /* Must clip because of partially visible lines.  */
-  w32_clip_to_row (w, row, hdc, 1);
+  w32_clip_to_row (w, row, hdc);
 
   if (p->bx >= 0)
     {
@@ -1834,9 +1833,10 @@
   if (s->row->full_width_p
       && !s->w->pseudo_window_p)
     {
-      last_x += FRAME_X_RIGHT_FRINGE_WIDTH (s->f);
-      if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f))
-	last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f);
+      last_x += WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w);
+      if (s->area != RIGHT_MARGIN_AREA
+	  || WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (s->w))
+	last_x += WINDOW_RIGHT_FRINGE_WIDTH (s->w);
     }
 
   /* The glyph that may have a right box line.  */
@@ -2258,7 +2258,7 @@
     {
       /* If `x-stretch-block-cursor' is nil, don't draw a block cursor
 	 as wide as the stretch glyph.  */
-      int width = min (CANON_X_UNIT (s->f), s->background_width);
+      int width = min (FRAME_COLUMN_WIDTH (s->f), s->background_width);
 
       /* Draw cursor.  */
       x_draw_glyph_string_bg_rect (s, s->x, s->y, width, s->height);
@@ -2603,8 +2603,6 @@
      without mode lines.  Include in this box the left and right
      fringes of W.  */
   window_box (w, -1, &x, &y, &width, &height);
-  width += FRAME_X_FRINGE_WIDTH (f);
-  x -= FRAME_X_LEFT_FRINGE_WIDTH (f);
 
   from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);
   to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);
@@ -3072,15 +3070,14 @@
 {
   Lisp_Object window;
 
-  window = window_from_coordinates (f, x, y, 0, 0);
+  window = window_from_coordinates (f, x, y, 0, &x, &y, 0);
+
   if (!NILP (window))
     {
       struct window *w = XWINDOW (window);
       struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
       struct glyph_row *end = r + w->current_matrix->nrows - 1;
 
-      frame_to_window_pixel_xy (w, &x, &y);
-
       for (; r < end && r->enabled_p; ++r)
 	if (r->y <= y && r->y + r->height > y)
 	  {
@@ -3095,7 +3092,10 @@
 	    if (x < r->x)
 	      {
 		/* x is to the left of the first glyph in the row.  */
-		rect->left = XINT (w->left);
+		/* Shouldn't this be a pixel value?
+		   WINDOW_LEFT_EDGE_X (w) seems to be the right value.
+		   ++KFS */
+		rect->left = WINDOW_LEFT_EDGE_COL (w);
 		rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x);
 		return 1;
 	      }
@@ -3111,7 +3111,10 @@
 
 	    /* x is to the right of the last glyph in the row.  */
 	    rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);
-	    rect->right = XINT (w->left) + XINT (w->width);
+	    /* Shouldn't this be a pixel value?  
+	       WINDOW_RIGHT_EDGE_X (w) seems to be the right value.
+	       ++KFS */
+	    rect->right = WINDOW_RIGHT_EDGE_COL (w);
 	    return 1;
 	  }
     }
@@ -3131,7 +3134,7 @@
       int width = FRAME_SMALLEST_CHAR_WIDTH (f1);
       int height = FRAME_SMALLEST_FONT_HEIGHT (f1);
 
-      /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to
+      /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
 	 round down even for negative values.  */
       if (gx < 0)
 	gx -= width - 1;
@@ -3572,31 +3575,26 @@
   struct frame *f = XFRAME (w->frame);
   struct scroll_bar *bar;
   int top, height, left, sb_left, width, sb_width;
-  int window_x, window_y, window_width, window_height;
+  int window_y, window_height;
 
   /* Get window dimensions.  */
-  window_box (w, -1, &window_x, &window_y, &window_width, &window_height);
+  window_box (w, -1, 0, &window_y, 0, &window_height);
   top  = window_y;
-  width = FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f);
+  width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
   height = window_height;
 
   /* Compute the left edge of the scroll bar area.  */
-  if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
-    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);
+  left = WINDOW_SCROLL_BAR_AREA_X (w);
 
   /* Compute the width of the scroll bar which might be less than
      the width of the area reserved for the scroll bar.  */
-  if (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0)
-    sb_width = FRAME_SCROLL_BAR_PIXEL_WIDTH (f);
+  if (WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) > 0)
+    sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w);
   else
     sb_width = width;
 
   /* Compute the left edge of the scroll bar.  */
-  if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))
+  if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
     sb_left = left + width - sb_width - (width - sb_width) / 2;
   else
     sb_left = left + (width - sb_width) / 2;
@@ -4248,7 +4246,7 @@
 		  int x = LOWORD (msg.msg.lParam);
 		  int y = HIWORD (msg.msg.lParam);
 
-		  window = window_from_coordinates (f, x, y, 0, 0);
+		  window = window_from_coordinates (f, x, y, 0, 0, 0, 0);
 
 		  /* Window will be selected only when it is not
 		     selected now and last mouse movement event was
@@ -4333,13 +4331,13 @@
 
                 /* Is this in the tool-bar?  */
                 if (WINDOWP (f->tool_bar_window)
-                    && XFASTINT (XWINDOW (f->tool_bar_window)->height))
+                    && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)))
                   {
                     Lisp_Object window;
 		    int x = XFASTINT (emacs_event.x);
 		    int y = XFASTINT (emacs_event.y);
 
-                    window = window_from_coordinates (f, x, y, 0, 1);
+                    window = window_from_coordinates (f, x, y, 0, 0, 0, 1);
 
                     if (EQ (window, f->tool_bar_window))
                       {
@@ -4439,9 +4437,8 @@
 	  if (f)
 	    {
 	      x_check_fullscreen_move(f);
-	      if (f->output_data.w32->want_fullscreen & FULLSCREEN_WAIT)
-		f->output_data.w32->want_fullscreen &=
-		  ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
+	      if (f->want_fullscreen & FULLSCREEN_WAIT)
+		f->want_fullscreen &= ~(FULLSCREEN_WAIT|FULLSCREEN_BOTH);
 	    }
 	  check_visibility = 1;
 	  break;
@@ -4462,8 +4459,8 @@
 	      int x, y;
 
 	      x_real_positions (f, &x, &y);
-	      f->output_data.w32->left_pos = x;
-	      f->output_data.w32->top_pos = y;
+	      f->left_pos = x;
+	      f->top_pos = y;
 	    }
 
 	  check_visibility = 1;
@@ -4535,8 +4532,8 @@
                          when the Window is iconified, with 3000,3000
                          as the co-ords. */
                       x_real_positions (f, &x, &y);
-                      f->output_data.w32->left_pos = x;
-                      f->output_data.w32->top_pos = y;
+                      f->left_pos = x;
+                      f->top_pos = y;
 
 		      bufp->kind = DEICONIFY_EVENT;
 		      XSETFRAME (bufp->frame_or_window, f);
@@ -4568,8 +4565,8 @@
 	      height = rect.bottom - rect.top;
 	      width = rect.right - rect.left;
 
-	      rows = PIXEL_TO_CHAR_HEIGHT (f, height);
-	      columns = PIXEL_TO_CHAR_WIDTH (f, width);
+	      rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height);
+	      columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width);
 
 	      /* TODO: Clip size to the screen dimensions.  */
 
@@ -4577,17 +4574,17 @@
 		 not changed, the font size may have changed, so we need
 		 to check the pixel dimensions as well.  */
 
-	      if (columns != f->width
-		  || rows != f->height
-		  || width != f->output_data.w32->pixel_width
-		  || height != f->output_data.w32->pixel_height)
+	      if (columns != FRAME_COLS (f)
+		  || rows != FRAME_LINES (f)
+		  || width != FRAME_PIXEL_WIDTH (f)
+		  || height != FRAME_PIXEL_HEIGHT (f))
 		{
 		  change_frame_size (f, rows, columns, 0, 1, 0);
 		  SET_FRAME_GARBAGED (f);
 		  cancel_mouse_face (f);
-		  f->output_data.w32->pixel_width = width;
-		  f->output_data.w32->pixel_height = height;
-		  f->output_data.w32->win_gravity = NorthWestGravity;
+		  FRAME_PIXEL_WIDTH (f) = width;
+		  FRAME_PIXEL_HEIGHT (f) = height;
+		  f->win_gravity = NorthWestGravity;
 		}
 	    }
 
@@ -4868,25 +4865,22 @@
 
 /* Set clipping for output in glyph row ROW.  W is the window in which
    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.
 
    ROW may be a text row or, e.g., a mode line.  Text rows must be
    clipped to the interior of the window dedicated to text display,
    mode lines must be clipped to the whole window.  */
 
 static void
-w32_clip_to_row (w, row, hdc, whole_line_p)
+w32_clip_to_row (w, row, hdc)
      struct window *w;
      struct glyph_row *row;
      HDC hdc;
-     int whole_line_p;
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   RECT clip_rect;
-  int window_x, window_y, window_width, window_height;
-
-  window_box (w, -1, &window_x, &window_y, &window_width, &window_height);
+  int window_y, window_width;
+
+  window_box (w, -1, 0, &window_y, &window_width, 0);
 
   clip_rect.left = WINDOW_TO_FRAME_PIXEL_X (w, 0);
   clip_rect.top = WINDOW_TO_FRAME_PIXEL_Y (w, row->y);
@@ -4894,14 +4888,6 @@
   clip_rect.right = clip_rect.left + window_width;
   clip_rect.bottom = clip_rect.top + row->visible_height;
 
-  /* 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);
-    }
-
   w32_set_clip_rectangle (hdc, &clip_rect);
 }
 
@@ -4940,13 +4926,13 @@
   wd = cursor_glyph->pixel_width;
   if (cursor_glyph->type == STRETCH_GLYPH
       && !x_stretch_cursor_p)
-    wd = min (CANON_X_UNIT (f), wd);
+    wd = min (FRAME_COLUMN_WIDTH (f), wd);
   w->phys_cursor_width = wd;
 
   rect.right = rect.left + wd;
   hdc = get_frame_dc (f);
   /* Set clipping, draw the rectangle, and reset clipping again.  */
-  w32_clip_to_row (w, row, hdc, 0);
+  w32_clip_to_row (w, row, hdc);
   FrameRect (hdc, &rect, hb);
   DeleteObject (hb);
   w32_set_clip_rectangle (hdc, NULL);
@@ -5012,7 +4998,7 @@
 
 
       hdc = get_frame_dc (f);
-      w32_clip_to_row (w, row, hdc, 0);
+      w32_clip_to_row (w, row, hdc);
 
       if (kind == BAR_CURSOR)
 	{
@@ -5241,29 +5227,30 @@
   FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset;
   FRAME_FONTSET (f) = -1;
 
+  FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f));
+  FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f));
+
+  compute_fringe_widths (f, 1);
+
   /* Compute the scroll bar width in character columns.  */
-  if (f->scroll_bar_pixel_width > 0)
+  if (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0)
     {
-      int wid = FONT_WIDTH (FRAME_FONT (f));
-      f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid;
+      int wid = FRAME_COLUMN_WIDTH (f);
+      FRAME_CONFIG_SCROLL_BAR_COLS (f)
+	= (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) + wid-1) / wid;
     }
   else
     {
-      int wid = FONT_WIDTH (FRAME_FONT (f));
-      f->scroll_bar_cols = (14 + wid - 1) / wid;
+      int wid = FRAME_COLUMN_WIDTH (f);
+      FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
     }
 
   /* Now make the frame display the given font.  */
   if (FRAME_W32_WINDOW (f) != 0)
     {
-      frame_update_line_height (f);
       if (NILP (tip_frame) || XFRAME (tip_frame) != f)
-        x_set_window_size (f, 0, f->width, f->height);
+        x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
     }
-  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.w32->line_height = FONT_HEIGHT (FRAME_FONT (f));
 
   return build_string (fontp->full_name);
 }
@@ -5325,7 +5312,7 @@
      struct frame *f;
 {
   POINT pt;
-  int flags = f->output_data.w32->size_hint_flags;
+  int flags = f->size_hint_flags;
 
   pt.x = pt.y = 0;
 
@@ -5357,20 +5344,20 @@
   /* Treat negative positions as relative to the leftmost bottommost
      position that fits on the screen.  */
   if (flags & XNegative)
-    f->output_data.w32->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width
-			      - 2 * f->output_data.w32->border_width - pt.x
-			      - PIXEL_WIDTH (f)
-			      + f->output_data.w32->left_pos);
+    f->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width
+		   - 2 * f->border_width - pt.x
+		   - FRAME_PIXEL_WIDTH (f)
+		   + f->left_pos);
 
   if (flags & YNegative)
-    f->output_data.w32->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height
-			     - 2 * f->output_data.w32->border_width - pt.y
-			     - PIXEL_HEIGHT (f)
-			     + f->output_data.w32->top_pos);
+    f->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height
+		  - 2 * f->border_width - pt.y
+		  - FRAME_PIXEL_HEIGHT (f)
+		  + f->top_pos);
   /* The left_pos and top_pos
      are now relative to the top and left screen edges,
      so the flags should correspond.  */
-  f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative);
+  f->size_hint_flags &= ~ (XNegative | YNegative);
 }
 
 /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position,
@@ -5389,22 +5376,22 @@
 
   if (change_gravity > 0)
     {
-      f->output_data.w32->top_pos = yoff;
-      f->output_data.w32->left_pos = xoff;
-      f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative);
+      f->top_pos = yoff;
+      f->left_pos = xoff;
+      f->size_hint_flags &= ~ (XNegative | YNegative);
       if (xoff < 0)
-	f->output_data.w32->size_hint_flags |= XNegative;
+	f->size_hint_flags |= XNegative;
       if (yoff < 0)
-	f->output_data.w32->size_hint_flags |= YNegative;
-      f->output_data.w32->win_gravity = NorthWestGravity;
+	f->size_hint_flags |= YNegative;
+      f->win_gravity = NorthWestGravity;
     }
   x_calc_absolute_position (f);
 
   BLOCK_INPUT;
   x_wm_set_size_hint (f, (long) 0, 0);
 
-  modified_left = f->output_data.w32->left_pos;
-  modified_top = f->output_data.w32->top_pos;
+  modified_left = f->left_pos;
+  modified_top = f->top_pos;
 
   my_set_window_pos (FRAME_W32_WINDOW (f),
 		     NULL,
@@ -5421,12 +5408,11 @@
 x_check_fullscreen (f)
      struct frame *f;
 {
-  if (f->output_data.w32->want_fullscreen & FULLSCREEN_BOTH)
+  if (f->want_fullscreen & FULLSCREEN_BOTH)
     {
       int width, height, ign;
 
-      x_real_positions (f, &f->output_data.w32->left_pos,
-                        &f->output_data.w32->top_pos);
+      x_real_positions (f, &f->left_pos, &f->top_pos);
 
       x_fullscreen_adjust (f, &width, &height, &ign, &ign);
 
@@ -5434,14 +5420,14 @@
          when setting WM manager hints.
          If the frame is visible already, the position is checked by
          x_check_fullscreen_move. */
-      if (f->width != width || f->height != height)
+      if (FRAME_COLS (f) != width || FRAME_LINES (f) != height)
         {
           change_frame_size (f, height, width, 0, 1, 0);
           SET_FRAME_GARBAGED (f);
           cancel_mouse_face (f);
 
           /* Wait for the change of frame size to occur */
-          f->output_data.w32->want_fullscreen |= FULLSCREEN_WAIT;
+          f->want_fullscreen |= FULLSCREEN_WAIT;
         }
     }
 }
@@ -5456,22 +5442,22 @@
 x_check_fullscreen_move (f)
      struct frame *f;
 {
-  if (f->output_data.w32->want_fullscreen & FULLSCREEN_MOVE_WAIT)
+  if (f->want_fullscreen & FULLSCREEN_MOVE_WAIT)
   {
-    int expect_top = f->output_data.w32->top_pos;
-    int expect_left = f->output_data.w32->left_pos;
-
-    if (f->output_data.w32->want_fullscreen & FULLSCREEN_HEIGHT)
+    int expect_top = f->top_pos;
+    int expect_left = f->left_pos;
+
+    if (f->want_fullscreen & FULLSCREEN_HEIGHT)
       expect_top = 0;
-    if (f->output_data.w32->want_fullscreen & FULLSCREEN_WIDTH)
+    if (f->want_fullscreen & FULLSCREEN_WIDTH)
       expect_left = 0;
 
-    if (expect_top != f->output_data.w32->top_pos
-        || expect_left != f->output_data.w32->left_pos)
+    if (expect_top != f->top_pos
+        || expect_left != f->left_pos)
       x_set_offset (f, expect_left, expect_top, 1);
 
     /* Just do this once */
-    f->output_data.w32->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT;
+    f->want_fullscreen &= ~FULLSCREEN_MOVE_WAIT;
   }
 }
 
@@ -5492,17 +5478,15 @@
   BLOCK_INPUT;
 
   check_frame_size (f, &rows, &cols);
-  f->output_data.w32->vertical_scroll_bar_extra
-    = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
-       ? 0
-       : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font)));
+  f->scroll_bar_actual_width
+    = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f);
 
   compute_fringe_widths (f, 0);
 
-  pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);
-  pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows);
-
-  f->output_data.w32->win_gravity = NorthWestGravity;
+  pixelwidth = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, cols);
+  pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
+
+  f->win_gravity = NorthWestGravity;
   x_wm_set_size_hint (f, (long) 0, 0);
 
   {
@@ -5537,8 +5521,8 @@
      We pass 1 for DELAY since we can't run Lisp code inside of
      a BLOCK_INPUT.  */
   change_frame_size (f, rows, cols, 0, 1, 0);
-  PIXEL_WIDTH (f) = pixelwidth;
-  PIXEL_HEIGHT (f) = pixelheight;
+  FRAME_PIXEL_WIDTH (f) = pixelwidth;
+  FRAME_PIXEL_HEIGHT (f) = pixelheight;
 
   /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
      receive in the ConfigureNotify event; if we get what we asked
@@ -5569,14 +5553,14 @@
 {
   int pix_x, pix_y;
 
-  pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH  (f->output_data.w32->font) / 2;
-  pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->output_data.w32->line_height / 2;
+  pix_x = FRAME_COL_TO_PIXEL_X (f, x) + FRAME_COLUMN_WIDTH (f) / 2;
+  pix_y = FRAME_LINE_TO_PIXEL_Y (f, y) + FRAME_LINE_HEIGHT (f) / 2;
 
   if (pix_x < 0) pix_x = 0;
-  if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f);
+  if (pix_x > FRAME_PIXEL_WIDTH (f)) pix_x = FRAME_PIXEL_WIDTH (f);
 
   if (pix_y < 0) pix_y = 0;
-  if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f);
+  if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f);
 
   x_set_mouse_pixel_position (f, pix_x, pix_y);
 }
@@ -5744,7 +5728,7 @@
 	 before the window gets really visible.  */
       if (! FRAME_ICONIFIED_P (f)
 	  && ! f->output_data.w32->asked_for_visible)
-	x_set_offset (f, f->output_data.w32->left_pos, f->output_data.w32->top_pos, 0);
+	x_set_offset (f, f->left_pos, f->top_pos, 0);
 
       f->output_data.w32->asked_for_visible = 1;
 
@@ -5932,10 +5916,10 @@
 
   enter_crit ();
 
-  SetWindowLong (window, WND_FONTWIDTH_INDEX, FONT_WIDTH (f->output_data.w32->font));
-  SetWindowLong (window, WND_LINEHEIGHT_INDEX, f->output_data.w32->line_height);
-  SetWindowLong (window, WND_BORDER_INDEX, f->output_data.w32->internal_border_width);
-  SetWindowLong (window, WND_SCROLLBAR_INDEX, f->output_data.w32->vertical_scroll_bar_extra);
+  SetWindowLong (window, WND_FONTWIDTH_INDEX, FRAME_COLUMN_WIDTH (f));
+  SetWindowLong (window, WND_LINEHEIGHT_INDEX, FRAME_LINE_HEIGHT (f));
+  SetWindowLong (window, WND_BORDER_INDEX, FRAME_INTERNAL_BORDER_WIDTH (f));
+  SetWindowLong (window, WND_SCROLLBAR_INDEX, f->scroll_bar_actual_width);
 
   leave_crit ();
 }