virtual void init()
  {
    if (mInotifyFd == -1)
    {
      mInotifyFd = inotify_init1(IN_CLOEXEC);
      if (mInotifyFd == -1)
      {
        rtLogWarn("hotplug disabled: %s", getSystemError(errno).c_str());
      }
      else
      {
        rtLogDebug("initializing inotify, adding watch: %s", kDevInput);
        mWatchFd = inotify_add_watch(mInotifyFd, kDevInput, (IN_DELETE | IN_CREATE));
        if (mWatchFd == -1)
        {
          rtLogWarn("hotplug disabled: %s", getSystemError(errno).c_str());
        }
        else
        {
          rtLogDebug("adding change notify descriptor: %d to poll list", mInotifyFd);
          pollfd p;
          p.fd = mInotifyFd;
          p.events = (POLLIN | POLLERR);
          p.revents = 0;
          mFds.push_back(p);
        }
      }
    }

    registerDevices(getKeyboardDevices());
    registerDevices(getMouseDevices());
  }
Beispiel #2
0
void pxText::createNewPromise()
{
  // Only create a new promise if the existing one has been
  // resolved or rejected already and font did not fail
  if(!mFontFailed && ((rtPromise*)mReady.getPtr())->status())
  {
    rtLogDebug("CREATING NEW PROMISE\n");
    mReady = new rtPromise();
  }
}
Beispiel #3
0
rtError pxText::setText(const char* s) 
{ 
  //rtLogInfo("pxText::setText\n");
  if( !mText.compare(s)){
    rtLogDebug("pxText.setText setting to same value %s and %s\n", mText.cString(), s);
    return RT_OK;
  }
  mText = s; 
  if( getFontResource() != NULL && getFontResource()->isFontLoaded())
  {
    getFontResource()->measureTextInternal(s, mPixelSize, 1.0, 1.0, mw, mh);
  }
  return RT_OK; 
}
static bool waitForDevice(const char* devname)
{
  rtLogDebug("waiting for %s to be created", devname);

  bool wait = false;
  for (int i = 0; i < 5; ++i)
  {
    if (wait)
      usleep(1000 * 200);

    struct stat buf;
    if (::stat(kDevInputByPath, &buf) == 0)
    {
      rtLogDebug("found: %s", devname);
      return true;
    }

    rtLogDebug("%s doesn't exist, waiting", devname);
    wait = true;
  }

  return false;
}
 static void safeClose(int fd)
 {
   rtLogDebug("close: %d", fd);
   if (fd != -1)
     ::close(fd);
 }