/[cmucl]/src/clx/screensaver.lisp
ViewVC logotype

Contents of /src/clx/screensaver.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Wed Jun 17 18:22:46 2009 UTC (4 years, 10 months ago) by rtoy
Branch: MAIN
CVS Tags: GIT-CONVERSION, cross-sol-x86-base, sparc-tramp-assem-base, post-merge-intl-branch, snapshot-2010-12, snapshot-2010-11, cross-sol-x86-merged, snapshot-2011-09, snapshot-2011-06, snapshot-2011-07, snapshot-2011-04, intl-2-branch-base, snapshot-2011-02, snapshot-2011-03, snapshot-2011-01, release-20a-pre1, snapshot-2009-11, snapshot-2010-06, pre-merge-intl-branch, intl-branch-working-2010-02-19-1000, unicode-string-buffer-impl-base, intl-branch-working-2010-02-11-1000, release-20b-pre1, release-20b-pre2, unicode-string-buffer-base, cross-sparc-branch-base, intl-branch-base, snapshot-2010-05, snapshot-2010-04, snapshot-2010-07, sparc-tramp-assem-2010-07-19, snapshot-2010-01, snapshot-2010-03, snapshot-2010-02, snapshot-2010-08, snapshot-2009-08, release-20a-base, snapshot-2009-07, RELEASE_20b, RELEASE_20a, cross-sol-x86-2010-12-20, amd64-dd-start, intl-branch-2010-03-18-1300, snapshot-2009-12, HEAD
Branch point for: RELEASE-20A-BRANCH, unicode-string-buffer-branch, cross-sol-x86-branch, cross-sparc-branch, sparc-tramp-assem-branch, amd64-dd-branch, unicode-string-buffer-impl-branch, intl-2-branch, RELEASE-20B-BRANCH, intl-branch
Changes since 1.1: +69 -0 lines
Merge portable-clx (2009-06-16) to main branch.  Tested by running
src/contrib/games/feebs and hemlock which works (in non-unicode
builds).
1 ;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: XLIB; -*-
2 ;;; ---------------------------------------------------------------------------
3 ;;; Title: X11 MIT Screensaver extension
4 ;;; Created: 2005-08-28 01:41
5 ;;; Author: Istvan Marko <mi-clx@kismala.com>
6 ;;; ---------------------------------------------------------------------------
7 ;;; (c) copyright 2005 by Istvan Marko
8
9 ;;;
10 ;;; Permission is granted to any individual or institution to use,
11 ;;; copy, modify, and distribute this software, provided that this
12 ;;; complete copyright and permission notice is maintained, intact, in
13 ;;; all copies and supporting documentation.
14 ;;;
15 ;;; This program is distributed in the hope that it will be useful,
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 ;;;
19
20 ;;; Description:
21 ;;;
22 ;;; This is a partial interface to the MIT-SCREEN-SAVER
23 ;;; extension. Only the ScreenSaverQueryVersion and
24 ;;; ScreenSaverQueryInfo requests are implemented because I couldn't
25 ;;; think of a use for the rest. In fact, the only use I see for this
26 ;;; extension is screen-saver-get-idle which provides and easy way to
27 ;;; find out how long has it been since the last keyboard or mouse
28 ;;; activity.
29
30 ;;; A description of this extension can be found at
31 ;;; doc/hardcopy/saver/saver.PS.gz in the X11 distribution.
32
33 (in-package :xlib)
34
35 (export '(screen-saver-query-version
36 screen-saver-query-info
37 screen-saver-get-idle)
38 :xlib)
39
40 (define-extension "MIT-SCREEN-SAVER")
41
42 (defun screen-saver-query-version (display)
43 (with-buffer-request-and-reply (display (extension-opcode display "MIT-SCREEN-SAVER")
44 nil)
45 ((data 0)
46 (card8 1) ;client major version
47 (card8 0) ;client minor version
48 (card16 0)) ; unused
49 (values
50 (card16-get 8) ; server major version
51 (card16-get 10)))) ; server minor version
52
53 (defun screen-saver-query-info (display drawable)
54 (with-buffer-request-and-reply (display (extension-opcode display "MIT-SCREEN-SAVER")
55 nil)
56 ((data 1)
57 (drawable drawable))
58 (values
59 (card8-get 1) ; state: off, on, disabled
60 (window-get 8) ; screen saver window if active
61 (card32-get 12) ; tilorsince msecs. how soon before the screen saver kicks in or how long has it been active
62 (card32-get 16) ; idle msecs
63 (card8-get 24)))) ; kind: Blanked, Internal, External
64
65 (defun screen-saver-get-idle (display drawable)
66 "How long has it been since the last keyboard or mouse input"
67 (multiple-value-bind (state window tilorsince idle kind) (screen-saver-query-info display drawable)
68 (declare (ignore state window kind))
69 (values idle tilorsince)))

  ViewVC Help
Powered by ViewVC 1.1.5