コード例 #1
0
void init()
{
    int major, minor;

    // initialize presage
    if (suggestions.empty()) {
        suggestions = presage.config("Presage.Selector.SUGGESTIONS");
    } 
    else {
        presage.config("Presage.Selector.SUGGESTIONS", suggestions);
    }
    no_suggestions = atoi(suggestions.c_str());
    
    // initialize XEvIE
    dpy = XOpenDisplay(NULL);
    if(XevieStart(dpy))
     	printf("XevieStart(dpy) initialized\n");
    else {
     	printf("XevieStart(dpy) initialization failed\n Check that XEvIE X extension is enabled and that only one client is trying to do event interception\n");
     	exit(1);
    }

    XevieQueryVersion(dpy, &major, &minor);
    printf("XEvIE major = %d, minor = %d\n", major, minor);

    XevieSelectInput(dpy, KeyPressMask | KeyReleaseMask );
}
コード例 #2
0
static void
spi_dec_x11_init (SpiDEController *controller)
{
  DEControllerPrivateData *priv = controller->priv;	
  spi_events_init (spi_get_display());
#ifdef HAVE_XEVIE
  GIOChannel *ioc;
  int fd;
#endif /* HAVE_XEVIE */

  spi_events_init (spi_get_display ());
#ifdef HAVE_XEVIE
  priv->xevie_display = XOpenDisplay(NULL);

  if (XevieStart(priv->xevie_display) == TRUE)
    {
#ifdef SPI_KEYEVENT_DEBUG
      fprintf (stderr, "XevieStart() success \n");
#endif
      XevieSelectInput(priv->xevie_display, KeyPressMask | KeyReleaseMask);

      fd = ConnectionNumber(priv->xevie_display);
      ioc = g_io_channel_unix_new (fd);
      g_io_add_watch (ioc, G_IO_IN | G_IO_HUP, handle_io, controller);
      g_io_channel_unref (ioc);
    }
  else
    {
#ifdef SPI_KEYEVENT_DEBUG
      fprintf (stderr, "XevieStart() failed, only one client is allowed to do event int exception\n");
#endif
    }
#endif /* HAVE_XEVIE */

  gettimeofday (&priv->last_press_time, NULL);
  gettimeofday (&priv->last_release_time, NULL);
  spi_controller_register_with_devices (controller);

  spi_dec_init_mouse_listener (controller);

  saved_controller = controller;
}