diff options
| author | Gerd Möllmann | 2025-02-17 10:42:02 +0100 |
|---|---|---|
| committer | Gerd Möllmann | 2025-02-17 11:22:28 +0100 |
| commit | d80ac0fbaa09826342a9818014ae950acc7c0c03 (patch) | |
| tree | 0516797980a6302298b420e06fac920a14e50d2e /src | |
| parent | ae4685c5e220ff4c7f37171e2a1087f2c9b178fa (diff) | |
| download | emacs-d80ac0fbaa09826342a9818014ae950acc7c0c03.tar.gz emacs-d80ac0fbaa09826342a9818014ae950acc7c0c03.zip | |
Fix child coordinate calculation (bug#76321)
* src/dispnew.c (rect_intersect): Simplify.
(copy_child_glyphs): Compute child coordinates using child_xy.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index a952f7623c0..bb480f88537 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3288,15 +3288,15 @@ struct rect | |||
| 3288 | static bool | 3288 | static bool |
| 3289 | rect_intersect (struct rect *r, struct rect r1, struct rect r2) | 3289 | rect_intersect (struct rect *r, struct rect r1, struct rect r2) |
| 3290 | { | 3290 | { |
| 3291 | int x1 = max (r1.x, r2.x); | 3291 | int x = max (r1.x, r2.x); |
| 3292 | int x2 = min (r1.x + r1.w, r2.x + r2.w); | 3292 | int y = max (r1.y, r2.y); |
| 3293 | if (x2 < x1) | 3293 | int w = min (r1.x + r1.w, r2.x + r2.w) - x; |
| 3294 | return false; | 3294 | int h = min (r1.y + r1.h, r2.y + r2.h) - y; |
| 3295 | int y1 = max (r1.y, r2.y); | 3295 | |
| 3296 | int y2 = min (r1.y + r1.h, r2.y + r2.h); | 3296 | if (w == 0 || h == 0) |
| 3297 | if (y2 < y1) | ||
| 3298 | return false; | 3297 | return false; |
| 3299 | *r = (struct rect) { .x = x1, .y = y1, .w = x2 - x1, .h = y2 - y1 }; | 3298 | |
| 3299 | *r = (struct rect) { .x = x, .y = y, .w = w, .h = h }; | ||
| 3300 | return true; | 3300 | return true; |
| 3301 | } | 3301 | } |
| 3302 | 3302 | ||
| @@ -3720,8 +3720,8 @@ copy_child_glyphs (struct frame *root, struct frame *child) | |||
| 3720 | } | 3720 | } |
| 3721 | 3721 | ||
| 3722 | /* First visible row/col, relative to the child frame. */ | 3722 | /* First visible row/col, relative to the child frame. */ |
| 3723 | int child_x = child->left_pos < 0 ? - child->left_pos : 0; | 3723 | int child_x, child_y; |
| 3724 | int child_y = child->top_pos < 0 ? - child->top_pos : 0; | 3724 | child_xy (child, r.x, r.y, &child_x, &child_y); |
| 3725 | 3725 | ||
| 3726 | /* For all rows in the intersection, copy glyphs from the child's | 3726 | /* For all rows in the intersection, copy glyphs from the child's |
| 3727 | current matrix to the root's desired matrix, enabling those rows | 3727 | current matrix to the root's desired matrix, enabling those rows |