~ubuntu-branches/ubuntu/lucid/sawfish/lucid-updates

« back to all changes in this revision

Viewing changes to lisp/sawfish/wm/commands/move-resize.jl

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2005-02-23 16:16:46 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050223161646-4id6qyw4h9lkvb0v
Tags: 1:1.3+cvs20050222-1
* New cvs release.
* Add an emacs initialisation script to load sawfish.el (Closes: #295290)
* Updated sawfish.el to 1.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;; move-resize.jl -- interactive moving and resizing of windows
2
 
;; $Id: move-resize.jl,v 1.85 2001/06/05 03:20:34 jsh Exp $
 
2
;; $Id: move-resize.jl,v 1.91 2002/05/29 06:39:02 jsh Exp $
3
3
 
4
4
;; Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk>
5
5
 
48
48
  ;; todo:
49
49
  ;;  * obey the aspect ratio size hints
50
50
 
51
 
  (defcustom move-outline-mode 'opaque
52
 
    "How windows being moved are animated: \\w"
53
 
    :type symbol
54
 
    :options (opaque box)
55
 
    :user-level novice
56
 
    :group move)
57
 
  
58
 
  (defcustom resize-outline-mode 'opaque
59
 
    "How windows being resized are animated: \\w"
60
 
    :type symbol
61
 
    :options (opaque box)
62
 
    :user-level novice
63
 
    :group move)
64
 
  
65
 
  (defcustom move-resize-raise-window nil
66
 
    "Raise windows when they are moved or resized."
67
 
    :group move
68
 
    :type boolean)
 
51
  (defvar move-outline-mode 'opaque
 
52
    "How windows being moved are animated, either `opaque' or `box'")
 
53
  
 
54
  (defvar resize-outline-mode 'opaque
 
55
    "How windows being resized are animated, either `opaque' or `box'")
 
56
  
 
57
  (defvar move-resize-raise-window nil
 
58
    "Raise windows when they are moved or resized.")
69
59
  
70
60
  (defcustom move-show-position nil
71
61
    "Show current position of windows while moving."
77
67
    :group move
78
68
    :type boolean)
79
69
  
80
 
  (defcustom resize-edge-mode 'border
81
 
    "How to choose window edges when resizing: \\w"
82
 
    :type (choice region border grab border-grab)
83
 
    :user-level expert
84
 
    :group move)
85
 
  
86
 
  (defcustom move-snap-edges t
87
 
    "Snap window position to edges of other windows while moving."
88
 
    :group move
89
 
    :type boolean)
90
 
  
91
 
  (defcustom move-snap-epsilon 8
92
 
    "Proximity in pixels before snapping to a window edge."
93
 
    :group move
94
 
    :depends move-snap-edges
 
70
  (defvar resize-edge-mode 'border-grab
 
71
    "How to choose window edges when resizing. One of `region', `border',
 
72
`grab', `border-grab'")
 
73
  
 
74
  (defcustom move-snap-epsilon 12
 
75
    "Distance in pixels before window edges align with each other."
 
76
    :group move
95
77
    :type (number 0 64)
96
 
    :user-level expert)
97
 
  
98
 
  (defcustom move-snap-mode 'resistance
99
 
    "How to snap together window edges: \\w"
100
 
    :group move
101
 
    :depends move-snap-edges
102
 
    :type (choice magnetism resistance attraction)
103
 
    :user-level expert)
104
 
  
105
 
  (defcustom move-snap-ignored-windows nil
106
 
    "Snap to otherwise-ignored windows."
107
 
    :group move
108
 
    :depends move-snap-edges
109
 
    :user-level expert
110
 
    :type boolean)
111
 
  
112
 
  (defcustom move-resize-inhibit-configure nil
113
 
    "Only update window contents after it has stopped moving."
114
 
    :type boolean
115
 
    :group move
116
 
    :user-level expert)
 
78
    :tooltip "When moving a window, this option lets you align one of its edges with an edge of another window.")
 
79
  
 
80
  (defvar move-snap-mode 'resistance
 
81
    "How to snap together window edges, one of `magnetism', `resistance', or
 
82
`attraction'.")
 
83
  
 
84
  (defvar move-snap-ignored-windows nil
 
85
    "Snap to otherwise-ignored windows.")
 
86
  
 
87
  (defvar move-resize-inhibit-configure nil
 
88
    "Only update window contents after it has stopped moving.")
117
89
 
118
90
  (defvar move-resize-map (bind-keys (make-keymap)
119
 
                            "Any-Off" (lambda () (finished))
 
91
                            "Any-Off1" (lambda () (finished))
 
92
                            "Any-Off2" (lambda () (finished))
 
93
                            "Any-Off3" (lambda () (finished))
120
94
                            "Any-Move" (lambda () (motion))
121
95
                            "Any-ESC" (lambda () (cancel))
122
96
                            "Any-RET" (lambda () (finished))
296
270
 
297
271
  (define (update-edges)
298
272
    (setq move-resize-edges
299
 
          (and move-snap-edges
 
273
          (and (> move-snap-epsilon 0)
300
274
               (progn
301
275
                 (get-visible-window-edges
302
276
                  #:with-ignored-windows move-snap-ignored-windows
318
292
             (when (memq 'vertical move-resize-directions)
319
293
               (setq move-resize-y (+ move-resize-old-y
320
294
                                      (- ptr-y move-resize-old-ptr-y))))
321
 
             (when move-snap-edges
 
295
             (when (> move-snap-epsilon 0)
322
296
               (let
323
297
                   ((coords (snap-window-position-to-edges
324
298
                             move-resize-window (cons move-resize-x
331
305
                 (setq move-resize-y (cdr coords)))))
332
306
            ((eq move-resize-function 'resize)
333
307
             (let
334
 
                 ((x-base (or (cdr (or (assq 'base-width move-resize-hints)
335
 
                                       (assq 'min-width move-resize-hints))) 1))
 
308
                 ((x-base (or (cdr (assq 'base-width move-resize-hints)) 0))
336
309
                  (x-inc (or (cdr (assq 'width-inc move-resize-hints)) 1))
337
 
                  (y-base (or (cdr (or (assq 'base-height move-resize-hints)
338
 
                                       (assq 'min-height move-resize-hints))) 1))
 
310
                  (y-base (or (cdr (assq 'base-height move-resize-hints)) 0))
339
311
                  (y-inc (or (cdr (assq 'height-inc move-resize-hints)) 1)))
340
312
               (when (memq resize-edge-mode '(grab border-grab))
341
313
                 (add-edges ptr-x ptr-y))