From 6accfb619a1918c6bde325f2e8fe9394994a2a5a Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 22 Oct 2006 16:10:06 +0000 Subject: [PATCH] Change pointer-button abstraction to have bucky bits, and update different terminal drivers to supply them. --- v7/src/edwin/calias.scm | 18 ++------ v7/src/edwin/edtfrm.scm | 7 +-- v7/src/edwin/edtstr.scm | 96 ++++++++++++++++++++-------------------- v7/src/edwin/edwin.pkg | 3 +- v7/src/edwin/os2term.scm | 38 +++++++++------- v7/src/edwin/utils.scm | 36 ++++++++------- v7/src/edwin/win32.scm | 41 +++++++---------- v7/src/edwin/xterm.scm | 10 +++-- 8 files changed, 122 insertions(+), 127 deletions(-) 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!