コード例 #1
0
ファイル: cogl-xlib-renderer.c プロジェクト: collects/cogl
gboolean
_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error)
{
  CoglXlibRenderer *xlib_renderer =
    _cogl_xlib_renderer_get_data (renderer);
  CoglX11Renderer *x11_renderer =
    (CoglX11Renderer *) xlib_renderer;
  int damage_error;

  if (!assert_xlib_display (renderer, error))
    return FALSE;

  if (getenv ("COGL_X11_SYNC"))
    XSynchronize (xlib_renderer->xdpy, TRUE);

  /* Check whether damage events are supported on this display */
  if (!XDamageQueryExtension (xlib_renderer->xdpy,
                              &x11_renderer->damage_base,
                              &damage_error))
    x11_renderer->damage_base = -1;

  xlib_renderer->trap_state = NULL;

  xlib_renderer->poll_fd.fd = ConnectionNumber (xlib_renderer->xdpy);
  xlib_renderer->poll_fd.events = COGL_POLL_FD_EVENT_IN;

  register_xlib_renderer (renderer);

  return TRUE;
}
コード例 #2
0
ファイル: cogl-xlib-renderer.c プロジェクト: GNOME/mutter
gboolean
_cogl_xlib_renderer_connect (CoglRenderer *renderer, CoglError **error)
{
  CoglXlibRenderer *xlib_renderer =
    _cogl_xlib_renderer_get_data (renderer);
  CoglX11Renderer *x11_renderer =
    (CoglX11Renderer *) xlib_renderer;
  int damage_error;
  int randr_error;

  if (!assert_xlib_display (renderer, error))
    return FALSE;

  if (getenv ("COGL_X11_SYNC"))
    XSynchronize (xlib_renderer->xdpy, TRUE);

  /* Check whether damage events are supported on this display */
  if (!XDamageQueryExtension (xlib_renderer->xdpy,
                              &x11_renderer->damage_base,
                              &damage_error))
    x11_renderer->damage_base = -1;

  /* Check whether randr is supported on this display */
  if (!XRRQueryExtension (xlib_renderer->xdpy,
                          &x11_renderer->randr_base,
                          &randr_error))
    x11_renderer->randr_base = -1;

  xlib_renderer->trap_state = NULL;

  if (renderer->xlib_enable_event_retrieval)
    {
      _cogl_poll_renderer_add_fd (renderer,
                                  ConnectionNumber (xlib_renderer->xdpy),
                                  COGL_POLL_FD_EVENT_IN,
                                  prepare_xlib_events_timeout,
                                  dispatch_xlib_events,
                                  renderer);
    }

  XRRSelectInput(xlib_renderer->xdpy,
                 DefaultRootWindow (xlib_renderer->xdpy),
                 RRScreenChangeNotifyMask
                 | RRCrtcChangeNotifyMask
                 | RROutputPropertyNotifyMask);
  update_outputs (renderer, FALSE);

  register_xlib_renderer (renderer);

  cogl_xlib_renderer_add_filter (renderer,
                                 randr_filter,
                                 renderer);

  return TRUE;
}
コード例 #3
0
ファイル: cg-xlib-renderer.c プロジェクト: rig-project/cglib
bool
_cg_xlib_renderer_connect(cg_renderer_t *renderer, cg_error_t **error)
{
    cg_xlib_renderer_t *xlib_renderer = _cg_xlib_renderer_get_data(renderer);
    cg_x11_renderer_t *x11_renderer = (cg_x11_renderer_t *)xlib_renderer;
    int damage_error;
    int randr_error;

    if (!assert_xlib_display(renderer, error))
        return false;

    if (getenv("CG_X11_SYNC"))
        XSynchronize(xlib_renderer->xdpy, true);

    /* Check whether damage events are supported on this display */
    if (!XDamageQueryExtension(
            xlib_renderer->xdpy, &x11_renderer->damage_base, &damage_error))
        x11_renderer->damage_base = -1;

    /* Check whether randr is supported on this display */
    if (!XRRQueryExtension(
            xlib_renderer->xdpy, &x11_renderer->randr_base, &randr_error))
        x11_renderer->randr_base = -1;

    xlib_renderer->trap_state = NULL;

    if (renderer->xlib_enable_event_retrieval) {
        _cg_loop_add_fd(renderer,
                                 ConnectionNumber(xlib_renderer->xdpy),
                                 CG_POLL_FD_EVENT_IN,
                                 prepare_xlib_events_timeout,
                                 dispatch_xlib_events,
                                 renderer);
    }

    XRRSelectInput(xlib_renderer->xdpy,
                   DefaultRootWindow(xlib_renderer->xdpy),
                   RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask |
                   RROutputPropertyNotifyMask);
    update_outputs(renderer, false);

    register_xlib_renderer(renderer);

    cg_xlib_renderer_add_filter(renderer, randr_filter, renderer);

    return true;
}