[Xcb] xcb_set_screen_saver weird behavior

Philip Rushik prushik at gmail.com
Tue Mar 11 12:41:59 PDT 2014


Finally I figured something out. I rewrote the whole thing in Xlib and it
did exactly the same thing as my XCB code.

Then I played around with xtrace for too many hours, turns out xscreensaver
is NOT using the screensaver extension even though there is code for it in
the source. Gnome-screensaver does the same thing but has removed a lot of
the code that was in xscreensaver (although other parts are little more
than a copy and paste from xscreensaver).
Then lots of google searching and I finally found elock (enlightenment lock
program) examination of the source reveals that it ALSO does not use the
extension (I wonder if anything out there has ever used it), however, in
the source tree is a file called scrnsaver_test.c which doesn't use and
enlightenment libraries, so I built it and ran it through xtrace.

I was amazed to discover that it CRASHES whenever the screensaver should
come on! Hooray!
I started commenting out lines to see what was actually needed and none of
the stuff I had been trying to do in xcb seemed important. Then I saw this
line:
if (pe.type == event_base)

And I was like, "event_base?"

turns out that gets set here:

XScreenSaverQueryExtension (dpy, &event_base, &error_base)


(which, by the way, is a function never defined in any of the X
documentation that I could find). I have been looking for the
XCB_SCREENSAVER_NOTIFY or ScreenSaverNotify event, which seems to be
defined as 0. When I should have been looking instead for the event_base
returned by XScreenSaverQueryExtension (which I haven't yet figured out how
to do in XCB, but I think it will have to do with xcb_query_extension).

So, basically, I now have an Xlib program that can set the screensaver
timeout and gets an event when the screensaver should activate. Converting
it to XCB should be easy enough when I am more awake.

So anyway, the problem is almost resolved. Thanks everybody! Sorry for
cluttering your mailing list, but maybe somebody will have the same problem
and can find an answer now.

--Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20140312/5f9c49f6/attachment.html>


More information about the Xcb mailing list