Jinoh Kang (@iamahuman) commented about server/window.c:
struct region *tmp; if (!get_window_visible_rect( win, &rect, frame )) return NULL;
- if (win->parent && is_window_using_parent_dc( win ))
- {
int offset_x, offset_y;
if (!get_window_visible_rect( win->parent, &rect, 0 )) return NULL;
offset_x = rect.left + (frame ? win->window_rect.left : win->client_rect.left);
offset_y = rect.top + (frame ? win->window_rect.top : win->client_rect.top);
This subtracts `rect.left` from `rect.left` and `rect.top` from `rect.top`. In other words, It ignores the left-top coordinate for no apparent reason.
What if the parent window is partially occluded by the frame of ancestors? Then `rect.left` would be larger than the window edge, shifting the update rect further towards upper-left corner.
Instead, this should be changed to something like[^1][^2][^3]:
```suggestion:-1+0 offset_x = win->parent->client_rect.left - win->parent->window_rect.left + win->window_rect.left; offset_y = win->parent->client_rect.top - win->parent->window_rect.top + win->window_rect.top; ```
You can split this into multiple calls to `offset_rect` or just multiple lines if you like.
Also, it would be nice to have tests for the case when `rect.left != win->parent->client_rect.left - win->parent->window_rect.left` (same goes for `top`). Specifically, the test should prevent the suggested code from regressing.
[^1]: user32:dce test result: https://testbot.winehq.org/JobDetails.pl?Key=146182. [^2]: user32:msg test result: https://testbot.winehq.org/JobDetails.pl?Key=146183. [^3]: user32:win test result: https://testbot.winehq.org/JobDetails.pl?Key=146184.