Example #1
0
static CoglFilterReturn
event_filter_cb (XEvent *xevent, void *data)
{
  CoglContext *context = data;

  if (xevent->type == ConfigureNotify)
    {
      notify_resize (context,
                     xevent->xconfigure.window,
                     xevent->xconfigure.width,
                     xevent->xconfigure.height);
    }
  else if (xevent->type == Expose)
    {
      CoglOnscreen *onscreen =
        find_onscreen_for_xid (context, xevent->xexpose.window);

      if (onscreen)
        {
          CoglOnscreenDirtyInfo info;

          info.x = xevent->xexpose.x;
          info.y = xevent->xexpose.y;
          info.width = xevent->xexpose.width;
          info.height = xevent->xexpose.height;

          _cogl_onscreen_queue_dirty (onscreen, &info);
        }
    }

  return COGL_FILTER_CONTINUE;
}
Example #2
0
static cg_filter_return_t
event_filter_cb(XEvent *xevent, void *data)
{
    cg_device_t *dev = data;

    if (xevent->type == ConfigureNotify) {
        notify_resize(dev,
                      xevent->xconfigure.window,
                      xevent->xconfigure.width,
                      xevent->xconfigure.height);
    } else if (xevent->type == Expose) {
        cg_onscreen_t *onscreen =
            find_onscreen_for_xid(dev, xevent->xexpose.window);

        if (onscreen) {
            cg_onscreen_dirty_info_t info;

            info.x = xevent->xexpose.x;
            info.y = xevent->xexpose.y;
            info.width = xevent->xexpose.width;
            info.height = xevent->xexpose.height;

            _cg_onscreen_queue_dirty(onscreen, &info);
        }
    }

    return CG_FILTER_CONTINUE;
}
Example #3
0
static void
notify_resize (CoglContext *context,
               Window drawable,
               int width,
               int height)
{
  CoglRenderer *renderer = context->display->renderer;
  CoglRendererEGL *egl_renderer = renderer->winsys;
  CoglOnscreen *onscreen = find_onscreen_for_xid (context, drawable);
  CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
  CoglOnscreenEGL *egl_onscreen;

  if (!onscreen)
    return;

  egl_onscreen = onscreen->winsys;

  _cogl_framebuffer_winsys_update_size (framebuffer, width, height);

  /* We only want to notify that a resize happened when the
   * application calls cogl_context_dispatch so instead of immediately
   * notifying we queue an idle callback */
  if (!egl_renderer->resize_notify_idle)
    {
      egl_renderer->resize_notify_idle =
        _cogl_poll_renderer_add_idle (renderer,
                                      flush_pending_resize_notifications_idle,
                                      context,
                                      NULL);
    }

  egl_onscreen->pending_resize_notify = TRUE;
}
Example #4
0
static void
notify_resize(cg_device_t *dev, Window drawable, int width, int height)
{
    cg_renderer_t *renderer = dev->display->renderer;
    cg_renderer_egl_t *egl_renderer = renderer->winsys;
    cg_onscreen_t *onscreen = find_onscreen_for_xid(dev, drawable);
    cg_framebuffer_t *framebuffer = CG_FRAMEBUFFER(onscreen);
    cg_onscreen_egl_t *egl_onscreen;

    if (!onscreen)
        return;

    egl_onscreen = onscreen->winsys;

    _cg_framebuffer_winsys_update_size(framebuffer, width, height);

    /* We only want to notify that a resize happened when the
     * application calls cg_device_dispatch so instead of immediately
     * notifying we queue an idle callback */
    if (!egl_renderer->resize_notify_idle) {
        egl_renderer->resize_notify_idle = _cg_loop_add_idle(
            renderer, flush_pending_resize_notifications_idle, dev, NULL);
    }

    egl_onscreen->pending_resize_notify = true;
}