[sawfish] Fixed bug where maximized windows could overlap avoided windows on restart.
- From: Jeremy Hankins <jjhankins src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sawfish] Fixed bug where maximized windows could overlap avoided windows on restart.
- Date: Sun, 15 Aug 2010 00:25:47 +0000 (UTC)
commit 41f6fd24622709e814c3c7c35f90345ea8d37dc1
Author: Jeremy Hankins <nowan nowan org>
Date: Sat Aug 14 19:22:15 2010 -0500
Fixed bug where maximized windows could overlap avoided windows on restart.
Onec this bug was fixed another showed up, where windows maximized in
a viewport other than the current one could end up overlapping windows
that were viewport-sticky and avoid once that viewport became active;
this was fixed as well.
ChangeLog | 6 ++++++
lisp/sawfish/wm/state/maximize.jl | 6 +++---
lisp/sawfish/wm/util/edges.jl | 23 +++++++++++++++++++++--
lisp/sawfish/wm/util/workarea.jl | 31 ++++++++++++++++++++++---------
man/news.texi | 6 ++++++
5 files changed, 58 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 75a7d13..e7e70c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-14 Jeremy Hankins <nowan nowan org>
+ * lisp/sawfish/wm/state/maximize.jl
+ * lisp/sawfish/wm/util/edges.jl
+ * lisp/sawfish/wm/util/workarea.jl: Fixed bug where maximized
+ windows could overlap avoided windows on restart.
+
2010-08-13 Christopher Bratusek <zanghar freenet de>
* src/flippers.c
* lisp/sawfish/wm/ext/edge-flip.jl: make edge-flipping work after
diff --git a/lisp/sawfish/wm/state/maximize.jl b/lisp/sawfish/wm/state/maximize.jl
index c6cec8c..02a70ef 100644
--- a/lisp/sawfish/wm/state/maximize.jl
+++ b/lisp/sawfish/wm/state/maximize.jl
@@ -647,8 +647,6 @@ t")
(vert 'vertical)
(horiz 'horizontal))))))))
- (add-hook 'after-add-window-hook maximize-after-add-window)
-
;; before exiting, return all windows to their unmaximized
;; geometries. But _don't_ change any of the properties (either
;; wm-local or X) that mark the window as being maximized
@@ -675,10 +673,12 @@ t")
(add-hook 'after-initialization-hook
(lambda ()
(map-windows check-if-maximizable)
+ (map-windows maximize-after-add-window)
;; Don't install this hook until after all windows have
;; initially been adopted, to avoid maximizing over
;; avoided windows
- (add-hook 'add-window-hook check-if-maximizable)))
+ (add-hook 'add-window-hook check-if-maximizable)
+ (add-hook 'after-add-window-hook maximize-after-add-window)))
(add-hook 'sm-window-save-functions
(lambda (w)
diff --git a/lisp/sawfish/wm/util/edges.jl b/lisp/sawfish/wm/util/edges.jl
index c4525db..4076e1b 100644
--- a/lisp/sawfish/wm/util/edges.jl
+++ b/lisp/sawfish/wm/util/edges.jl
@@ -52,18 +52,37 @@ The returned lists may contain duplicates, and are unsorted."
(let* ((width (screen-width))
(height (screen-height))
(vp-offset (viewport-offset-coord viewport))
+ (cur-vp (and viewport (screen-viewport)))
+ (x-offset (and viewport (* (screen-width)
+ (- (car viewport)
+ (car cur-vp)))))
+ (y-offset (and viewport (* (screen-height)
+ (- (cdr viewport)
+ (cdr cur-vp)))))
x-edges y-edges)
(map-windows
(lambda (w)
(when (and (window-mapped-p w)
(window-visible-p w)
- (not (window-outside-viewport-p w viewport))
+ (or (window-get w 'sticky-viewport)
+ (not (window-outside-viewport-p w viewport)))
(or with-ignored-windows
(not (window-get w 'ignored)))
(not (memq w windows-to-ignore))
(or (not (listp windows)) (memq w windows)))
(let ((dims (window-frame-dimensions w))
- (coords (window-position w)))
+ (coords (if (and viewport
+ (window-get w 'sticky-viewport)
+ (not (and (equal (car viewport)
+ (car cur-vp))
+ (equal (cdr viewport)
+ (cdr cur-vp)))))
+ ;; Simulate the presence of w in
+ ;; the specified viewport:
+ (let ((pos (window-position w)))
+ (cons (+ (car pos) x-offset)
+ (+ (cdr pos) y-offset)))
+ (window-position w))))
(setq x-edges (cons (list (car coords) (cdr coords)
(+ (cdr coords) (cdr dims)) t)
(cons (list (+ (car coords) (car dims))
diff --git a/lisp/sawfish/wm/util/workarea.jl b/lisp/sawfish/wm/util/workarea.jl
index 16edfc0..156f1af 100644
--- a/lisp/sawfish/wm/util/workarea.jl
+++ b/lisp/sawfish/wm/util/workarea.jl
@@ -66,15 +66,28 @@
;; the rectangle mustn't overlap any avoided windows
;; or span multiple heads, or be on a different head
;; to that requested
- (let loop ((rest avoided))
- (cond ((null rest) (rect-within-head-p rect head))
- ((> (rect-2d-overlap
- (window-frame-dimensions (car rest))
- (window-position (car rest))
- rect)
- 0)
- nil)
- (t (loop (cdr rest))))))
+ (let* ((viewport (viewport-at (nth 0 rect)
+ (nth 1 rect)))
+ (cur-vp (screen-viewport))
+ (x-offset (and viewport (* (screen-width)
+ (- (car viewport)
+ (car cur-vp)))))
+ (y-offset (and viewport (* (screen-height)
+ (- (cdr viewport)
+ (cdr cur-vp))))))
+ (let loop ((rest avoided))
+ (cond ((null rest) (rect-within-head-p rect head))
+ ((> (rect-2d-overlap
+ (window-frame-dimensions (car rest))
+ (let ((pos (window-position (car rest))))
+ (if (window-get (car rest) 'sticky-viewport)
+ (cons (+ (car pos) x-offset)
+ (+ (cdr pos) y-offset))
+ pos))
+ rect)
+ 0)
+ nil)
+ (t (loop (cdr rest)))))))
(let* ((grid (grid-from-edges (car edges) (cdr edges)))
;; find all possible rectangles
diff --git a/man/news.texi b/man/news.texi
index 7a2d8f9..464ba3f 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -45,6 +45,12 @@ See the item ``Keyboard layout switching support'' below.
@item Bug Fixes
@itemize @minus
+ item Maximized windows overlapping avoided windows bugfix
+
+Sometimes maximized windows would overlap avoided windows (e.g., the
+gnome taskbar, or a trayer) on restart. Sawfish now waits until
+initialization is complete to maximize windows, preventing this problem.
+
@item Viewport initialization bugfix
Under certain circumstances windows could end up outside of the
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]