Ticket #52257: patch-enable-x11-autolaunch.diff

File patch-enable-x11-autolaunch.diff, 3.7 KB (added by RJVB (René Bertin), 8 years ago)
  • dbus/dbus-server-unix.c

    diff --git dbus/dbus-server-unix.c dbus/dbus-server-unix.c
    index 92664a8..5d1563c 100644
    _dbus_server_listen_platform_specific (DBusAddressEntry *entry, 
    262262      const char *launchd_env_var = dbus_address_entry_get_value (entry, "env");
    263263      if (launchd_env_var == NULL)
    264264        {
     265#if !(defined(DBUS_BUILD_X11) && defined(DBUS_ENABLE_X11_AUTOLAUNCH))
    265266          _dbus_set_bad_address (error, "launchd", "env", NULL);
    266267          return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
     268#else
     269          goto fallback;
     270#endif
    267271        }
    268272      *server_p = _dbus_server_new_for_launchd (launchd_env_var, error);
    269273
    _dbus_server_listen_platform_specific (DBusAddressEntry *entry, 
    272276          _DBUS_ASSERT_ERROR_IS_CLEAR(error);
    273277          return DBUS_SERVER_LISTEN_OK;
    274278        }
     279#if !(defined(DBUS_BUILD_X11) && defined(DBUS_ENABLE_X11_AUTOLAUNCH))
    275280      else
    276281        {
    277282          _DBUS_ASSERT_ERROR_IS_SET(error);
    278283          return DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
    279284        }
     285#else
     286fallback:;
     287      // try a hardcoded traditional address
     288      {
     289        DBusAddressEntry **altEntry;
     290        int altLen;
     291        DBusError altError;
     292        DBusServerListenResult retval;
     293        if (dbus_parse_address ("unix:tmpdir=/tmp", &altEntry, &altLen, &altError) && altLen > 0)
     294          {
     295            retval = _dbus_server_listen_platform_specific (altEntry[0], server_p, error);
     296            dbus_address_entries_free (altEntry);
     297          }
     298        else
     299          {
     300            retval = DBUS_SERVER_LISTEN_DID_NOT_CONNECT;
     301          }
     302        return retval;
     303      }
     304#endif
    280305    }
    281306#endif
    282307  else
  • dbus/dbus-sysdeps-unix.c

    diff --git dbus/dbus-sysdeps-unix.c dbus/dbus-sysdeps-unix.c
    index 5691c5a..f6a945c 100644
    _dbus_lookup_session_address (dbus_bool_t *supported, 
    41284128                              DBusString  *address,
    41294129                              DBusError   *error)
    41304130{
     4131  dbus_bool_t retval = FALSE;
    41314132#ifdef DBUS_ENABLE_LAUNCHD
    41324133  *supported = TRUE;
    4133   return _dbus_lookup_session_address_launchd (address, error);
    4134 #else
     4134  retval = _dbus_lookup_session_address_launchd (address, error);
     4135  if (retval)
     4136    {
     4137      // success, no need to attempt anything else
     4138      return TRUE;
     4139    }
     4140#endif
     4141// dbus can function with an X11 server like it does on other Unix versions, even when
     4142// it will use launchd by default (on Mac)
     4143#if !defined(DBUS_ENABLE_LAUNCHD) || (defined(DBUS_BUILD_X11) && defined(DBUS_ENABLE_X11_AUTOLAUNCH))
    41354144  *supported = FALSE;
    41364145
    41374146  if (!_dbus_lookup_user_bus (supported, address, error))
    41384147    return FALSE;
    4139   else if (*supported)
     4148#ifdef DBUS_ENABLE_LAUNCHD
     4149  _dbus_verbose ("traditional session bus lookup yielded address \"%s\"",
     4150              _dbus_string_get_const_data (address));
     4151#endif
     4152  if (*supported)
    41404153    return TRUE;
    41414154
    41424155  /* On non-Mac Unix platforms, if the session address isn't already
    _dbus_lookup_session_address (dbus_bool_t *supported, 
    41454158   * autolaunch: global default; see init_session_address in
    41464159   * dbus/dbus-bus.c. */
    41474160  return TRUE;
     4161#else
     4162  return retval;
    41484163#endif
    41494164}
    41504165
  • dbus/dbus-transport-unix.c

    diff --git dbus/dbus-transport-unix.c dbus/dbus-transport-unix.c
    index f2b1f09..ccbb284 100644
    _dbus_transport_open_platform_specific (DBusAddressEntry *entry, 
    392392          _DBUS_ASSERT_ERROR_IS_SET (error);
    393393          return DBUS_TRANSPORT_OPEN_DID_NOT_CONNECT;
    394394        }
     395#if !(defined(DBUS_BUILD_X11) && defined(DBUS_ENABLE_X11_AUTOLAUNCH))
    395396      else
    396397        {
    397398          _DBUS_ASSERT_ERROR_IS_CLEAR (error);
    398399          return DBUS_TRANSPORT_OPEN_OK;
    399400        }
     401#endif
    400402    }
    401403#endif
    402404  else