- /* Calculate clipping, which is used for all manner of onscreen
- xwidget views. Each widget border can get clipped by other emacs
- objects so there are four clipping variables. */
- clip_right =
- min (xww->width,
- WINDOW_RIGHT_EDGE_X (s->w) - x -
- WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w) -
- WINDOW_RIGHT_FRINGE_WIDTH (s->w));
- clip_left =
- max (0,
- WINDOW_LEFT_EDGE_X (s->w) - x +
- WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w) +
- WINDOW_LEFT_FRINGE_WIDTH (s->w));
-
- clip_bottom =
- min (xww->height,
- WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y);
- clip_top = max (0, WINDOW_TOP_EDGE_Y (s->w) - y);
+ int text_area_x, text_area_y, text_area_width, text_area_height;
+
+ window_box (s->w, TEXT_AREA, &text_area_x, &text_area_y,
+ &text_area_width, &text_area_height);
+ clip_left = max (0, text_area_x - x);
+ clip_right = max (clip_left,
+ min (xww->width, text_area_x + text_area_width - x));
+ clip_top = max (0, text_area_y - y);
+ clip_bottom = max (clip_top,
+ min (xww->height, text_area_y + text_area_height - y));