FYI and a few questions...

2007-07-27 Thread Stefan Bidigaray
So I finally broke down and subscribed to gnustep-dev!  I recently
(Wednesday) started working on an implementation of Apple's ScreenSaver
framework so that I can get more acquainted with GNUstep programming.  I
figured this framework would be fairly easy to do, which it is, for most
part.  I decided to split it in 3 parts, which I think is what I'd have to
do anyway: the framework, a screen saver tool (which I called gssaver), and
a preference module to configure it.

So far I've managed to complete implementing the ScreenSaverView class and
the SS* functions, but have no idea how to work the ScreenSaverDefaults
class.  I most definitely will need some help implementing
ScreenSaverDefaults, but I'm not too worried about it now since the default
screen saver is a blank screen and doesn't need any configuration.

I still haven't done anything in the preference module front.  Since all of
the programming I've done has been at work and my everyday computer I
haven't had access to a GNUstep installation, and haven't been able to use
Gorm to create the interface.  I figured I would build the module by hand,
but gave up on that idea since I thought I could learn more using Gorm.  For
now, I've kind of put off creating the preference module till I'm done with
the tool.

The tool, gssaver, is turning out to be a little more complicated than I
initially thought.  What I figured I'd do with it is make it an
NSApplication but build it as a tool (not really sure if this would work).
So I've implemented a simple delegate class for now which: creates a black
window the size of the screen; loads the defaults; finds the screen saver;
adds a ScreenSaverView subview; orders it to front; and calls the
ScreenSaverView's -startAnimation method (in that order).

My questions:

1) I still haven't figured out how I'm going to count how many minutes it's
been since the last even, and much less how to even find out if events have
happened.  Does anyone have any ideas on how to do this?

2) I also have no idea how to figure if, once the screen saver is on, how to
stop if when something happens (mouse move, key stroke, mouse click).  I've
looked at the docs for NSView and there doesn't seem to be any methods that
would make this easy.  What can I do here?

3) Once the preference module is completed and working, I'll need to have
gssaver check the defaults after the preferences change, is there anyway I
can send it a message asking it to check the defaults fromt the preference
module?

4) Lastly, I'll need a lot of help creating ScreenSaverDefaults, but only
later.  I've check NSUserDefaults' code and I'm more confused now than I was
when I started out.  I figured for this, the best thing would be to create a
new file (ScreenSaverDefaults) under the Defaults directory.
NSUserDefaults, however, seems to be very picky about there being a process
running and writing to that process.

After it's all said and done I'd like to add this to GNUstep as I think it
would make more sense being distributed by it (much like SystemPreferences
and it's NSPreferencePane implementation).  I already have a copyright
assignment, so it shouldn't be a problem.

Any comments and/or suggestions would be appreciated.

Stefan
___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: FYI and a few questions...

2007-07-27 Thread Adam Fedor


On Jul 27, 2007, at 9:36 AM, Fred Kiefer wrote:


Stefan Bidigaray wrote:


4) Lastly, I'll need a lot of help creating ScreenSaverDefaults, but
only later.  I've check NSUserDefaults' code and I'm more confused  
now
than I was when I started out.  I figured for this, the best thing  
would

be to create a new file (ScreenSaverDefaults) under the Defaults
directory.  NSUserDefaults, however, seems to be very picky about  
there

being a process running and writing to that process.



You should just not worry about your settings being in a separate file
or not. GNUstep currently stores all defaults in one file, which btw I
do not like. All you need to do is to get and set your values from/in
[NSUserDefaults standardUserDefaults] and things should work as  
expected.




I think the concern here was sharing defaults between a preferences  
application and the actual screen save tool (which might need to be  
some kind of daemon, or at least might need to be a daemon that  
handles starting the screen saver). I don't really have a good answer  
for how to do this. There could be several ways - writing your own  
defaults file might be one of them.


Also, there's the issue of system-wide defaults vs user-defaults,  
which NSUserDefaults doesn't handle currently (AFAIK), but that could  
be useful for a screensaver.




___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: FYI and a few questions...

2007-07-27 Thread Adam Fedor


On Jul 27, 2007, at 6:46 AM, Stefan Bidigaray wrote:



1) I still haven't figured out how I'm going to count how many  
minutes it's been since the last even, and much less how to even  
find out if events have happened.  Does anyone have any ideas on  
how to do this?


2) I also have no idea how to figure if, once the screen saver is  
on, how to stop if when something happens (mouse move, key stroke,  
mouse click).  I've looked at the docs for NSView and there doesn't  
seem to be any methods that would make this easy.  What can I do here?




If you are going to write a screen saver, you will need to get  
support from the window system (X11, if you're just targeting that).  
The GNUstep framework won't help you with system-wide event  
handling.  I'd recommend looking at other screen-saver  
implementations, such as the GNOME screensaver (which is probably the  
most rigorous one written - although it's hard to follow, it has a  
very good philosophy), and also the basic xscreensaver. You also need  
to be very aware of the security issues surround screen savers and  
password handling (if you implement that).




___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: FYI and a few questions...

2007-07-27 Thread Stefan Bidigaray
On 7/27/07, Adam Fedor [EMAIL PROTECTED] wrote:

 If you are going to write a screen saver, you will need to get
 support from the window system (X11, if you're just targeting that).
 The GNUstep framework won't help you with system-wide event
 handling.  I'd recommend looking at other screen-saver
 implementations, such as the GNOME screensaver (which is probably the
 most rigorous one written - although it's hard to follow, it has a
 very good philosophy), and also the basic xscreensaver. You also need
 to be very aware of the security issues surround screen savers and
 password handling (if you implement that).


I figured this was going to be a problem!  Isn't there anyway I can poll
GNUstep-only applications though?  Presumably, in an utopia, there would
only be GNUstep applications running, so if they aren't getting events, it
would be safe to assume that nothing is getting events.

Yen-Ju, I'll take a closer look at Idle.  I follow Etoile-dev and -discuss
list quite a bit and have read about it before.  I was, however, hoping to
make this framework only dependent on GNUstep so that it could run
everywhere and not only on X.  If push comes to shove, I've messed with X
programming before and think I could use it to get something working this
way, but again, I rather not.

As for password handling, I don't plan on implementing anything like.  It
would be nice to get password protection, but I just can't think of dealing
with it now, specially since I have limited programming experience (heck,
this project is a complete mess right now).

The defaults issue is that Apple's explanation of ScreenSaverDefaults makes
it sound like it should be a separate file.  It would also make sense,
because lets say there's a screen saver called Terminal, well, there's
also an application called Terminal and it would be a mess if both tried to
share the same file.  Like I said, I'm not too worried about it right now,
I'd rather get everything else working before doing this.

Stefan
___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: FYI and a few questions...

2007-07-27 Thread Yen-Ju Chen
On 7/27/07, Stefan Bidigaray [EMAIL PROTECTED] wrote:
 So I finally broke down and subscribed to gnustep-dev!  I recently
 (Wednesday) started working on an implementation of Apple's ScreenSaver
 framework so that I can get more acquainted with GNUstep programming.  I
 figured this framework would be fairly easy to do, which it is, for most
 part.  I decided to split it in 3 parts, which I think is what I'd have to
 do anyway: the framework, a screen saver tool (which I called gssaver), and
 a preference module to configure it.

 So far I've managed to complete implementing the ScreenSaverView class and
 the SS* functions, but have no idea how to work the ScreenSaverDefaults
 class.  I most definitely will need some help implementing
 ScreenSaverDefaults, but I'm not too worried about it now since the default
 screen saver is a blank screen and doesn't need any configuration.

 I still haven't done anything in the preference module front.  Since all of
 the programming I've done has been at work and my everyday computer I
 haven't had access to a GNUstep installation, and haven't been able to use
 Gorm to create the interface.  I figured I would build the module by hand,
 but gave up on that idea since I thought I could learn more using Gorm.  For
 now, I've kind of put off creating the preference module till I'm done with
 the tool.

 The tool, gssaver, is turning out to be a little more complicated than I
 initially thought.  What I figured I'd do with it is make it an
 NSApplication but build it as a tool (not really sure if this would work).
 So I've implemented a simple delegate class for now which: creates a black
 window the size of the screen; loads the defaults; finds the screen saver;
 adds a ScreenSaverView subview; orders it to front; and calls the
 ScreenSaverView's -startAnimation method (in that order).

 My questions:

 1) I still haven't figured out how I'm going to count how many minutes it's
 been since the last even, and much less how to even find out if events have
 happened.  Does anyone have any ideas on how to do this?

  GNUstep window only get event when it has the focus.
  There is a small tool in Etoile called 'Idle',
  which uses Xwindow extension to check
  how long users have being idling and post notification, I guess.
  It may be useful for you.

  Yen-Ju


 2) I also have no idea how to figure if, once the screen saver is on, how to
 stop if when something happens (mouse move, key stroke, mouse click).  I've
 looked at the docs for NSView and there doesn't seem to be any methods that
 would make this easy.  What can I do here?

 3) Once the preference module is completed and working, I'll need to have
 gssaver check the defaults after the preferences change, is there anyway I
 can send it a message asking it to check the defaults fromt the preference
 module?

 4) Lastly, I'll need a lot of help creating ScreenSaverDefaults, but only
 later.  I've check NSUserDefaults' code and I'm more confused now than I was
 when I started out.  I figured for this, the best thing would be to create a
 new file (ScreenSaverDefaults) under the Defaults directory.
 NSUserDefaults, however, seems to be very picky about there being a process
 running and writing to that process.

 After it's all said and done I'd like to add this to GNUstep as I think it
 would make more sense being distributed by it (much like SystemPreferences
 and it's NSPreferencePane implementation).  I already have a copyright
 assignment, so it shouldn't be a problem.

 Any comments and/or suggestions would be appreciated.

 Stefan

 ___
 Gnustep-dev mailing list
 Gnustep-dev@gnu.org
 http://lists.gnu.org/mailman/listinfo/gnustep-dev




___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: FYI and a few questions...

2007-07-27 Thread Fred Kiefer
Stefan Bidigaray wrote:
 My questions:
 
 1) I still haven't figured out how I'm going to count how many minutes
 it's been since the last even, and much less how to even find out if
 events have happened.  Does anyone have any ideas on how to do this?
 

This is easy. If your tool already uses an NSApplication, just subclass
this and have your own class do special things at the end of the
nextEventMatchingMask:untilDate:inMode:dequeue: method. (sendEvent:
would also do)

 2) I also have no idea how to figure if, once the screen saver is on,
 how to stop if when something happens (mouse move, key stroke, mouse
 click).  I've looked at the docs for NSView and there doesn't seem to be
 any methods that would make this easy.  What can I do here?
 

Again this method does the job for you. If you set up an periodic event,
you even get that.

 3) Once the preference module is completed and working, I'll need to
 have gssaver check the defaults after the preferences change, is there
 anyway I can send it a message asking it to check the defaults fromt the
 preference module?
 

The other way around. The screen saver has to register to get change
notifications from the defaults. This is how NSColor does it:

  [[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(defaultsDidChange:)
name: NSUserDefaultsDidChangeNotification
object: nil];

 4) Lastly, I'll need a lot of help creating ScreenSaverDefaults, but
 only later.  I've check NSUserDefaults' code and I'm more confused now
 than I was when I started out.  I figured for this, the best thing would
 be to create a new file (ScreenSaverDefaults) under the Defaults
 directory.  NSUserDefaults, however, seems to be very picky about there
 being a process running and writing to that process.
 

You should just not worry about your settings being in a separate file
or not. GNUstep currently stores all defaults in one file, which btw I
do not like. All you need to do is to get and set your values from/in
[NSUserDefaults standardUserDefaults] and things should work as expected.


 After it's all said and done I'd like to add this to GNUstep as I think
 it would make more sense being distributed by it (much like
 SystemPreferences and it's NSPreferencePane implementation).  I already
 have a copyright assignment, so it shouldn't be a problem.
 

Cheers,
Fred


___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: FYI and a few questions...

2007-07-27 Thread Riccardo

Hi,

On 2007-07-27 14:46:06 +0200 Stefan Bidigaray [EMAIL PROTECTED] 
wrote:



So I finally broke down and subscribed to gnustep-dev!  I recently
(Wednesday) started working on an implementation of Apple's 
ScreenSaver
framework so that I can get more acquainted with GNUstep programming. 
 I
figured this framework would be fairly easy to do, which it is, for 
most
part.  I decided to split it in 3 parts, which I think is what I'd 
have to
do anyway: the framework, a screen saver tool (which I called 
gssaver), and

a preference module to configure it.


Have a look at InnerSpace in GAP. It isn't exactly a screensaver, but 
it could help you.


R


___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: FYI and a few questions...

2007-07-27 Thread Gregory John Casamento
Stefan,

This is exciting news.  I'm glad to hear you're working on such a thing.

Since it seems as though your other questions have been adequately answered, I 
will offer a few suggestions:

1) You may want to look at the code for InnerSpace before creating something 
from scratch.InnerSpace is the GNUstep successor to the original BackSpace
application on NeXTSTEP/OPENSTEP.   It is compliant with BackSpace's
API and it supports BackSpace modules with minimal changes.
2) Also, please stay away from names such as gs* as such things are trite and 
overused.
3) Also, I don't believe that a screen saver tool should go into the
GNUstep main project.   It should likely go into a separate project,
such as GAP, Etoile or it's own project outside of the main project. 

Apologies to Riccardo, but he is mistaken  InnerSpace's purpose is to be 
both a way of providing an animated background AND a screen saver.

The challenges I faced with InnerSpace were:

1) How to make it not eat up CPU cycles like crazy and
2) how to make it omnipresent (i.e. appearing on all desktops) in a *PORTABLE* 
way.

Both are solvable problems, but, at the time I wrote InnerSpace I had too many 
other things (read Gorm, GUI, Nib compatibility... etc) to concentrate on. ;)

Later, GJC
--
Gregory Casamento

- Original Message 
From: Riccardo [EMAIL PROTECTED]
To: Stefan Bidigaray [EMAIL PROTECTED]
Cc: GNUstep Developers gnustep-dev@gnu.org
Sent: Friday, July 27, 2007 1:12:43 PM
Subject: Re: FYI and a few questions...

Hi,

On 2007-07-27 14:46:06 +0200 Stefan Bidigaray [EMAIL PROTECTED] 
wrote:

 So I finally broke down and subscribed to gnustep-dev!  I recently
 (Wednesday) started working on an implementation of Apple's 
 ScreenSaver
 framework so that I can get more acquainted with GNUstep programming. 
  I
 figured this framework would be fairly easy to do, which it is, for 
 most
 part.  I decided to split it in 3 parts, which I think is what I'd 
 have to
 do anyway: the framework, a screen saver tool (which I called 
 gssaver), and
 a preference module to configure it.

Have a look at InnerSpace in GAP. It isn't exactly a screensaver, but 
it could help you.

R


___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev





___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev


Re: FYI and a few questions...

2007-07-27 Thread Stefan Bidigaray
On 7/27/07, Gregory John Casamento [EMAIL PROTECTED] wrote:

 2) Also, please stay away from names such as gs* as such things are
 trite and overused.


Well, I chose gssaver for a lack of better, and shorter, description.  The
only other idea I had was gscreensaver, note the s after the g isn't for
step but for screen.  The other option would be just ssaver.

3) Also, I don't believe that a screen saver tool should go into the
 GNUstep main project.   It should likely go into a separate project,
 such as GAP, Etoile or it's own project outside of the main project.


Well, the project isn't just a tool!  What I actually wanted to do was
implement the ScreenSaver framework.  The tool is just a daemon to start and
stop the screen savers.  I was thinking about putting it either in GNUstep
or GAP, thought I'd mention it to GNUstep first though.

1) How to make it not eat up CPU cycles like crazy and
 2) how to make it omnipresent (i.e. appearing on all desktops) in a
 *PORTABLE* way.


(1) Probably applies to my implementation, but since I'm not worried about
the window being omnipresent (2) doesn't matter.  The ScreenSaver framework
only does full screen saver, and doesn't mention putting them on the
background like InnerSpace does.

Stefan
___
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev