Esempio n. 1
0
Application_Local::Application_Local()
{
#if defined(FOG_OS_WINDOWS)
  StringW applicationCommand;

  applicationCommand.set(reinterpret_cast<const CharW*>(::GetCommandLineW()));
  Application_parseWinCmdLine(applicationCommand, applicationArguments);

  applicationArgumentsWasSet();
#endif // FOG_OS_WINDOWS
}
Esempio n. 2
0
err_t X11UIEngine::openXlib()
{
  // Try to load X11 library and all helper libraries. We need only X11 to be
  // present, all other libraries are optional and will be only used if found.
  // Load X11.

  StringW name;
  char* badSymbol;

  const size_t numXLibSymbols = sizeof(X11UIEngineXLibAPI) / sizeof(void*);
  const size_t numXExtSymbols = sizeof(X11UIEngineXExtAPI) / sizeof(void*);
  const size_t numXRenderSymbols = sizeof(X11UIEngineXRenderAPI) / sizeof(void*);  

  // Load X11.
  FOG_RETURN_ON_ERROR(name.set(Ascii8("X11")));
  if (_XLibLibrary.openLibrary(name) != ERR_OK)
  {
    Logger::error("Fog::X11UIEngine", "openXlib", "Failed to open X11 library.");
    return ERR_UI_X11_ENGINE_XLIB_NOT_AVAILABLE;
  }

  if (_XLibLibrary.getSymbols(reinterpret_cast<void**>(&_XLib),
    X11UIEngine_XLibSymbolNames, FOG_ARRAY_SIZE(X11UIEngine_XLibSymbolNames),
    numXLibSymbols, &badSymbol) != numXLibSymbols)
  {
    Logger::error("Fog::X11UIEngine", "openXlib", "Failed to load X11 symbol %s.", badSymbol);
    return ERR_UI_X11_ENGINE_XLIB_NOT_AVAILABLE;
  }

  // Load Xext.
  name.set(Ascii8("Xext"));
  if (_XExtLibrary.openLibrary(name) != ERR_OK)
  {
    Logger::debug("Fog::X11UIEngine", "openXlib", "Failed to open Xext library.");
  }
  else if (_XExtLibrary.getSymbols(reinterpret_cast<void**>(&_XExt),
    X11UIEngine_XExtSymbolNames, FOG_ARRAY_SIZE(X11UIEngine_XExtSymbolNames),
    numXExtSymbols, &badSymbol) != numXExtSymbols)
  {
    Logger::debug("Fog::X11UIEngine", "openXlib", "Failed to load Xext symbol %s.", badSymbol);
    _XExtLibrary.close();
  }

  // Load Xrender.
  name.set(Ascii8("Xrender"));
  if (_XRenderLibrary.openLibrary(name) != ERR_OK)
  {
    Logger::debug("Fog::X11UIEngine", "openXlib", "Failed to open Xrender library.");
  }
  else if (_XRenderLibrary.getSymbols(reinterpret_cast<void**>(&_XRender),
    X11UIEngine_XRenderSymbolNames, FOG_ARRAY_SIZE(X11UIEngine_XRenderSymbolNames),
    numXRenderSymbols, &badSymbol) != numXRenderSymbols)
  {
    Logger::debug("Fog::X11UIEngine", "openXlib", "Failed to load Xrender symbol %s.", badSymbol);
    _XRenderLibrary.close();
  }

  // Setup locale.
  if (!_XLib._XSupportsLocale())
  {
    Logger::debug("Fog::X11UIEngine", "openXlib", "X does not support locale.");
  }
  else
  {
    char* localeModifiers = _XLib._XSetLocaleModifiers("");
    if (localeModifiers == NULL)
    {
      Logger::debug("Fog::X11UIEngine", "openXlib", "Can't set X locale modifiers.");
    }
  }
  
  // Setup error handlers.
  _XLib._XSetIOErrorHandler(X11UIEngine_IOErrorHandler);
  _XLib._XSetErrorHandler(X11UIEngine_ErrorHandler);

  return ERR_OK;
}