View Full Version : Screensaver Plugin
Storm
February 9th, 2007, 11:28 PM
Hey, I wrote a screensaver plugin.
At first it was only for beryl, now I decide
that I port it to compiz.
The plugin should work now for compiz,
but I have some problems to create a
.schema file. I tried gconf-dump but all I get is:
COMPIZ_SCHEMA_PLUGINS="screensaver" COMPIZ_SCHEMA_FILE="screensaver.schema" compiz-aiglx --use-cow --indirect-rendering --strict-binding gconf move resize minimize place decoration wobbly fade screensaver cube rotate scale switcher zoom screenshot water dbus
compiz: Couldn't load plugin '--use-cow'
compiz: Couldn't load plugin '--strict-binding'
compiz: Failed to load slide: freedesktop
compiz: Failed to load slide: freedesktop.png
/usr/bin/compiz-aiglx: line 5: 1673 Speicherzugriffsfehler LIBGL_ALWAYS_INDIRECT=1 compiz --replace --use-cow --indirect-rendering --strict-binding gconf move resize minimize place decoration wobbly fade cube rotate scale switcher zoom screenshot water dbus
I should add that my compiz doesn't run stable.
Maybe there is the fault.
However, maybe somebody can test the plugin,
and create the .schema file.
I haven't really test my plugin for compiz (because it's very difficult
to test it without .schema file), but it compile and should work
(as good as in beryl, I think).
For more informations, you can look at the beryl-forum-thread
http://forum.beryl-project.org/viewtopic.php?f=38&t=266
At this time, you need a Xextension named libxss (in ubuntu
and suse I think) or libXScrnSaver (in gentoo), to compile
and run the plugin. (This library provides the screensaver functionality).
At least, here's the download link:
http://hosting.xapek.org/~storm/screensaver-plugin-compiz.tar.gz
If the link doesn't work (my own server, sometimes down), you can
use the attachment from the beryl-forum.
To switch between the compiz and beryl version of the plugin, you only
had to change the variable WM in the makeconf.
Thanks for your attention and your help...
Amaranth
February 10th, 2007, 03:39 AM
COMPIZ_SCHEMA_PLUGINS="screensaver" COMPIZ_SCHEMA_FILE="screensaver.schema" compiz screensaver gconf-dump
Storm
February 10th, 2007, 11:28 AM
Hm, I tried this (and other combinations)
I get:
compiz: 'screensaver' plugin must be loaded after 'cube' plugin
compiz: Can't activate 'screensaver' plugin due to dependency problems
No such plugin screensaver
--replace: Failed to load slide: freedesktop
--replace: Failed to load slide: freedesktop.png
Ok the first two messages are because my plugin has dependencies
to cube and rotate (it spins the cube randomly)
The third message is strange, because he know about the dependencies
but cannot find the plugin (it's installed in ~/.compiz/plugins/libscreensaver.so).
It's frustrating, my compiz is totally unstable if I compile it
from the source-code. The package from my distro work
(gentoo-portage). But I need gconf-dump. Arrgh...
I will try it tomorrow again, I'm too frustrated to try it again, yet.
Then I reinstall compiz and hope that there will be less problems.
mikedee
February 10th, 2007, 01:03 PM
Ok the first two messages are because my plugin has dependencies to cube and rotate (it spins the cube randomly)
I don't think there is any need to have a dependency on cube just because your plugin initiates some actions in rotate. Have a look at mousegestures plugin. It just checks that the plugin is loaded and there is an initiate action before calling it.
This version crashes on load, Ill try to have a look to see whats going wrong. Once I can get it running I can get a gconf-dump for you. You have to compile compiz yourself if you want gconf-dump.
Storm
February 10th, 2007, 10:24 PM
Ok, I reinstalled compiz using the package from gentoo.
Then I installed gconf-dump manually in .compit/plugins/
Then it worked, I got a screensaver.schema file. But know
I've got a new problem.
With my plugin activated I got a
Segfault:
storm@localhost ~ $ compiz-start
NVIDA detected
Using KDE decorator
compiz: Failed to load slide: freedesktop
compiz: Failed to load slide: freedesktop.png
QFont::setPointSize: Point size <= 0 (-3)
/usr/bin/compiz-start: line 41: 2472 Speicherzugriffsfehler compiz $COMPIZ_OPTIONS gconf move resize minimize place decoration wobbly fade cube rotate scale switcher zoom dbus
storm@localhost ~ $ compiz --replace cube rotate screensaver
compiz: Failed to load slide: freedesktop
Speicherzugriffsfehler
storm@localhost ~ $ compiz --replace cube rotate
compiz: Failed to load slide: freedesktop
...
//Compiz works
("Speicherzugriffsfehler" is german for segmentation fault)
And if I want to configure my plugin in compiz-settings, I get:
storm@localhost ~ $ compiz-settings
process 4437: arguments to dbus_message_new_method_call() were incorrect, assertion "_dbus_check_is_valid_path (path)" failed in file dbus-message.c line 1074.
This is normally a bug in some application using the D-Bus library.
D-Bus not built with -rdynamic so unable to print a backtrace
Abgebrochen
With gconf-editor I can configure my plugin.
Maybe there is something wrong with the .schema file.
The file is very large, so I doesn't post it. Instead here's a link
schema-file (http://hosting.xapek.org/~storm/screensaver.schema)
The first two and the last two rows of the file I added manually,
because without gconftool2 doesn't accept the .schema file
Sorry that I'm so obstinate and maybe I get you on your nerves.
But it's frustrating, I working hard to get my plugin stable and
now I began to feel like a total amateur, because I cannot deal
with some simple problems like create a correct .schema file.
mikedee
February 11th, 2007, 12:27 AM
The first two and the last two rows of the file I added manually, because without gconftool2 doesn't accept the .schema file
This is normal if you are making a standalone plugin
Sorry that I'm so obstinate and maybe I get you on your nerves.
But it's frustrating, I working hard to get my plugin stable and
now I began to feel like a total amateur, because I cannot deal
with some simple problems like create a correct .schema file.
No problem :) Id have a look myself but I am not at a development machine at the moment.
As a quick suggestion off the top of my head, you should try renaming all of the option names so that they use only lowercase and _ - it might help, but I am not sure.
Are you able to get the plugin running under compiz (ie without any schema loaded? )
mikedee
February 11th, 2007, 01:21 AM
OK - I managed to get a backtrace (well a cause of crash anyway :))
When you call getDisplayOptions you are passing a null CompDisplay (and screen later). Beryl accepts this (thats why all your Get*Option functions check for a valid CompDisplay), but compiz does not.
I have had a very brief look at the code and I think that your problems with getting the correct screen can be solved if you listen for ScreenSaverNotify events. These events will give you which screen the event happened on. I think as long as you instruct XSS to send the events then you should be able to receive them through handleEvent.
If you are just responding to a timeout then I think you will have to devise a way to keep a track of which screen the user is on (listening for EnterNotify/KeyDown should do that). It would be complicated since you would have to monitor timeouts for each screen.
maniac
February 11th, 2007, 08:31 AM
If you are just responding to a timeout then I think you will have to devise a way to keep a track of which screen the user is on (listening for EnterNotify/KeyDown should do that). It would be complicated since you would have to monitor timeouts for each screen.
Actually, there is a more elegant solution to that ;)
Have a look here (http://bugs.beryl-project.org/browser/trunk/beryl-plugins-unsupported/src/group/tab.c).
groupGetCurrentMousePosition takes a CompScreen and returns TRUE if the pointer (quite a good indicator for user activity ;) ) is on this screen and false if not.
This can be easily called from a timeout by looping through d->screens (lines 846-849).
Storm
February 11th, 2007, 11:42 AM
Ok, yesterday weren't my day.
I tried it again today, and it works.
I have now a correct screensaver-schema file.
I can configure the plugin with compiz-settings
(Thanks to mikedee, for the advice with the lowercases).
Also, there is no segfault anymore, when I load the plugin
(Avoid null-pointers made the trick, thanks again to mikedee :) )
All in all there are more differences between compiz and beryl, as I thougt.
But for me the plugin works now. I hope some of you test my plugin, and report if there are problems.
I upload a new version of the plugin. The screensaver.schema file
is in the folder data.
Thanks, also for your advices "how to get the CompScreen". I will see what I can implement.
mikedee
February 11th, 2007, 05:51 PM
I have tested the last version and it is working now.
The only problem I can see is that the screensaver does not return to the correct viewport.
I notice that there is a ss->startDesktop variable being set (correctly) but it is not being used when the screensaver is deactivated. You should be able to use this number along with the rotate_to_x options to return to the correct viewport. You will also need to save s->y incase you ever decide to support the plane plugin.
If you wait until the screensaver activates before loading the options then your plugin will not have to be loaded after the plugins that it manipulates.
iznogood
February 19th, 2007, 10:07 PM
Your plugin is great i use it and works very nice
Please check this out and tell me if we can implenent it
http://forum.go-compiz.org/viewtopic.php?t=162
Originally it was meant to be implemented using the state plugin and i have implemented the functionality there but if your plugin has almost all the functionality needed then maybe we can do it here??
The basic idea is to have the screensaver always running (inside xwinwrap preferably) in the background (like a slideshow) and when it is activated it sets opacity to 0,
then set screensaver window above, then set opacity 100.On deactivation we do the same but set window below.
I think that using this plugin it is better because we can have a common place to manage the screensaver inside compiz.
iznogood
February 19th, 2007, 10:08 PM
if you don't mind i can give i a try and send you a patch ??
mikedee
May 19th, 2007, 04:49 PM
I have just put a working copy of this into my git repo since its not available elsewhere and the one in the original post is outdated.
To checkout
git-clone git://people.freedesktop.org/~mike/screensaver
Git web
http://gitweb.freedesktop.org/?p=users/mike/screensaver.git;a=summary
vBulletin® v3.7.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.