On 27/08/2021 17:51, Huw Davies wrote:
On Thu, Aug 26, 2021 at 05:59:45PM +0300, Gabriel Ivăncescu wrote:
Thanks, I didn't really like the IsIconic thing, it seemed fragile, so I went with a slightly different approach, which also makes update_maximized_pos more typical like the other helpers, in that it takes a HWND rather than a WND, and does all the implementation details within. In one call site I just moved the call outside the lock, but for the other I had to release/re-acquire the lock, I hope it's not too big of a deal. It's still less code than special casing the work rect it in both callers.
Dropping and reacquiring the lock isn't very pretty (and needs care to keep the window state consistent).
Huw.
Yeah, but I figured it's not a problem since calling GetWindowStyle or IsIconic does the same thing (acquires lock, gets style, releases lock), but anyway I sent a v7 with this method.
I used a helper function to get the maximized work rect only for maximized windows (because that's what we care about, and we only use it in such case) which implicitly handles the IsIconic issue, and simplifies the callers since it is one line only at initialization.