xwayland: Make window_get_client_toplevel non-recursive

Noticed while reading the code.

Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
This commit is contained in:
Michel Dänzer 2020-11-06 10:14:19 +01:00 committed by Michel Dänzer
parent 899cebb76a
commit df3aa4922f

View File

@ -257,11 +257,11 @@ window_get_client_toplevel(WindowPtr window)
* decoration/wrapper windows. In that case recurse by checking the client * decoration/wrapper windows. In that case recurse by checking the client
* of the first *and only* child of the decoration/wrapper window. * of the first *and only* child of the decoration/wrapper window.
*/ */
if (window_is_wm_window(window)) { while (window_is_wm_window(window)) {
if (window->firstChild && window->firstChild == window->lastChild) if (!window->firstChild || window->firstChild != window->lastChild)
return window_get_client_toplevel(window->firstChild);
else
return NULL; /* Should never happen, skip resolution emulation */ return NULL; /* Should never happen, skip resolution emulation */
window = window->firstChild;
} }
return window; return window;