Skip to content
  • Martin Flöser's avatar
    Improved resolving whether a window is on local machine · cbb7f575
    Martin Flöser authored
    Most windows use the hostname in WM_CLIENT_MACHINE, but there are windows
    using the FQDN (for example libreoffice). So instead of "foo" it is
    "foo.local.net" or similar. The logic so far has been unable to properly
    determine whether windows with FQDN are on the local system.
    
    In order to solve this problem the handling is split out into an own
    class which stores the information of hostname and whether it is a local
    machine. This is to not query multiple times. To determine whether the
    Client is on the local system getaddrinfo is used for the own hostname
    and the FQDN provided in WM_CLIENT_MACHINE. If one of the queried
    names matches, we know that it is on the local machine. The old logic to
    compare the hostname is still used and getaddrinfo is only a fallback in
    case hostname does not match.
    
    The problem with getaddrinfo is, that it accesses the network and by that
    could block. To circumvent this problem the calls are moved into threads
    by using QtCo...
    cbb7f575