diff options
author | puppetmaster <puppetmaster> | 2005-07-28 23:13:57 +0000 |
---|---|---|
committer | puppetmaster <puppetmaster> | 2005-07-28 23:13:57 +0000 |
commit | bde4c25ee95fd0eaa3e641c920194ddb0cc861fc (patch) | |
tree | 6a509fdfd1504831df7af60dc2cde22eef2506d1 | |
parent | for coding style (diff) | |
download | elock-bde4c25ee95fd0eaa3e641c920194ddb0cc861fc.tar.xz |
Added ecore_x_screensaver_add ...
-rw-r--r-- | ecore/src/lib/ecore_x/ecore_x_screensaver.c | 103 |
1 files changed, 64 insertions, 39 deletions
diff --git a/ecore/src/lib/ecore_x/ecore_x_screensaver.c b/ecore/src/lib/ecore_x/ecore_x_screensaver.c index 1b1d394..9a44d54 100644 --- a/ecore/src/lib/ecore_x/ecore_x_screensaver.c +++ b/ecore/src/lib/ecore_x/ecore_x_screensaver.c @@ -9,65 +9,90 @@ #endif -XScreenSaverInfo * -ecore_x_screensaver_get_alloc_info(void) +XScreenSaverInfo * +ecore_x_screensaver_get_alloc_info (void) { - XScreenSaverInfo *info; - Ecore_X_Window root; + XScreenSaverInfo *info; + Ecore_X_Window root; - info = XScreenSaverAllocInfo(); + info = XScreenSaverAllocInfo (); - if (!info) - return NULL; + if (!info) + return NULL; - root = DefaultRootWindow(_ecore_x_disp); + root = DefaultRootWindow (_ecore_x_disp); - if (!XScreenSaverQueryInfo(_ecore_x_disp, root, info)) - return info; - else - return NULL; + if (!XScreenSaverQueryInfo (_ecore_x_disp, root, info)) + return info; + else + return NULL; } void -ecore_x_screensaver_free_alloc_info(XScreenSaverQueryInfo * info) +ecore_x_screensaver_free_alloc_info (XScreenSaverQueryInfo * info) { - XFree(info); - return; + XFree (info); + return; } int -ecore_x_screensaver_set_attributes(XSetWindowAttributes attr) +ecore_x_screensaver_set_attributes (XSetWindowAttributes attr) { - Ecore_X_Window root; - int screen; + Ecore_X_Window root; + int screen; - root = DefaultRootWindow(_ecore_x_disp); + root = DefaultRootWindow (_ecore_x_disp); - screen = DefaultScreen(_ecore_x_disp); + screen = DefaultScreen (_ecore_x_disp); - if (!XScreenSaverSetAttributes(_ecore_x_disp, root, 0, 0, - DisplayWidth(_ecore_x_disp, screen), - DisplayHeight(_ecore_x_disp, screen), + if (!XScreenSaverSetAttributes (_ecore_x_disp, root, 0, 0, + DisplayWidth (_ecore_x_disp, screen), + DisplayHeight (_ecore_x_disp, screen), 0, CopyFromParent, - CopyFromParent, CopyFromParent, mask, &attr)) - return 1; - else - return 0; + CopyFromParent, CopyFromParent, mask, + &attr)) + return 1; + else + return 0; } int -ecore_x_screensaver_event_handler_add(void) +ecore_x_screensaver_add (void) { - Ecore_X_Window root; - - root = DefaultRootWindow(_ecore_x_disp); - - if (!XScreenSaverSelectInput - (_ecore_x_disp, root, ScreenSaverNotifyMask | ScreenSaverCycleMask)) - return 1; - - if (!ecore_x_screensaver_set_attributes()) - return 1; - /* ... */ + GC gc; + int screen; + XEvent event; + Ecore_X_Window root; + XScreenSaverNotifyEvent *se; + + root = DefaultRootWindow (_ecore_x_disp); + screen = DefaultScreen (_ecore_x_disp); + gc = DefaultGC (_ecore_x_disp, screen); + + if (!XScreenSaverSelectInput + (_ecore_x_disp, root, ScreenSaverNotifyMask | ScreenSaverCycleMask)) + return 1; + + if (!ecore_x_screensaver_set_attributes ()) + return 1; + + if (!XSetForeground (_ecore_x_disp, gc, WhitePixel (_ecore_x_disp, screen))) + return 1; + + while (1) + { + if (!XNextEvent (_ecore_x_disp, &event)) + return 1; + if (event.type == _ecore_x_event_scrnsaver_id) + { + se = (XScreenSaverNotifyEvent *) & pe; + + if (se->state == ScreenSaverOn && se->kind == ScreenSaverExternal) + { + XDrawString (_ecore_x_disp, 100, 100, "Ecore ScreeSaver", 17); + XSync (_ecore_x_disp, False); + } + } + } } |