File: move-cursor.jl

package info (click to toggle)
sawfish 1%3A1.3.5.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 11,636 kB
  • ctags: 1,327
  • sloc: lisp: 22,765; ansic: 15,810; sh: 10,203; makefile: 675; perl: 19
file content (81 lines) | stat: -rw-r--r-- 2,795 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;; move-cursor.jl -- commands to move the mouse pointer
;; $Id: move-cursor.jl,v 1.4 2000/07/27 13:19:29 john Exp $

;; Copyright (C) 2000 John Harper <john@dcs.warwick.ac.uk>

;; This file is part of sawmill.

;; sawmill is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; sawmill 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.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with sawmill; see the file COPYING.  If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

(define-structure sawfish.wm.commands.move-cursor

    (export move-cursor)

    (open rep
	  sawfish.wm.misc
	  sawfish.wm.events
	  sawfish.wm.custom
	  sawfish.wm.commands)

  (defcustom move-cursor-increment 16
    "Number of pixels to move pointer in `move-cursor-' commands."
    :group misc
    :type (number 1))

  (define (move-cursor right down)
    (let ((coords (query-pointer)))
      (warp-cursor (+ (car coords) right) (+ (cdr coords) down))))

  (define (move-cursor-left)
    "Move the cursor `move-cursor-increment' pixels to the left."
    (move-cursor (- move-cursor-increment) 0))

  (define (move-cursor-right)
    "Move the cursor `move-cursor-increment' pixels to the right."
    (move-cursor move-cursor-increment 0))

  (define (move-cursor-up)
    "Move the cursor `move-cursor-increment' pixels upwards."
    (move-cursor 0 (- move-cursor-increment)))

  (define (move-cursor-down)
    "Move the cursor `move-cursor-increment' pixels downwards."
    (move-cursor 0 move-cursor-increment))

  (define (move-cursor-left-fine)
    "Move the cursor 1 pixel to the left."
    (move-cursor -1 0))

  (define (move-cursor-right-fine)
    "Move the cursor 1 pixel to the right."
    (move-cursor 1 0))

  (define (move-cursor-up-fine)
    "Move the cursor 1 pixel upwards."
    (move-cursor 0 -1))

  (define (move-cursor-down-fine)
    "Move the cursor 1 pixel downwards."
    (move-cursor 0 1))

  ;;###autoload
  (define-command 'move-cursor-right move-cursor-right)
  (define-command 'move-cursor-left move-cursor-left)
  (define-command 'move-cursor-up move-cursor-up)
  (define-command 'move-cursor-down move-cursor-down)
  (define-command 'move-cursor-right-fine move-cursor-right-fine)
  (define-command 'move-cursor-left-fine move-cursor-left-fine)
  (define-command 'move-cursor-up-fine move-cursor-up-fine)
  (define-command 'move-cursor-down-fine move-cursor-down-fine))