summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona <joakim@verona.se>2016-04-09 15:04:54 +0300
committerEli Zaretskii <eliz@gnu.org>2016-04-09 15:04:54 +0300
commit97211f3630d0f5b76a5416075f7c7182e1ee3abd (patch)
treef8bea1f634747326cf70957520763b7033acb55a /src
parente87fbc07801a4ac291d335f0af957ca32cd26381 (diff)
downloademacs-97211f3630d0f5b76a5416075f7c7182e1ee3abd.tar.gz
Fix clipping of xwidgets
* src/xwidget.c (x_draw_xwidget_glyph_string): Use window_box instead of calculating the clipping borders manually. Suggested by YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>.
Diffstat (limited to 'src')
-rw-r--r--src/xwidget.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/xwidget.c b/src/xwidget.c
index 8ff4c23b1f2..7e96307bdd8 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -578,24 +578,22 @@ x_draw_xwidget_glyph_string (struct glyph_string *s)
other time to know things like window placement etc. */
xv = xwidget_init_view (xww, s, x, y);
- /* 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,
+ ANY_AREA,
+ &text_area_x,
+ &text_area_y,
+ &text_area_width,
+ &text_area_height);
+ clip_right = min (xww->width,
+ text_area_width);
+ clip_left = max (0,
+ text_area_x);
+
+ clip_bottom = min (xww->height,
+ text_area_height);
+ clip_top = max (0, text_area_y);
/* We are concerned with movement of the onscreen area. The area
might sit still when the widget actually moves. This happens