XRender With Vsync

Ryan McClue re.mcclue at protonmail.com
Fri Sep 24 08:43:29 UTC 2021


I have solved the problem. It seems that XCheckTypedWindowEvent() does not return a GenericEvent.
I found https://github.com/gnif/LookingGlass and https://github.com/xfce-mirror/xfwm4 as some examples to go by.

--
Ryan McClue, Sydney

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Thursday, September 23rd, 2021 at 11:35 AM, Ryan McClue <re.mcclue at protonmail.com> wrote:

> I'm trying to use XPresent, however I seem unable to receive GenericEvent. I initialize:
>
> int present_op = 0, event = 0, error = 0;
>
> XPresentQueryExtension(xlib_display, &present_op, &event, &error);
>
> XPresentSelectInput(xlib_display, xlib_window, PresentCompleteNotifyMask);
>
> In my event loop:
>
> XEvent xlib_event = {};
>
> while (XPending(xlib_display) > 0)
>
> {
>
> XNextEvent(xlib_display, &xlib_event);
>
> switch (xlib_event.type)
>
> {
>
> case GenericEvent:
>
> {
>
> XGenericEventCookie *cookie = (XGenericEventCookie *)&xlib_event.xcookie;
>
> if (cookie->extension == present_op)
>
>         {
>           XGetEventData(xlib_display, cookie);
>           if (cookie->evtype == PresentCompleteNotify)
>
>           {
>             XRenderComposite(display, PictOpSrc, src_pict, 0, dst_pict,
>                              0, 0, 0, 0, 0, 0,
>                              window_width, window_height);
>           }
>           XFreeEventData(xlib_display, cookie);
>       } break;
>     }
>
>
> }
>
> I never receive any GenericEvent.
>
> Am I doing something wrong?
> -----------------------------------------------------------------
>
> Ryan McClue, Sydney
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> On Thursday, September 23rd, 2021 at 3:33 AM, Keith Packard keithp at keithp.com wrote:
>
> > Ryan McClue re.mcclue at protonmail.com writes:
> >
> > > I want this to sync with the monitor's VBLANK, i.e. vsync.
> > >
> > > How can this be achieved?
> >
> > Draw to an offscreen pixmap and use the Present extension.
> >
> > -keith


More information about the xorg mailing list