aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2016-04-09 15:04:54 +0300
committerEli Zaretskii2016-04-09 15:04:54 +0300
commit97211f3630d0f5b76a5416075f7c7182e1ee3abd (patch)
treef8bea1f634747326cf70957520763b7033acb55a /src
parente87fbc07801a4ac291d335f0af957ca32cd26381 (diff)
downloademacs-97211f3630d0f5b76a5416075f7c7182e1ee3abd.tar.gz
emacs-97211f3630d0f5b76a5416075f7c7182e1ee3abd.zip
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)
578 other time to know things like window placement etc. */ 578 other time to know things like window placement etc. */
579 xv = xwidget_init_view (xww, s, x, y); 579 xv = xwidget_init_view (xww, s, x, y);
580 580
581 /* Calculate clipping, which is used for all manner of onscreen 581 int text_area_x, text_area_y, text_area_width, text_area_height;
582 xwidget views. Each widget border can get clipped by other emacs 582
583 objects so there are four clipping variables. */ 583 window_box (s->w,
584 clip_right = 584 ANY_AREA,
585 min (xww->width, 585 &text_area_x,
586 WINDOW_RIGHT_EDGE_X (s->w) - x - 586 &text_area_y,
587 WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH (s->w) - 587 &text_area_width,
588 WINDOW_RIGHT_FRINGE_WIDTH (s->w)); 588 &text_area_height);
589 clip_left = 589 clip_right = min (xww->width,
590 max (0, 590 text_area_width);
591 WINDOW_LEFT_EDGE_X (s->w) - x + 591 clip_left = max (0,
592 WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (s->w) + 592 text_area_x);
593 WINDOW_LEFT_FRINGE_WIDTH (s->w)); 593
594 594 clip_bottom = min (xww->height,
595 clip_bottom = 595 text_area_height);
596 min (xww->height, 596 clip_top = max (0, text_area_y);
597 WINDOW_BOTTOM_EDGE_Y (s->w) - WINDOW_MODE_LINE_HEIGHT (s->w) - y);
598 clip_top = max (0, WINDOW_TOP_EDGE_Y (s->w) - y);
599 597
600 /* We are concerned with movement of the onscreen area. The area 598 /* We are concerned with movement of the onscreen area. The area
601 might sit still when the widget actually moves. This happens 599 might sit still when the widget actually moves. This happens