Example #1
0
/* These three functions are wrappers around the equivalent renderer
   functions. They can be removed once all xlib-based backends in
   Clutter know about the renderer */
CoglFilterReturn
cogl_xlib_handle_event (XEvent *xevent)
{
  _COGL_GET_CONTEXT (ctx, COGL_FILTER_CONTINUE);

  /* Pass the event on to the renderer */
  return cogl_xlib_renderer_handle_event (ctx->display->renderer, xevent);
}
Example #2
0
static void
dispatch_xlib_events (void *user_data, int revents)
{
  CoglRenderer *renderer = user_data;
  CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer);

  if (renderer->xlib_enable_event_retrieval)
    while (XPending (xlib_renderer->xdpy))
      {
        XEvent xevent;

        XNextEvent (xlib_renderer->xdpy, &xevent);

        cogl_xlib_renderer_handle_event (renderer, &xevent);
      }
}
Example #3
0
void
_cogl_xlib_renderer_poll_dispatch (CoglRenderer *renderer,
                                   const CoglPollFD *poll_fds,
                                   int n_poll_fds)
{
  CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer);

  if (renderer->xlib_enable_event_retrieval)
    while (XPending (xlib_renderer->xdpy))
      {
        XEvent xevent;

        XNextEvent (xlib_renderer->xdpy, &xevent);

        cogl_xlib_renderer_handle_event (renderer, &xevent);
      }
}
Example #4
0
static void x11_resize(GdkWindow *window,
                       CoglOnscreen* onscreen,
                       int width, int height,
                       int x, int y)
{
    int scale = gdk_window_get_scale_factor(window);
    XConfigureEvent xevent;
    memset(&xevent, 0, sizeof(xevent));
    xevent.type = ConfigureNotify;
    xevent.window = GDK_WINDOW_XID (window);
    xevent.width = width * scale;
    xevent.height = height * scale;

    /* Ensure cogl knows about the new size immediately, as we will
     * draw before we get the ConfigureNotify response. */
    cogl_xlib_renderer_handle_event(cogl_context_get_renderer(g_Context),
                                    (XEvent *)&xevent);
}
Example #5
0
static GdkFilterReturn
cogl_gdk_filter (GdkXEvent  *xevent,
                 GdkEvent   *event,
                 gpointer    data)
{
  CoglRenderer *renderer = cogl_context_get_renderer(g_Context);
  CoglFilterReturn ret;

  ret = cogl_xlib_renderer_handle_event (renderer, (XEvent *) xevent);
  switch (ret)
    {
    case COGL_FILTER_REMOVE:
      return GDK_FILTER_REMOVE;

    case COGL_FILTER_CONTINUE:
    default:
      return GDK_FILTER_CONTINUE;
    }

  return GDK_FILTER_CONTINUE;
}
Example #6
0
static ClutterX11FilterReturn
cogl_xlib_filter (XEvent       *xevent,
                  ClutterEvent *event,
                  gpointer      data)
{
  ClutterBackend *backend = data;
  ClutterX11FilterReturn retval;
  CoglFilterReturn ret;

  ret = cogl_xlib_renderer_handle_event (backend->cogl_renderer, xevent);
  switch (ret)
    {
    case COGL_FILTER_REMOVE:
      retval = CLUTTER_X11_FILTER_REMOVE;
      break;

    case COGL_FILTER_CONTINUE:
    default:
      retval = CLUTTER_X11_FILTER_CONTINUE;
      break;
    }

  return retval;
}