[go: up one dir, main page]

Menu

[1aafb6]: / scheme / cursor.scm  Maximize  Restore  History

Download this file

46 lines (38 with data), 1.7 kB

 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
;;;; $Id$
;;;; Copyright (C) 1999, 2000 Greg J. Badros
(define-module (app scwm cursor)
#:use-module (app scwm optargs)
#:use-module (app scwm nonants)
#:use-module (app scwm defoption)
)
(define*-public (image-name->cursor name #:optional (x-hotspot 8) (y-hotspot 8))
"Make a cursor given only the NAME.
X-HOTSPOT and Y-HOTSPOT can specify the hotspot coordinates for the cursor."
(create-pixmap-cursor (make-image name) #f #f x-hotspot y-hotspot))
;;; these pixmaps are in pixmaps/
;;; double-headed arrow from top left to bottom right
(define resize-br (image-name->cursor "resize_br.xpm"))
;;; double-headed arrow from bottom left to top right
(define resize-tr (image-name->cursor "resize_tr.xpm"))
;;; double-headed arrow from left to right
(define resize-h (image-name->cursor "resize_h.xpm"))
;;; double-headed arrow from top to bottom
(define resize-v (image-name->cursor "resize_v.xpm"))
;;; SRL:FIXME:: Should allow different cursors for each nonant.
;; (apply-fancy-resize-cursors)
(define*-public (apply-fancy-resize-cursors #:optional (win (get-window)))
"Use the fancy resize cursors for WIN."
(map (lambda (pair) (set-window-cursor! (nonant-decoration win (car pair)) (cdr pair)))
`((northwest . ,resize-br)
(southeast . ,resize-br)
(southwest . ,resize-tr)
(northeast . ,resize-tr)
(north . ,resize-v)
(south . ,resize-v)
(east . ,resize-h)
(west . ,resize-h))))
;;; GJB:FIXME:: It'd be nice if this were a window-style
(add-hook! startup-hook
(lambda ()
(add-hook! after-new-window-hook apply-fancy-resize-cursors)
(for-each apply-fancy-resize-cursors (list-all-windows))))