How does screen savers work on Mac OS X and Linux?

拟墨画扇 提交于 2019-12-21 06:21:37

问题


In Windows a screen saver is just an executable with a .scr extension dumped in the system32, and it is controlled with three switches (/p, /c and /s, I think).

How does screen savers work on Mac OS X and Linux? Do they work similarly in Mac OS X and Linux (Gnome, KDE, Ubuntu, or wherever the difference is) or is it completely different?

Also, can they be developed in C#/Mono?


回答1:


The screensaver system in OSX is that a screensaver (typically, but not necessarily) is an Objective-C library, extending a base class to implement methods such as drawing, a preference pane, a preview mode and so on.

There is a good tutorial on writing them here.

While Objective-C is the language expected, it is straightforward enough to couple together a C/C++ implementation behind the Objective-C API.

There is an API (a bridge) to allow other languages to inter-operate with Objective-C APIs. This is used, for example, here to allow OSX screen savers written in Python. I imagine a similar approach is feasible for Mono.

xscreensaver is now developed mostly on OSX, and uses the OSX screensaver API there and something else on X11.




回答2:


For X11, I'm pretty sure you can target xscreensaver and have it work in GNOME. Not sure about KDE. But xscreensaver has long been the dominant package on Linux.

IIRC, the programming model for xscreensaver is that you write it as any old app that draws an X window. Then it can be invoked with "-root" and it should draw on the root window. But that's probably not all there is to it.

The xscreensaver FAQ seems to suggest that GNOME and KDE each have their own screensaver frameworks. But the Wikipedia article for gnome-screensaver says it's a wrapper for xscreensaver.



来源:https://stackoverflow.com/questions/1587720/how-does-screen-savers-work-on-mac-os-x-and-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!