darcs patch: screensaver extension

[email protected] Sun, 28 Aug 2005 03:12:23 -0700
Newsgroups gmane.lisp.clx.devel
Message-ID <[email protected]>
--=_
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Sun Aug 28 02:59:37 PDT 2005  [email protected]
  * screensaver extension
  This is a partial interface to the MIT-SCREEN-SAVER extension

--=_
Content-Type: text/x-darcs-patch
Content-Transfer-Encoding: quoted-printable
Content-Description: A darcs patch for your repository!


New patches:

[screensaver extension
[email protected]**20050828095937
 This is a partial interface to the MIT-SCREEN-SAVER extension
] {
hunk ./clx.asd 70
-               (:file "gl" :depends-on ("glx"))))
+               (:file "gl" :depends-on ("glx"))
+	       (:file "screensaver")))
addfile ./screensaver.lisp
hunk ./screensaver.lisp 1
+;;; -*- Mode: Lisp; Syntax: Common-Lisp; Package: XLIB; -*-
+;;; ----------------------------------------------------------------------=
-----
+;;;     Title: X11 MIT Screensaver extension
+;;;   Created: 2005-08-28 01:41
+;;;    Author: Istvan Marko <[email protected]>
+;;; ----------------------------------------------------------------------=
-----
+;;;  (c) copyright 2005 by Istvan Marko
+
+;;;
+;;; Permission is granted to any individual or institution to use,
+;;; copy, modify, and distribute this software, provided that this
+;;; complete copyright and permission notice is maintained, intact, in
+;;; all copies and supporting documentation.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+;;;
+
+;;; Description:
+;;;
+;;; This is a partial interface to the MIT-SCREEN-SAVER
+;;; extension. Only the ScreenSaverQueryVersion and
+;;; ScreenSaverQueryInfo requests are implemented because I couldn't
+;;; think of a use for the rest. In fact, the only use I see for this
+;;; extension is screen-saver-get-idle which provides and easy way to
+;;; find out how long has it been since the last keyboard or mouse
+;;; activity.
+
+;;; A description of this extension can be found at
+;;; doc/hardcopy/saver/saver.PS.gz in the X11 distribution.
+
+(in-package :xlib)
+
+(export '(screen-saver-query-version
+	  screen-saver-query-info
+	  screen-saver-get-idle)
+        :xlib)
+
+(define-extension "MIT-SCREEN-SAVER")
+
+(defun screen-saver-query-version (display)
+  (with-buffer-request-and-reply (display (extension-opcode display "MIT-S=
CREEN-SAVER")
+                                          nil)
+    ((data 0)
+     (card8 1) ;client major version
+     (card8 0) ;client minor version
+     (card16 0)) ; unused
+    (values
+     (card16-get 8) ; server major version
+     (card16-get 10)))) ; server minor version
+
+(defun screen-saver-query-info (display drawable)
+  (with-buffer-request-and-reply (display (extension-opcode display "MIT-S=
CREEN-SAVER")
+                                          nil)
+    ((data 1)
+     (drawable drawable))
+    (values
+     (card8-get 1) ; state: off, on, disabled
+     (window-get 8) ; screen saver window if active
+     (card32-get 12) ; tilorsince msecs. how soon before the screen saver =
kicks in or how long has it been active
+     (card32-get 16) ; idle msecs
+     (card8-get 24)))) ; kind: Blanked, Internal, External
+
+(defun screen-saver-get-idle (display drawable)
+  "How long has it been since the last keyboard or mouse input"
+   (multiple-value-bind (state window tilorsince idle kind) (screen-saver-=
query-info display drawable)
+     (declare (ignore state window kind))
+     (values idle tilorsince)))
+   =

}

Context:

[sbcl-0.9.2.10-threads-support, from Christophe Rhodes
Daniel Barlow <[email protected]>**20050714141147] =

[no more waitqueues: patch from Gabor Melis
Daniel Barlow <[email protected]>**20050714134740] =

[TAG release_0_7_0 =

dan**20050501222506] =

Patch bundle hash:
5e1a58b5e47fc3c1bec20ec0aca42c4efa7ba172

--=_--

.




_______________________________________________
Portable-clx mailing list
[email protected]
http://lists.metacircles.com/cgi-bin/mailman/listinfo/portable-clx
cvs -d :ext:cvs.telent.net:/usr/local/src/cvs co clx  # over ssh
cvs -d :pserver:[email protected]:/cvs co clx  # anonymous