Japanese translation of message catalog for Sawfish Window-Manager
修订版 | 1704c49f5dd21c73d74f6d443212b4c6cd95b103 (tree) |
---|---|
时间 | 1999-07-26 00:01:15 |
作者 | john <john> |
Commiter | john |
now obeys most of the window's size hints (all but the aspect ratios)
@@ -6,108 +6,140 @@ | ||
6 | 6 | ;; todo: |
7 | 7 | ;; * obey the size hints (min/max and increments) |
8 | 8 | ;; * resize has truly bizarre behaviour |
9 | -;; * opaque modes | |
10 | 9 | |
11 | -(defvar move-outline-mode nil) | |
12 | -(defvar resize-outline-mode nil) | |
10 | +(defvar move-outline-mode 'opaque) | |
11 | +(defvar resize-outline-mode 'opaque) | |
13 | 12 | |
14 | 13 | (defvar move-resize-map (bind-keys (make-sparse-keymap) |
15 | 14 | "Any-PointerUp" 'move-resize-finished |
16 | 15 | "Any-PointerMove" 'move-resize-motion)) |
17 | 16 | |
17 | +(defvar move-resize-raise-window nil) | |
18 | + | |
18 | 19 | ;; specials |
19 | 20 | (defvar move-resize-window nil) |
20 | 21 | (defvar move-resize-function nil) |
21 | -(defvar move-resize-last-x nil) | |
22 | -(defvar move-resize-last-y nil) | |
23 | -(defvar move-resize-last-width nil) | |
24 | -(defvar move-resize-last-height nil) | |
25 | -(defvar move-resize-last-ptr-x nil) | |
26 | -(defvar move-resize-last-ptr-y nil) | |
22 | +(defvar move-resize-x nil) | |
23 | +(defvar move-resize-y nil) | |
24 | +(defvar move-resize-width nil) | |
25 | +(defvar move-resize-height nil) | |
26 | +(defvar move-resize-old-x nil) | |
27 | +(defvar move-resize-old-y nil) | |
28 | +(defvar move-resize-old-width nil) | |
29 | +(defvar move-resize-old-height nil) | |
30 | +(defvar move-resize-old-ptr-x nil) | |
31 | +(defvar move-resize-old-ptr-y nil) | |
32 | +(defvar move-resize-mode nil) | |
33 | +(defvar move-resize-hints nil) | |
34 | +(defvar move-resize-frame nil) | |
27 | 35 | |
28 | 36 | (defun move-resize-window (w function) |
29 | - ;; prevent any other programs drawing on the display | |
30 | - (grab-server) | |
31 | - (unwind-protect | |
32 | - (progn | |
33 | - ;; ensure that we catch _all_ mouse events | |
34 | - (grab-pointer w) | |
35 | - (unwind-protect | |
36 | - (progn | |
37 | - (let | |
38 | - ((override-keymap move-resize-map) | |
39 | - (move-resize-window w) | |
40 | - (move-resize-function function) | |
41 | - (move-resize-last-x (car (window-position w))) | |
42 | - (move-resize-last-y (cdr (window-position w))) | |
43 | - (move-resize-last-width (car (window-frame-dimensions w))) | |
44 | - (move-resize-last-height (cdr (window-frame-dimensions w))) | |
45 | - (move-resize-last-ptr-x (car (query-pointer))) | |
46 | - (move-resize-last-ptr-y (cdr (query-pointer)))) | |
47 | - (draw-window-outline (if (eq function 'move) | |
48 | - move-outline-mode | |
49 | - resize-outline-mode) | |
50 | - move-resize-last-x | |
51 | - move-resize-last-y | |
52 | - move-resize-last-width | |
53 | - move-resize-last-height) | |
37 | + (when move-resize-raise-window | |
38 | + (raise-window w)) | |
39 | + (let* | |
40 | + ((override-keymap move-resize-map) | |
41 | + (move-resize-window w) | |
42 | + (move-resize-function function) | |
43 | + (move-resize-old-x (car (window-position w))) | |
44 | + (move-resize-old-y (cdr (window-position w))) | |
45 | + (move-resize-old-width (car (window-dimensions w))) | |
46 | + (move-resize-old-height (cdr (window-dimensions w))) | |
47 | + (move-resize-x move-resize-old-x) | |
48 | + (move-resize-y move-resize-old-y) | |
49 | + (move-resize-width move-resize-old-width) | |
50 | + (move-resize-height move-resize-old-height) | |
51 | + (move-resize-old-ptr-x (car (query-pointer))) | |
52 | + (move-resize-old-ptr-y (cdr (query-pointer))) | |
53 | + (move-resize-hints (window-size-hints w)) | |
54 | + (move-resize-frame (cons (- (car (window-frame-dimensions w)) | |
55 | + move-resize-old-width) | |
56 | + (- (cdr (window-frame-dimensions w)) | |
57 | + move-resize-old-height))) | |
58 | + (move-resize-mode (if (eq function 'move) | |
59 | + move-outline-mode | |
60 | + resize-outline-mode))) | |
61 | + (unless (eq move-resize-mode 'opaque) | |
62 | + ;; prevent any other programs drawing on the display | |
63 | + (grab-server)) | |
64 | + (unwind-protect | |
65 | + (progn | |
66 | + ;; ensure that we catch _all_ mouse events | |
67 | + (grab-pointer w) | |
68 | + (unwind-protect | |
69 | + (progn | |
70 | + (unless (eq move-resize-mode 'opaque) | |
71 | + (draw-window-outline move-resize-mode | |
72 | + move-resize-x move-resize-y | |
73 | + (+ move-resize-width | |
74 | + (car move-resize-frame)) | |
75 | + (+ move-resize-height | |
76 | + (cdr move-resize-frame)))) | |
54 | 77 | (catch 'move-resize-done |
55 | 78 | (recursive-edit)))) |
56 | 79 | (ungrab-pointer))) |
57 | - (ungrab-server))) | |
80 | + (unless (eq move-resize-mode 'opaque) | |
81 | + (ungrab-server)))) | |
82 | + | |
83 | +(defsubst move-resize-roundup (x inc base) | |
84 | + (+ base (max 0 (* (1+ (/ (1- (- x base)) inc)) inc)))) | |
58 | 85 | |
59 | 86 | (defun move-resize-motion () |
60 | 87 | (interactive) |
61 | 88 | (let |
62 | 89 | ((ptr-x (car (query-pointer))) |
63 | 90 | (ptr-y (cdr (query-pointer)))) |
64 | - (when (or (/= ptr-x move-resize-last-ptr-x) | |
65 | - (/= ptr-y move-resize-last-ptr-y)) | |
91 | + (unless (eq move-resize-mode 'opaque) | |
66 | 92 | (erase-window-outline (if (eq move-resize-function 'move) |
67 | 93 | move-outline-mode |
68 | 94 | resize-outline-mode) |
69 | - move-resize-last-x | |
70 | - move-resize-last-y | |
71 | - move-resize-last-width | |
72 | - move-resize-last-height) | |
73 | - (cond ((eq move-resize-function 'move) | |
74 | - (setq move-resize-last-x (+ move-resize-last-x | |
75 | - (- ptr-x move-resize-last-ptr-x))) | |
76 | - (setq move-resize-last-y (+ move-resize-last-y | |
77 | - (- ptr-y move-resize-last-ptr-y)))) | |
78 | - ((eq move-resize-function 'resize) | |
79 | - (setq move-resize-last-width | |
80 | - (max 0 (+ move-resize-last-width | |
81 | - (- ptr-x move-resize-last-ptr-x)))) | |
82 | - (setq move-resize-last-height | |
83 | - (max 0 (+ move-resize-last-height | |
84 | - (- ptr-y move-resize-last-ptr-y)))))) | |
85 | - (setq move-resize-last-ptr-x ptr-x) | |
86 | - (setq move-resize-last-ptr-y ptr-y) | |
95 | + move-resize-x move-resize-y | |
96 | + (+ move-resize-width (car move-resize-frame)) | |
97 | + (+ move-resize-height (cdr move-resize-frame)))) | |
98 | + (cond ((eq move-resize-function 'move) | |
99 | + (setq move-resize-x (+ move-resize-old-x | |
100 | + (- ptr-x move-resize-old-ptr-x))) | |
101 | + (setq move-resize-y (+ move-resize-old-y | |
102 | + (- ptr-y move-resize-old-ptr-y)))) | |
103 | + ((eq move-resize-function 'resize) | |
104 | + (setq move-resize-width | |
105 | + (move-resize-roundup | |
106 | + (+ move-resize-old-width (- ptr-x move-resize-old-ptr-x)) | |
107 | + (or (cdr (assq 'width-inc move-resize-hints)) 1) | |
108 | + (or (cdr (or (assq 'base-width move-resize-hints) | |
109 | + (assq 'min-width move-resize-hints))) 1))) | |
110 | + (setq move-resize-height | |
111 | + (move-resize-roundup | |
112 | + (+ move-resize-old-height (- ptr-y move-resize-old-ptr-y)) | |
113 | + (or (cdr (assq 'height-inc move-resize-hints)) 1) | |
114 | + (or (cdr (or (assq 'base-height move-resize-hints) | |
115 | + (assq 'min-height move-resize-hints))) 1))))) | |
116 | + (if (eq move-resize-mode 'opaque) | |
117 | + (move-resize-apply) | |
87 | 118 | (draw-window-outline (if (eq move-resize-function 'move) |
88 | 119 | move-outline-mode |
89 | 120 | resize-outline-mode) |
90 | - move-resize-last-x | |
91 | - move-resize-last-y | |
92 | - move-resize-last-width | |
93 | - move-resize-last-height)))) | |
121 | + move-resize-x move-resize-y | |
122 | + (+ move-resize-width (car move-resize-frame)) | |
123 | + (+ move-resize-height (cdr move-resize-frame)))))) | |
94 | 124 | |
95 | 125 | (defun move-resize-finished () |
96 | 126 | (interactive) |
97 | - (erase-window-outline (if (eq move-resize-function 'move) | |
98 | - move-outline-mode | |
99 | - resize-outline-mode) | |
100 | - move-resize-last-x | |
101 | - move-resize-last-y | |
102 | - move-resize-last-width | |
103 | - move-resize-last-height) | |
127 | + (unless (eq move-resize-mode 'opaque) | |
128 | + (erase-window-outline (if (eq move-resize-function 'move) | |
129 | + move-outline-mode | |
130 | + resize-outline-mode) | |
131 | + move-resize-x move-resize-y | |
132 | + (+ move-resize-width (car move-resize-frame)) | |
133 | + (+ move-resize-height (cdr move-resize-frame)))) | |
134 | + (move-resize-apply) | |
135 | + (throw 'move-resize-done t)) | |
136 | + | |
137 | +(defun move-resize-apply () | |
104 | 138 | (cond ((eq move-resize-function 'move) |
105 | - (move-window-to move-resize-window | |
106 | - move-resize-last-x move-resize-last-y)) | |
139 | + (move-window-to move-resize-window move-resize-x move-resize-y)) | |
107 | 140 | ((eq move-resize-function 'resize) |
108 | 141 | (resize-window-to move-resize-window |
109 | - move-resize-last-width move-resize-last-height))) | |
110 | - (throw 'move-resize-done t)) | |
142 | + move-resize-width move-resize-height)))) | |
111 | 143 | |
112 | 144 | |
113 | 145 | ;; Entry points |
@@ -6,108 +6,140 @@ | ||
6 | 6 | ;; todo: |
7 | 7 | ;; * obey the size hints (min/max and increments) |
8 | 8 | ;; * resize has truly bizarre behaviour |
9 | -;; * opaque modes | |
10 | 9 | |
11 | -(defvar move-outline-mode nil) | |
12 | -(defvar resize-outline-mode nil) | |
10 | +(defvar move-outline-mode 'opaque) | |
11 | +(defvar resize-outline-mode 'opaque) | |
13 | 12 | |
14 | 13 | (defvar move-resize-map (bind-keys (make-sparse-keymap) |
15 | 14 | "Any-PointerUp" 'move-resize-finished |
16 | 15 | "Any-PointerMove" 'move-resize-motion)) |
17 | 16 | |
17 | +(defvar move-resize-raise-window nil) | |
18 | + | |
18 | 19 | ;; specials |
19 | 20 | (defvar move-resize-window nil) |
20 | 21 | (defvar move-resize-function nil) |
21 | -(defvar move-resize-last-x nil) | |
22 | -(defvar move-resize-last-y nil) | |
23 | -(defvar move-resize-last-width nil) | |
24 | -(defvar move-resize-last-height nil) | |
25 | -(defvar move-resize-last-ptr-x nil) | |
26 | -(defvar move-resize-last-ptr-y nil) | |
22 | +(defvar move-resize-x nil) | |
23 | +(defvar move-resize-y nil) | |
24 | +(defvar move-resize-width nil) | |
25 | +(defvar move-resize-height nil) | |
26 | +(defvar move-resize-old-x nil) | |
27 | +(defvar move-resize-old-y nil) | |
28 | +(defvar move-resize-old-width nil) | |
29 | +(defvar move-resize-old-height nil) | |
30 | +(defvar move-resize-old-ptr-x nil) | |
31 | +(defvar move-resize-old-ptr-y nil) | |
32 | +(defvar move-resize-mode nil) | |
33 | +(defvar move-resize-hints nil) | |
34 | +(defvar move-resize-frame nil) | |
27 | 35 | |
28 | 36 | (defun move-resize-window (w function) |
29 | - ;; prevent any other programs drawing on the display | |
30 | - (grab-server) | |
31 | - (unwind-protect | |
32 | - (progn | |
33 | - ;; ensure that we catch _all_ mouse events | |
34 | - (grab-pointer w) | |
35 | - (unwind-protect | |
36 | - (progn | |
37 | - (let | |
38 | - ((override-keymap move-resize-map) | |
39 | - (move-resize-window w) | |
40 | - (move-resize-function function) | |
41 | - (move-resize-last-x (car (window-position w))) | |
42 | - (move-resize-last-y (cdr (window-position w))) | |
43 | - (move-resize-last-width (car (window-frame-dimensions w))) | |
44 | - (move-resize-last-height (cdr (window-frame-dimensions w))) | |
45 | - (move-resize-last-ptr-x (car (query-pointer))) | |
46 | - (move-resize-last-ptr-y (cdr (query-pointer)))) | |
47 | - (draw-window-outline (if (eq function 'move) | |
48 | - move-outline-mode | |
49 | - resize-outline-mode) | |
50 | - move-resize-last-x | |
51 | - move-resize-last-y | |
52 | - move-resize-last-width | |
53 | - move-resize-last-height) | |
37 | + (when move-resize-raise-window | |
38 | + (raise-window w)) | |
39 | + (let* | |
40 | + ((override-keymap move-resize-map) | |
41 | + (move-resize-window w) | |
42 | + (move-resize-function function) | |
43 | + (move-resize-old-x (car (window-position w))) | |
44 | + (move-resize-old-y (cdr (window-position w))) | |
45 | + (move-resize-old-width (car (window-dimensions w))) | |
46 | + (move-resize-old-height (cdr (window-dimensions w))) | |
47 | + (move-resize-x move-resize-old-x) | |
48 | + (move-resize-y move-resize-old-y) | |
49 | + (move-resize-width move-resize-old-width) | |
50 | + (move-resize-height move-resize-old-height) | |
51 | + (move-resize-old-ptr-x (car (query-pointer))) | |
52 | + (move-resize-old-ptr-y (cdr (query-pointer))) | |
53 | + (move-resize-hints (window-size-hints w)) | |
54 | + (move-resize-frame (cons (- (car (window-frame-dimensions w)) | |
55 | + move-resize-old-width) | |
56 | + (- (cdr (window-frame-dimensions w)) | |
57 | + move-resize-old-height))) | |
58 | + (move-resize-mode (if (eq function 'move) | |
59 | + move-outline-mode | |
60 | + resize-outline-mode))) | |
61 | + (unless (eq move-resize-mode 'opaque) | |
62 | + ;; prevent any other programs drawing on the display | |
63 | + (grab-server)) | |
64 | + (unwind-protect | |
65 | + (progn | |
66 | + ;; ensure that we catch _all_ mouse events | |
67 | + (grab-pointer w) | |
68 | + (unwind-protect | |
69 | + (progn | |
70 | + (unless (eq move-resize-mode 'opaque) | |
71 | + (draw-window-outline move-resize-mode | |
72 | + move-resize-x move-resize-y | |
73 | + (+ move-resize-width | |
74 | + (car move-resize-frame)) | |
75 | + (+ move-resize-height | |
76 | + (cdr move-resize-frame)))) | |
54 | 77 | (catch 'move-resize-done |
55 | 78 | (recursive-edit)))) |
56 | 79 | (ungrab-pointer))) |
57 | - (ungrab-server))) | |
80 | + (unless (eq move-resize-mode 'opaque) | |
81 | + (ungrab-server)))) | |
82 | + | |
83 | +(defsubst move-resize-roundup (x inc base) | |
84 | + (+ base (max 0 (* (1+ (/ (1- (- x base)) inc)) inc)))) | |
58 | 85 | |
59 | 86 | (defun move-resize-motion () |
60 | 87 | (interactive) |
61 | 88 | (let |
62 | 89 | ((ptr-x (car (query-pointer))) |
63 | 90 | (ptr-y (cdr (query-pointer)))) |
64 | - (when (or (/= ptr-x move-resize-last-ptr-x) | |
65 | - (/= ptr-y move-resize-last-ptr-y)) | |
91 | + (unless (eq move-resize-mode 'opaque) | |
66 | 92 | (erase-window-outline (if (eq move-resize-function 'move) |
67 | 93 | move-outline-mode |
68 | 94 | resize-outline-mode) |
69 | - move-resize-last-x | |
70 | - move-resize-last-y | |
71 | - move-resize-last-width | |
72 | - move-resize-last-height) | |
73 | - (cond ((eq move-resize-function 'move) | |
74 | - (setq move-resize-last-x (+ move-resize-last-x | |
75 | - (- ptr-x move-resize-last-ptr-x))) | |
76 | - (setq move-resize-last-y (+ move-resize-last-y | |
77 | - (- ptr-y move-resize-last-ptr-y)))) | |
78 | - ((eq move-resize-function 'resize) | |
79 | - (setq move-resize-last-width | |
80 | - (max 0 (+ move-resize-last-width | |
81 | - (- ptr-x move-resize-last-ptr-x)))) | |
82 | - (setq move-resize-last-height | |
83 | - (max 0 (+ move-resize-last-height | |
84 | - (- ptr-y move-resize-last-ptr-y)))))) | |
85 | - (setq move-resize-last-ptr-x ptr-x) | |
86 | - (setq move-resize-last-ptr-y ptr-y) | |
95 | + move-resize-x move-resize-y | |
96 | + (+ move-resize-width (car move-resize-frame)) | |
97 | + (+ move-resize-height (cdr move-resize-frame)))) | |
98 | + (cond ((eq move-resize-function 'move) | |
99 | + (setq move-resize-x (+ move-resize-old-x | |
100 | + (- ptr-x move-resize-old-ptr-x))) | |
101 | + (setq move-resize-y (+ move-resize-old-y | |
102 | + (- ptr-y move-resize-old-ptr-y)))) | |
103 | + ((eq move-resize-function 'resize) | |
104 | + (setq move-resize-width | |
105 | + (move-resize-roundup | |
106 | + (+ move-resize-old-width (- ptr-x move-resize-old-ptr-x)) | |
107 | + (or (cdr (assq 'width-inc move-resize-hints)) 1) | |
108 | + (or (cdr (or (assq 'base-width move-resize-hints) | |
109 | + (assq 'min-width move-resize-hints))) 1))) | |
110 | + (setq move-resize-height | |
111 | + (move-resize-roundup | |
112 | + (+ move-resize-old-height (- ptr-y move-resize-old-ptr-y)) | |
113 | + (or (cdr (assq 'height-inc move-resize-hints)) 1) | |
114 | + (or (cdr (or (assq 'base-height move-resize-hints) | |
115 | + (assq 'min-height move-resize-hints))) 1))))) | |
116 | + (if (eq move-resize-mode 'opaque) | |
117 | + (move-resize-apply) | |
87 | 118 | (draw-window-outline (if (eq move-resize-function 'move) |
88 | 119 | move-outline-mode |
89 | 120 | resize-outline-mode) |
90 | - move-resize-last-x | |
91 | - move-resize-last-y | |
92 | - move-resize-last-width | |
93 | - move-resize-last-height)))) | |
121 | + move-resize-x move-resize-y | |
122 | + (+ move-resize-width (car move-resize-frame)) | |
123 | + (+ move-resize-height (cdr move-resize-frame)))))) | |
94 | 124 | |
95 | 125 | (defun move-resize-finished () |
96 | 126 | (interactive) |
97 | - (erase-window-outline (if (eq move-resize-function 'move) | |
98 | - move-outline-mode | |
99 | - resize-outline-mode) | |
100 | - move-resize-last-x | |
101 | - move-resize-last-y | |
102 | - move-resize-last-width | |
103 | - move-resize-last-height) | |
127 | + (unless (eq move-resize-mode 'opaque) | |
128 | + (erase-window-outline (if (eq move-resize-function 'move) | |
129 | + move-outline-mode | |
130 | + resize-outline-mode) | |
131 | + move-resize-x move-resize-y | |
132 | + (+ move-resize-width (car move-resize-frame)) | |
133 | + (+ move-resize-height (cdr move-resize-frame)))) | |
134 | + (move-resize-apply) | |
135 | + (throw 'move-resize-done t)) | |
136 | + | |
137 | +(defun move-resize-apply () | |
104 | 138 | (cond ((eq move-resize-function 'move) |
105 | - (move-window-to move-resize-window | |
106 | - move-resize-last-x move-resize-last-y)) | |
139 | + (move-window-to move-resize-window move-resize-x move-resize-y)) | |
107 | 140 | ((eq move-resize-function 'resize) |
108 | 141 | (resize-window-to move-resize-window |
109 | - move-resize-last-width move-resize-last-height))) | |
110 | - (throw 'move-resize-done t)) | |
142 | + move-resize-width move-resize-height)))) | |
111 | 143 | |
112 | 144 | |
113 | 145 | ;; Entry points |