All pastes #821015 Raw Edit

Something

public text v1 · immutable
·published 2007-12-17 21:38 UTC
rendered paste body
wait_for_event (struct wrapper *bc)
{
  struct timeval timeout;
  fd_set fds;
  bool handled_p = false;
  int fd;

  fd = XConnectionNumber (bc->dpy);

  do
    {
      while (!XPending (bc->dpy))
        {
          FD_ZERO (&fds);
          FD_SET (fd, &fds);
          struct timeval *timeout_ptr;

          timeout.tv_usec = 0;
          timeout.tv_sec = 1;

          timeout_ptr = &timeout;

          if ((select (fd + 1, &fds, NULL, NULL, timeout_ptr)) <= 0)
            printf ("signal\n");
        }

      XNextEvent (bc->dpy, &bc->event);

      switch (bc->event.type)
        {
        case KeyPress:
          XBell (bc->dpy, 100);
          handled_p = true;
          break;