[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ayatana] New notification placement



Mark Shuttleworth wrote:
Mirco Müller wrote:
  
Am Freitag, den 28.08.2009, 09:30 +0100 schrieb Mark Shuttleworth:

  
    
...
Mirco, is there any way to know, when the notification appears, how
long the mouse has been stationary?
    
      
	Yes, that should be doable. I'll give that a try today and let you
folks know about the outcome.
  
    
OK, just let us know if it's *possible*. I'm thinking that we might
leave the fade if the mouse has moved in the past 5 seconds on the basis
that your eye is likely to be tracking the mouse. But if the mouse has
been still, we wouldn't fade because you just left the mouse there from
previous work.

This would be pretty fragile to small accidental nudges of the mouse, so
I don't think we should implement it yet, but I'd like to know how much
we can cheaply determine about the mouse's behaviour in the past few
seconds. I do *not* want notify-osd to be eating CPU cycles watching the
mouse all the time, though :-)
  
Currently, we're adding a cursor monitoring callback once a notification is on display, but that's polling. It's acceptable to finely track what the user is doing for fading, blurring, etc. But not as general mechanism.

However, using the XScreenSaver extension, the X server is maintaining this information for us, so that we can track the idle time, without doing any polling, in particular when no notification is on display.

>From xscreensaverqueryinfo(3):

#include <X11/extensions/scrnsaver.h>

typedef struct {
    Window window;                /* screen saver window */
    int state;                    /* ScreenSaver{Off,On,Disabled} */
    int kind;                     /* ScreenSaver{Blanked,Internal,External}
*/
    unsigned long til_or_since;   /* milliseconds */
    unsigned long idle;           /* milliseconds */
    unsigned long event_mask;     /* events */

} XScreenSaverInfo;

accessible with XScreenSaverQueryInfo

We should need to do the query only before displaying a new notification, to know whether to apply the "no-fade-when-mouse-is-there" feature or not.

David