From: Chris Hanson Date: Sun, 22 Oct 2006 16:10:06 +0000 (+0000) Subject: Change pointer-button abstraction to have bucky bits, and update X-Git-Tag: 20090517-FFI~882 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6accfb619a1918c6bde325f2e8fe9394994a2a5a;p=mit-scheme.git Change pointer-button abstraction to have bucky bits, and update different terminal drivers to supply them. --- diff --git a/v7/src/edwin/calias.scm b/v7/src/edwin/calias.scm index 43d853c40..aa9fdcacb 100644 --- a/v7/src/edwin/calias.scm +++ b/v7/src/edwin/calias.scm @@ -1,9 +1,9 @@ #| -*-Scheme-*- -$Id: calias.scm,v 1.31 2003/04/25 03:09:55 cph Exp $ +$Id: calias.scm,v 1.32 2006/10/22 16:09:24 cph Exp $ Copyright 1986,1989,1991,1992,1994,1995 Massachusetts Institute of Technology -Copyright 1998,2000,2001,2002,2003 Massachusetts Institute of Technology +Copyright 1998,2000,2001,2002,2003,2006 Massachusetts Institute of Technology This file is part of MIT/GNU Scheme. @@ -78,9 +78,6 @@ USA. (if entry (unmap-alias-key (car entry)) key)))) - -(define-integrable (ascii-controlified? char) - (< (char-code char) #x20)) (define-variable enable-emacs-key-names "True means keys are shown using Emacs-style names." @@ -94,12 +91,6 @@ USA. ((button? key) (button-name key)) (else (error:wrong-type-argument key "key" 'KEY-NAME)))) -(define (button-name button) - (string-append "button-" - (if (button/down? button) "down" "up") - "-" - (number->string (button/number button)))) - (define (xkey->name xkey) (let ((keys (xkey->list xkey))) (string-append-separated @@ -161,7 +152,7 @@ USA. (define (key-bucky-bits key) (cond ((char? key) (char-bits key)) ((special-key? key) (special-key/bucky-bits key)) - ((button? key) (button/bucky-bits key)) + ((button? key) (button-bits key)) (else (error:wrong-type-argument key "key" 'KEY-BUCKY-BITS)))) (define (key + (%%make-button number bits down? symbol) + button? + (number button-number) + (bits button-bits) + (down? button-down?) + (symbol button-symbol)) + +(define (make-down-button number #!optional bits) + (%make-button number bits #t 'MAKE-DOWN-BUTTON)) + +(define (make-up-button number #!optional bits) + (%make-button number bits #f 'MAKE-UP-BUTTON)) + +(define (%make-button number bits down? caller) + (let ((bits (if (default-object? bits) 0 bits))) + (guarantee-limited-index-fixnum number #x100 caller) + (guarantee-limited-index-fixnum bits #x10 caller) + (let ((name + (symbol (bucky-bits->prefix bits) + 'BUTTON- + number + (if down? '-DOWN '-UP)))) + (hash-table/intern! buttons-table name + (lambda () + (%%make-button number bits down? name)))))) + +(define buttons-table + (make-strong-eq-hash-table)) + +(define (down-button? object) + (and (button? object) + (button-down? object))) + +(define (up-button? object) + (and (button? object) + (not (button-down? object)))) + +(define (button-name button) + (symbol-name (button-symbol button))) + +(set-record-type-unparser-method!