def compute_client_position(self, client, screen_rect):
        """recompute client.x and client.y, returning whether or not to place
        this client above other windows or not"""
        above = True

        if client.has_user_set_position() and not self.on_screen(client, screen_rect):
            # move to screen
            client.x = screen_rect.x + client.x
            client.y = screen_rect.y + client.y
        if not client.has_user_set_position() or not self.on_screen(client, screen_rect):
            # client has not been properly placed before or it is off screen
            transient_for = client.is_transient_for()
            if transient_for is not None:
                # if transient for a window, place in the center of the window
                center_x = transient_for.x + transient_for.width / 2
                center_y = transient_for.y + transient_for.height / 2
                above = False
            else:
                center_x = screen_rect.x + screen_rect.width / 2
                center_y = screen_rect.y + screen_rect.height / 2

            x = center_x - client.width / 2
            y = center_y - client.height / 2

            # don't go off the right...
            x = min(x, screen_rect.x + screen_rect.width - client.width)
            # or left...
            x = max(x, screen_rect.x)
            # or bottom...
            y = min(y, screen_rect.y + screen_rect.height - client.height)
            # or top
            y = max(y, screen_rect.y)

            client.x = int(round(x))
            client.y = int(round(y))
        return above
recompute client.x and client.y, returning whether or not to place
        this client above other windows or not
libqtile/layout/floating.py