~ubuntu-branches/ubuntu/natty/sawfish/natty

« back to all changes in this revision

Viewing changes to lisp/sawfish/wm/viewport.jl

  • Committer: Bazaar Package Importer
  • Author(s): Luis Rodrigo Gallardo Cruz
  • Date: 2009-11-23 09:05:20 UTC
  • mfrom: (1.2.10 upstream) (3.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20091123090520-3u8sefrr4lmfsiem
Tags: 1:1.5.3-2
* Remove reference to sawMILL in 00debian.jl (Closes: #557250).
* Remove empty doc dirs and replace them with symlinks (Closes: #556991).
* Rename sawfish maintainer scripts with the binary package name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
;; Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk>
5
5
 
6
 
;; This file is part of sawmill.
 
6
;; This file is part of sawfish.
7
7
 
8
 
;; sawmill is free software; you can redistribute it and/or modify it
 
8
;; sawfish is free software; you can redistribute it and/or modify it
9
9
;; under the terms of the GNU General Public License as published by
10
10
;; the Free Software Foundation; either version 2, or (at your option)
11
11
;; any later version.
12
12
 
13
 
;; sawmill is distributed in the hope that it will be useful, but
 
13
;; sawfish is distributed in the hope that it will be useful, but
14
14
;; WITHOUT ANY WARRANTY; without even the implied warranty of
15
15
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
16
;; GNU General Public License for more details.
17
17
 
18
18
;; You should have received a copy of the GNU General Public License
19
 
;; along with sawmill; see the file COPYING.  If not, write to
 
19
;; along with sawfish; see the file COPYING.  If not, write to
20
20
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21
21
 
22
22
(define-structure sawfish.wm.viewport
48
48
 
49
49
  ;; Virtual workspaces are implemented by moving windows in and out of
50
50
  ;; the screen dimensions. E.g. moving to the left moves all windows one
51
 
  ;; screen-width to the right. 
52
 
 
53
 
  (defvar viewport-dimensions '(1 . 1)
54
 
    "Size of each virtual workspace.")
55
 
 
56
 
  (defvar uniconify-to-current-viewport t
57
 
    "Windows uniconify to the current viewport.")
 
51
  ;; screen-width to the right.
 
52
 
 
53
  (defgroup viewport "Viewport" :group workspace)
 
54
 
 
55
  (defcustom viewport-dimensions '(1 . 1)
 
56
    "Number of columns and rows in each virtual workspace: \\w"
 
57
    :group (workspace viewport)
 
58
    :type (pair (number 1) (number 1))
 
59
    :after-set (lambda () (viewport-size-changed)))
 
60
 
 
61
  (defcustom uniconify-to-current-viewport t
 
62
    "Windows uniconify to the current viewport."
 
63
    :type boolean
 
64
    :group (workspace viewport))
58
65
 
59
66
  (defcustom scroll-viewport-steps 1
60
 
    "Number of steps in which to scroll between viewports (less steps = faster scrolling)."
61
 
    :group workspace
 
67
    "Number of steps for viewport scrolling."
 
68
    :group (workspace viewport)
62
69
    :type number
63
70
    :range (1 . 50))
64
71
 
65
72
  (defcustom viewport-boundary-mode 'stop
66
 
    "Wether to stop or wrap-around on first/last viewport"
67
 
     :group workspace
 
73
    "Whether to stop or wrap-around on first/last viewport"
 
74
    :group (workspace viewport)
68
75
    :type (choice wrap-around stop))
69
76
 
70
77
;;; raw viewport handling
139
146
  (define (select-workspace-and-viewport space col row)
140
147
    (select-workspace space nil (lambda ()
141
148
                                  (set-screen-viewport col row))))
142
 
  
 
149
 
143
150
  ;; returns t if it actually moved the viewport
144
151
  (define (move-viewport right down)
145
152
    (let ((port (screen-viewport)))
236
243
    #:spec "NX:\nNY:"
237
244
    #:type `(and (labelled ,(_ "Column:") (number 1))
238
245
                 (labelled ,(_ "Row:") (number 1)))
239
 
    #:class 'viewport)
 
246
    #:class 'default)
240
247
 
241
248
  (define (activate-viewport-column x)
242
249
    "Select the specified viewport column."
245
252
  (define-command 'activate-viewport-column activate-viewport-column
246
253
    #:spec "NX:"
247
254
    #:type `(and (labelled ,(_ "Column:") (number 1)))
248
 
    #:class 'viewport)
 
255
    #:class 'default)
249
256
 
250
257
  (define (activate-viewport-row y)
251
258
    "Select the specified viewport row."
254
261
  (define-command 'activate-viewport-row activate-viewport-row
255
262
    #:spec "NY:"
256
263
    #:type `(and (labelled ,(_ "Row:") (number 1)))
257
 
    #:class 'viewport)
 
264
    #:class 'default)
258
265
 
259
266
  (define (move-window-to-viewport x y)
260
267
    "Move the current window to the specified viewport."
263
270
  (define-command 'move-window-to-viewport move-window-to-viewport
264
271
    #:spec "NX:\nNY:"
265
272
    #:type '(and (labelled "X:" (number 1)) (labelled "Y:" (number 1)))
266
 
    #:class 'viewport)
 
273
    #:class 'default)
267
274
 
268
275
  (define (move-viewport-right)
269
276
    "Move the viewport one screen to the right."
310
317
    "Move the window to the viewport above, and switch to that viewport."
311
318
    (move-window-to-viewport-and-move-viewport w 0 -1))
312
319
 
313
 
  (define-command 'move-viewport-right move-viewport-right #:class 'viewport)
314
 
  (define-command 'move-viewport-left move-viewport-left #:class 'viewport)
315
 
  (define-command 'move-viewport-up move-viewport-up #:class 'viewport)
316
 
  (define-command 'move-viewport-down move-viewport-down #:class 'viewport)
317
 
  (define-command 'move-window-right move-window-right #:spec "%W" #:class 'viewport)
318
 
  (define-command 'move-window-left move-window-left #:spec "%W" #:class 'viewport)
319
 
  (define-command 'move-window-up move-window-up #:spec "%W" #:class 'viewport)
320
 
  (define-command 'move-window-down move-window-down #:spec "%W" #:class 'viewport)
 
320
  (define-command 'move-viewport-right move-viewport-right #:class 'default)
 
321
  (define-command 'move-viewport-left move-viewport-left #:class 'default)
 
322
  (define-command 'move-viewport-up move-viewport-up #:class 'default)
 
323
  (define-command 'move-viewport-down move-viewport-down #:class 'default)
 
324
  (define-command 'move-window-right move-window-right #:spec "%W" #:class 'default)
 
325
  (define-command 'move-window-left move-window-left #:spec "%W" #:class 'default)
 
326
  (define-command 'move-window-up move-window-up #:spec "%W" #:class 'default)
 
327
  (define-command 'move-window-down move-window-down #:spec "%W" #:class 'default)
321
328
 
322
329
;;; session management, config
323
330
 
344
351
          (when (window-outside-workspace-p w)
345
352
            (move-window-to-current-viewport w)))
346
353
        (window-put w 'placed t))))
347
 
                             
 
354
 
348
355
  (sm-add-saved-properties 'sticky-viewport)
349
356
  (add-hook 'sm-window-save-functions viewport-saved-state)
350
357
  (add-hook 'sm-restore-window-hook viewport-load-state)