On Sat Jun 8 14:04:59 2024 +0000, Jinoh Kang wrote:
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,top}` 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]:
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 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.
(Note: having the regression test *would be nice*, but is not necessary. Normally I would try to test for this kind of thing, but feel free to skip if it seems like too much work.)