Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Xlib screen saver APIs

38 views
Skip to first unread message

Mut...@dastardlyhq.com

unread,
Jul 29, 2023, 5:23:30 AM7/29/23
to
Does anyone know how the 2 seperate Xlib APIs that deal with the screen saver
work together?

There's the core built in API with functions such as XSetScreenSaver() and
the API found in the X11/extensions/scrnsaver.h and I can't figure out if
they're seperate subsystems or they somehow interact.

Lew Pitcher

unread,
Jul 29, 2023, 11:09:03 AM7/29/23
to
From a quick reading of the XSetScreenSaver(3) and Xss(3) manual pages
it appears that
a) XSetScreenSaver() is part of the core X11 implementation, and that it
"saves the screen" by simply blanking it, or overlaying it with an
implementation-defined graphic, and
b) the Xss(3) functions are implemented as an optional X11 extension,
and provide facilities to hook a application-defined drawing code
into the basic X11 screensaver code that XSetScreenSaver() uses.

Thus, the Xss(3) functions are an optional layer that replaces the
single XSetScreenSaver() call


HTH
--
Lew Pitcher
"In Skills We Trust"

Mut...@dastardlyhq.com

unread,
Jul 29, 2023, 11:30:45 AM7/29/23
to
But I'm not sure it does. I've been reading this:

https://www.x.org/releases/X11R7.7/doc/scrnsaverproto/saver.html

And you get sentences such as this for XScreenSaverSetAttributes():

"this routine sets the attributes to be used the next time the external screen
saver is activated."

What external screen saver? The X built in or something else? Also Drawable is
a parameter to a number of functions but it doesn't say if you have to create
it yourself or its provided by the X server? For example some sentences are
is confusing me such as this one:

"If the server chooses the latter approach, a window with a special identifier
is created and mapped at the top of the stacking order where it remains until
the screen saver deactivates"

Great, but where does the window come from? Does the server create it or do
I - is it passed to me as a Drawable argument but if so why is it an
attribute in XScreenSaverSetAttributes() ?

As usual with Xlib, things are rather vague. I suppose it'll be a case of
suck it and see.

Lew Pitcher

unread,
Jul 29, 2023, 12:42:19 PM7/29/23
to
Hi, Muttley

On Sat, 29 Jul 2023 15:30:41 +0000, Muttley wrote:

> On Sat, 29 Jul 2023 15:08:57 -0000 (UTC)
> Lew Pitcher <lew.p...@digitalfreehold.ca> wrote:
>>On Sat, 29 Jul 2023 09:23:25 +0000, Muttley wrote:
>>
>>> Does anyone know how the 2 seperate Xlib APIs that deal with the screen saver
>>
>>> work together?
>>>
>>> There's the core built in API with functions such as XSetScreenSaver() and
>>> the API found in the X11/extensions/scrnsaver.h and I can't figure out if
>>> they're seperate subsystems or they somehow interact.
>>
>>From a quick reading of the XSetScreenSaver(3) and Xss(3) manual pages
>>it appears that
>>a) XSetScreenSaver() is part of the core X11 implementation, and that it
>> "saves the screen" by simply blanking it, or overlaying it with an
>> implementation-defined graphic, and
>>b) the Xss(3) functions are implemented as an optional X11 extension,
>> and provide facilities to hook a application-defined drawing code
>> into the basic X11 screensaver code that XSetScreenSaver() uses.
>>
>>Thus, the Xss(3) functions are an optional layer that replaces the
>>single XSetScreenSaver() call
>
> But I'm not sure it does. I've been reading this:
>
> https://www.x.org/releases/X11R7.7/doc/scrnsaverproto/saver.html

OK, so I'm a beginner at X11/Xlib progamming myself, so I don't
have all (or even most) of the answers. What I can tell you is
that you use the Xss(3) extensions in an X11 client program that
runs in the background and intercepts and processes screensaver
events. It runs as a stand-alone process, and is not integrated
into the X11 server.

So, the screensaver client will have to draw on something called
a "Drawable" (which can be a "Window" or a "Pixmap") which it
tells the Xss(3) extension should be used as the screensaver
image. It's up the the client to establish this Drawable, and
to actually draw the image. This you can do with the usual
XLib calls. The client does this drawing (or stops drawing)
when it receives a ScreenSaverNotify event in it's event loop.

I can think of more to say, but I'd just be guessing. As this
is your project, I'll defer to your lead.

Mut...@dastardlyhq.com

unread,
Jul 31, 2023, 5:08:47 AM7/31/23
to
On Sat, 29 Jul 2023 16:42:14 -0000 (UTC)
Lew Pitcher <lew.p...@digitalfreehold.ca> wrote:
>Hi, Muttley
>> But I'm not sure it does. I've been reading this:
>>
>> https://www.x.org/releases/X11R7.7/doc/scrnsaverproto/saver.html
>
>OK, so I'm a beginner at X11/Xlib progamming myself, so I don't
>have all (or even most) of the answers. What I can tell you is
>that you use the Xss(3) extensions in an X11 client program that
>runs in the background and intercepts and processes screensaver
>events. It runs as a stand-alone process, and is not integrated
>into the X11 server.
>
>So, the screensaver client will have to draw on something called
>a "Drawable" (which can be a "Window" or a "Pixmap") which it
>tells the Xss(3) extension should be used as the screensaver
>image. It's up the the client to establish this Drawable, and
>to actually draw the image. This you can do with the usual
>XLib calls. The client does this drawing (or stops drawing)
>when it receives a ScreenSaverNotify event in it's event loop.

Thanks. I do wish a lot of Xlib documentation was less vague. Programming
is a precise activity, there's no reason for the documentation to not be
precise too.

Spiros Bousbouras

unread,
Aug 2, 2023, 7:04:25 AM8/2/23
to
On Mon, 31 Jul 2023 09:08:42 -0000 (UTC)
Mut...@dastardlyhq.com wrote:
> On Sat, 29 Jul 2023 16:42:14 -0000 (UTC)
> Lew Pitcher <lew.p...@digitalfreehold.ca> wrote:
> >Hi, Muttley
> >> But I'm not sure it does. I've been reading this:
> >>
> >> https://www.x.org/releases/X11R7.7/doc/scrnsaverproto/saver.html
[...]
> Thanks. I do wish a lot of Xlib documentation was less vague. Programming
> is a precise activity, there's no reason for the documentation to not be
> precise too.

I just wanted to add that there exists also comp.windows.x for such
questions. I don't know if there exist people who read that group and
not comp.unix.programmer .

Mut...@dastardlyhq.com

unread,
Aug 2, 2023, 11:50:49 AM8/2/23
to
Cheers. Looks more admin than dev but something to remember for next time.

Po Lu

unread,
Aug 17, 2023, 12:30:29 AM8/17/23
to
X screensaver protocols don't suffer from vague documentation. But
instead, they suffer from incoherent design and interoperability issues.

The core screen saver requests and the MIT screen saver extension are
both hopelessly misdesigned: they designate a server-managed window as
the screen saver window, and place the responsibility for activating the
screen saver in the hands of the server itself, precluding clients
displaying screen savers from either customizing the visual used by the
screen saver window or controlling the activation of the screen saver
themselves.

SGI servers provide a better screen saver extension which is absent from
the sample server and most other X servers, so the only portable option
is to map an override redirect window and manage screen saver policy
yourself, or to use xscreensaver.

Kaz Kylheku

unread,
Aug 17, 2023, 3:17:53 AM8/17/23
to
Devil's advocacy time.

The purpose of a screensaver is to save the screen against burn-in; i.e.
protect the hardware from damage.

That hardware is attachd to the machine which runs the X server, so
it makes sense for the X server to be responsible for that.

Why should the server trust remote clients to protect local hardware?

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazi...@mstdn.ca

Mut...@dastardlyhq.com

unread,
Aug 17, 2023, 6:34:43 AM8/17/23
to
On Thu, 17 Aug 2023 12:30:05 +0800
Po Lu <luan...@yahoo.com> wrote:
>X screensaver protocols don't suffer from vague documentation. But
>instead, they suffer from incoherent design and interoperability issues.
>
>The core screen saver requests and the MIT screen saver extension are
>both hopelessly misdesigned: they designate a server-managed window as
>the screen saver window, and place the responsibility for activating the
>screen saver in the hands of the server itself, precluding clients
>displaying screen savers from either customizing the visual used by the
>screen saver window or controlling the activation of the screen saver
>themselves.

It definately has an last minute afterthought feel about it.

"Did we forget something? Oh shit, screensaver! Quick, somebody hack something
up fast!"

Lew Pitcher

unread,
Aug 17, 2023, 8:44:02 AM8/17/23
to
But, given that a screensaver's primary responsibility is to prevent burnin,
X already has a built-in "screensaver": it simply blanks the screen after
a given length of time (see xset(1) dpms options).

The Xscreensaver framework seems to have been a response to the sort of
screensaver common to early MSWindows and Apple Mac operating systems,
solving an X11 "they got flying toasters, but we only got a blank screen"
sort of envy. It is notable that Jamie Zawinski released Xscreensaver
in 1991, about the same time as After Dark released their "flying toaster"
screensaver.

Kalevi Kolttonen

unread,
Aug 17, 2023, 10:34:10 AM8/17/23
to
In comp.unix.programmer Lew Pitcher <lew.p...@digitalfreehold.ca> wrote:
> On Thu, 17 Aug 2023 10:34:38 +0000, Muttley wrote:
>
>> On Thu, 17 Aug 2023 12:30:05 +0800
>> Po Lu <luan...@yahoo.com> wrote:
>>>X screensaver protocols don't suffer from vague documentation. But
>>>instead, they suffer from incoherent design and interoperability issues.
>>>
>>>The core screen saver requests and the MIT screen saver extension are
>>>both hopelessly misdesigned: they designate a server-managed window as
>>>the screen saver window, and place the responsibility for activating the
>>>screen saver in the hands of the server itself, precluding clients
>>>displaying screen savers from either customizing the visual used by the
>>>screen saver window or controlling the activation of the screen saver
>>>themselves.
>>
>> It definately has an last minute afterthought feel about it.
>>
>> "Did we forget something? Oh shit, screensaver! Quick, somebody hack something
>> up fast!"
>
> But, given that a screensaver's primary responsibility is to prevent burnin,
> X already has a built-in "screensaver": it simply blanks the screen after
> a given length of time (see xset(1) dpms options).

That is a very good point.

What is more, now in 2023 we have to care about our ecological
footprint. So the simple blank screen is a superior choice, because
it consumes less electricity than running flashy animations.

br,
KK

Scott Lurndal

unread,
Aug 17, 2023, 11:22:58 AM8/17/23
to
Kaz Kylheku <864-11...@kylheku.com> writes:
>On 2023-08-17, Po Lu <luan...@yahoo.com> wrote:
>> Mut...@dastardlyhq.com writes:
>>
>>> On Wed, 2 Aug 2023 11:04:19 -0000 (UTC)
>>> Spiros Bousbouras <spi...@gmail.com> wrote:
>>>>On Mon, 31 Jul 2023 09:08:42 -0000 (UTC)
>>>>Mut...@dastardlyhq.com wrote:
>>>>> On Sat, 29 Jul 2023 16:42:14 -0000 (UTC)
>>>>> Lew Pitcher <lew.p...@digitalfreehold.ca> wrote:
>>>>> >Hi, Muttley
>>>>> >> But I'm not sure it does. I've been reading this:
>>>>> >>
>>>>> >> https://www.x.org/releases/X11R7.7/doc/scrnsaverproto/saver.html
>>>>[...]
>>>>> Thanks. I do wish a lot of Xlib documentation was less vague. Programming
>>>>> is a precise activity, there's no reason for the documentation to not be
>>>>> precise too.
>>>>
>>>>I just wanted to add that there exists also comp.windows.x for such
>>>>questions. I don't know if there exist people who read that group and
>>>>not comp.unix.programmer .
>>>
>>> Cheers. Looks more admin than dev but something to remember for next time.
>>
>> X screensaver protocols don't suffer from vague documentation. But
>> instead, they suffer from incoherent design and interoperability issues.

Given DPMS, screensavers are obsolete power wasters anyway.

vallor

unread,
Aug 18, 2023, 9:33:54 PM8/18/23
to
On Thu, 17 Aug 2023 14:34:05 -0000 (UTC), kal...@kolttonen.fi (Kalevi
Kolttonen) wrote in <ublb4t$3q7jb$1...@dont-email.me>:
I don't know about you, but I don't use a screensaver to avoid burn-in.

I use a screensaver to *lock the screen* -- hopefully with art.

--
-v
(Currently using xscreensaver with the "starwars"
screensaver, fed by text from fortune(1).)

Kalevi Kolttonen

unread,
Aug 19, 2023, 4:40:21 AM8/19/23
to
In comp.unix.programmer vallor <val...@cultnix.org> wrote:
> I don't know about you, but I don't use a screensaver to avoid burn-in.
>
> I use a screensaver to *lock the screen* -- hopefully with art.

I have installed Fedora 38 xfce4 Spin because I hate Gnome.

It blanks the screen even when locking it. When I press
any key, the screen wakes up and I can login again. No
art of any kind is involved in this process.

br,
KK

Mut...@dastardlyhq.com

unread,
Aug 19, 2023, 4:44:05 AM8/19/23
to
On Sat, 19 Aug 2023 08:40:16 -0000 (UTC)
kal...@kolttonen.fi (Kalevi Kolttonen) wrote:
>In comp.unix.programmer vallor <val...@cultnix.org> wrote:
>> I don't know about you, but I don't use a screensaver to avoid burn-in.
>>
>> I use a screensaver to *lock the screen* -- hopefully with art.
>
>I have installed Fedora 38 xfce4 Spin because I hate Gnome.

No one seems to mention KDE these days. I find it far more user friendly than
chrome and with the kind of functionality you don't get with the simpler IDEs.

Mut...@dastardlyhq.com

unread,
Aug 19, 2023, 4:50:40 AM8/19/23
to
Typo: chrome = gnome

Alastair Hogge

unread,
Aug 19, 2023, 8:16:58 PM8/19/23
to
On Sat, 19 Aug 2023 08:44:01 +0000, Muttley wrote:

> On Sat, 19 Aug 2023 08:40:16 -0000 (UTC)
> kal...@kolttonen.fi (Kalevi Kolttonen) wrote:
>>In comp.unix.programmer vallor <val...@cultnix.org> wrote:
>>> I don't know about you, but I don't use a screensaver to avoid
>>> burn-in.
>>>
>>> I use a screensaver to *lock the screen* -- hopefully with art.
>>
>>I have installed Fedora 38 xfce4 Spin because I hate Gnome.
>
> No one seems to mention KDE these days.

It is unfortunate.

> I find it far more user friendly
> than chrome and with the kind of functionality you don't get with the
> simpler IDEs.

I agree.

It has been my DE for over 20 years, however, I switched to a tiling WM
many years ago, currently bspwm. I install bspwm with KDE for computer
illiterate people on FreeBSD, the major problem is the poor performance,
and integration of some GTK applications, most do integrate well. KDE is
still faster on 10+ year old x86 hardware.


--
To health and anarchy

Alastair Hogge

unread,
Aug 19, 2023, 8:17:33 PM8/19/23
to
On Sat, 19 Aug 2023 08:44:01 +0000, Muttley wrote:

> On Sat, 19 Aug 2023 08:40:16 -0000 (UTC)
> kal...@kolttonen.fi (Kalevi Kolttonen) wrote:
>>In comp.unix.programmer vallor <val...@cultnix.org> wrote:
>>> I don't know about you, but I don't use a screensaver to avoid
>>> burn-in.
>>>
>>> I use a screensaver to *lock the screen* -- hopefully with art.
>>
>>I have installed Fedora 38 xfce4 Spin because I hate Gnome.
>
> No one seems to mention KDE these days.

It is unfortunate.

> I find it far more user friendly
> than chrome and with the kind of functionality you don't get with the
> simpler IDEs.

Alastair Hogge

unread,
Aug 19, 2023, 8:18:19 PM8/19/23
to
On Sat, 19 Aug 2023 08:44:01 +0000, Muttley wrote:

> On Sat, 19 Aug 2023 08:40:16 -0000 (UTC)
> kal...@kolttonen.fi (Kalevi Kolttonen) wrote:
>>In comp.unix.programmer vallor <val...@cultnix.org> wrote:
>>> I don't know about you, but I don't use a screensaver to avoid
>>> burn-in.
>>>
>>> I use a screensaver to *lock the screen* -- hopefully with art.
>>
>>I have installed Fedora 38 xfce4 Spin because I hate Gnome.
>
> No one seems to mention KDE these days.

It is unfortunate.

> I find it far more user friendly
> than chrome and with the kind of functionality you don't get with the
> simpler IDEs.

Mut...@dastardlyhq.com

unread,
Aug 20, 2023, 3:09:28 AM8/20/23
to
On Sun, 20 Aug 2023 00:16:22 -0000 (UTC)
Alastair Hogge <a...@riseup.net> wrote:
>On Sat, 19 Aug 2023 08:44:01 +0000, Muttley wrote:
>
>> On Sat, 19 Aug 2023 08:40:16 -0000 (UTC)
>> kal...@kolttonen.fi (Kalevi Kolttonen) wrote:
>>>In comp.unix.programmer vallor <val...@cultnix.org> wrote:
>>>> I don't know about you, but I don't use a screensaver to avoid
>>>> burn-in.
>>>>
>>>> I use a screensaver to *lock the screen* -- hopefully with art.
>>>
>>>I have installed Fedora 38 xfce4 Spin because I hate Gnome.
>>
>> No one seems to mention KDE these days.
>
>It is unfortunate.
>
>> I find it far more user friendly
>> than chrome and with the kind of functionality you don't get with the
>> simpler IDEs.
>
>I agree.

Just noticed I wrote IDE instead of WM as well as chrome instead of gnome.
Note to self - don't post when half asleep!

>It has been my DE for over 20 years, however, I switched to a tiling WM
>many years ago, currently bspwm. I install bspwm with KDE for computer

Not heard of that one, will have to check it out.

>illiterate people on FreeBSD, the major problem is the poor performance,
>and integration of some GTK applications, most do integrate well. KDE is
>still faster on 10+ year old x86 hardware.

The one area I do rate gnome ahead of KDE is that it can be programmed in
C (gtk) as well as C++ (gtkmm) whereas KDE is C++ only (Qt).

Alastair Hogge

unread,
Aug 20, 2023, 5:37:09 AM8/20/23
to
I do not with program either. I came to FreeBSD and KDE/Qt from Windows
9x, I was having fun writing my own classes around the Win32 API, but was
over the many crashes—mostly unrelated. I read about Qt, already knew of
open-source Unix—wanting more stability in a DE, I switched. I played with
Qt, and really liked the signal/slot pattern, tho, I never produced
anything interesting, and found myself interested the kernel, and the
graphics stack at the time. I am not a fan of C or C++ much anymore, tho
prefer the typing and namespaces in C++....would love a Display Server in
a strongly typed language really. I believe the vtable magic in Qt is very
fast too now, but I am not a fan of multiple inheritance either.

Scott Lurndal

unread,
Aug 20, 2023, 1:26:56 PM8/20/23
to
Alastair Hogge <a...@riseup.net> writes:
>On Sat, 19 Aug 2023 08:44:01 +0000, Muttley wrote:
>
>> On Sat, 19 Aug 2023 08:40:16 -0000 (UTC)
>> kal...@kolttonen.fi (Kalevi Kolttonen) wrote:
>>>In comp.unix.programmer vallor <val...@cultnix.org> wrote:
>>>> I don't know about you, but I don't use a screensaver to avoid
>>>> burn-in.
>>>>
>>>> I use a screensaver to *lock the screen* -- hopefully with art.
>>>
>>>I have installed Fedora 38 xfce4 Spin because I hate Gnome.
>>
>> No one seems to mention KDE these days.
>
>It is unfortunate.

Is it? They're both heavyweight desktops.

I just use TWM, xterm, xpdf and other X11/GUI applications. No desktop.

xfce isn't altogether bad, certainly better than Gnome or KDE.

vallor

unread,
Aug 21, 2023, 10:06:32 PM8/21/23
to
On Sat, 19 Aug 2023 08:40:16 -0000 (UTC), kal...@kolttonen.fi (Kalevi
Kolttonen) wrote in <ubpv5g$nu1c$1...@dont-email.me>:
I use xfce also, which I switched to on the Ubuntu
install from System76.

But then I installed xscreensaver, which _can_ be set
to use DPMS...but in the past (maybe too long ago to matter), I would
have trouble with getting my video back.

I guess it's time to try again: I'm going to set it to use
DPMS to shutdown displays. Wish me luck.

--
-v

Scott Lurndal

unread,
Aug 22, 2023, 10:19:54 AM8/22/23
to
Have you tried

$ xset dpms force off

xset has other options to set inactivity period after which it automatically
enters DPMS.

vallor

unread,
Aug 22, 2023, 1:26:21 PM8/22/23
to
On Tue, 22 Aug 2023 14:19:48 GMT, sc...@slp53.sl.home (Scott Lurndal)
wrote in <8u3FM.455983$U3w1....@fx09.iad>:
Indeed, that's one way to do it. :)

But I used the settings in xscreensaver-demo (advanced tab) thusly:

https://imgur.com/jvrRDe1

--
-v

Po Lu

unread,
Aug 23, 2023, 10:32:29 PM8/23/23
to
Kaz Kylheku <864-11...@kylheku.com> writes:

> Devil's advocacy time.
>
> The purpose of a screensaver is to save the screen against burn-in; i.e.
> protect the hardware from damage.
>
> That hardware is attachd to the machine which runs the X server, so
> it makes sense for the X server to be responsible for that.
>
> Why should the server trust remote clients to protect local hardware?

If that were genuinely the impetus for the design of the core
screen-saver requests (and its outgrowth, the MIT screen saver
extension), then the X server wouldn't trust any other clients with any
graphics requests and whatnot...

Particularly given that any client can ``save'' a screen absent even the
permission to create or map windows, by drawing to the root window with
a GC whose subwindow mode is set to IncludeInferiors.

Po Lu

unread,
Aug 23, 2023, 10:35:23 PM8/23/23
to
sc...@slp53.sl.home (Scott Lurndal) writes:

> Given DPMS, screensavers are obsolete power wasters anyway.

Given the advent and proliferation of LCD displays, the principal
purpose of a screensaver is no longer to save a screen, but to decorate
them subsequent to a period of inactivity.
0 new messages