From: Thien-Thi Nguyen <ttn@giblet.glug.org>
Cc: guile-user@gnu.org
Subject: local-utils.scm 0.20020909
Date: Sun, 08 Sep 2002 20:10:36 -0700 [thread overview]
Message-ID: <E17oEwe-00062A-00@giblet> (raw)
(for use w/ same-versioned circle-frisk.)
thi
__________________________________________
;;; local-utils.scm
;;; Copyright (C) 2002 Thien-Thi Nguyen
;;; This program is part of xplay, released under GNU GPL v2 with ABSOLUTELY
;;; NO WARRANTY. See http://www.gnu.org/copyleft/gpl.txt for details.
;;; Version: 0.20020909
;;; Commentary:
;; save as ./local-utils.scm
;;
;; hardcoded values in compute-center-[xy] reflect hardcoded values in
;; guile-xlib's xlib.c.
;;; Code:
(define-module (local-utils)
:use-module (xlib core)
:use-module (xlib xlib)
:export (new-d/w/gc/show/clear
erasing-gc
xor-gc
simple-kick
root->black!
compute-center-x
compute-center-y))
(define (new-d/w/gc/show/clear)
(let* ((root? (member "root" (command-line))) ; ugh
(d (x-open-display!))
(w (if root?
(x-root-window d)
(x-create-window! d)))
(gc (if root?
(x-create-gc! w
GCForeground (x-white-pixel d)
GCBackground (x-black-pixel d)
;;GCFillStyle FillSolid
)
(x-default-gc d))))
(values d w gc
(lambda () (or root? (x-map-window! w)))
(lambda () (and root? (root->black! d))))))
(define (erasing-gc d w)
(x-create-gc! w GCForeground
((if (eq? w (x-root-window d))
x-black-pixel
x-white-pixel)
d)))
(define (xor-gc w)
(x-create-gc! w GCFunction GXxor))
(define (simple-kick proc)
(call-with-values new-d/w/gc/show/clear proc))
(define (root->black! d)
(let* ((w (x-display-width d))
(h (x-display-height d))
(r (x-root-window d))
(gc (x-create-gc! r
GCForeground (x-black-pixel d)
GCBackground (x-white-pixel d))))
(do ((x 0 (1+ x)))
((= w x))
(x-draw-line! r gc x 0 x h)))
(x-flush! d))
(define (compute-center-x d w)
(inexact->exact (/ (if (eq? w (x-root-window d))
(x-display-width d)
600)
2)))
(define (compute-center-y d w)
(inexact->exact (/ (if (eq? w (x-root-window d))
(x-display-height d)
400)
2)))
;;; local-utils.scm ends here
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
reply other threads:[~2002-09-09 3:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E17oEwe-00062A-00@giblet \
--to=ttn@giblet.glug.org \
--cc=guile-user@gnu.org \
--cc=ttn@glug.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).