| Browse all patches |
Author[]
Fuchur
Synopsis[]
This patch fix window placement with multihead setup. Look here
Patch[]
diff -urNad sawfish.orgi/lisp/sawfish/wm/misc.jl sawfish/lisp/sawfish/wm/misc.jl --- sawfish.orgi/lisp/sawfish/wm/misc.jl 2007-12-01 13:37:04.000000000 +0100 +++ sawfish/lisp/sawfish/wm/misc.jl 2007-12-01 13:40:45.000000000 +0100 @@ -119,29 +119,34 @@ (define (current-head #!optional (w (input-focus))) "Return the id of the `current' head." - (or (and w (let ((point (window-position w)) - (dims (window-dimensions w))) - (find-head (+ (car point) (quotient (car dims) 2)) - (+ (cdr point) (quotient (cdr dims) 2))))) - (pointer-head))) + (require 'sawfish.wm.windows) + (if (not (desktop-window-p w)) + (or (and w (let ((point (window-position w)) + (dims (window-dimensions w))) + (find-head (+ (car point) (quotient (car dims) 2)) + (+ (cdr point) (quotient (cdr dims) 2))))) + (pointer-head)) + (pointer-head))) -(define (current-head-dimensions #!optional w) +(define (current-head-dimensions #!optional (w (input-focus))) "Return a cons-cell defining the size in pixels of the current head (that -containing the window W, or the pointer if W is false). Returns the screen -dimensions if no such head can be identified." - (let ((head (current-head w))) - (if head - (head-dimensions head) - (screen-dimensions)))) +containing the window W, or containing the window with input focus if W is +false). Returns the screen dimensions if no such head can be identified." + (or (and w (let ((head (current-head w))) + (if head + (head-dimensions head) + (screen-dimensions)))) + (head-dimensions (pointer-head)))) -(define (current-head-offset #!optional w) +(define (current-head-offset #!optional (w (input-focus))) "Return a cons-cell defining the origin of the current head (that -containing the window W, or the pointer if W is false). Returns '(0 . 0) -if no such head can be identified." - (let ((head (current-head w))) - (if head - (head-offset head) - (cons 0 0)))) +containing the window W, or containing the window with input focus if W is +false). Returns '(0 . 0) if no such head can be identified." + (or (and w (let ((head (current-head w))) + (if head + (head-offset head) + (cons 0 0)))) + (head-offset (pointer-head)))) (define (load-module name) "Ensure that the module called NAME has been loaded. Note that this does diff -urNad sawfish.orgi/lisp/sawfish/wm/placement/top-left.jl sawfish/lisp/sawfish/wm/placement/top-left.jl --- sawfish.orgi/lisp/sawfish/wm/placement/top-left.jl 2007-12-01 13:37:04.000000000 +0100 +++ sawfish/lisp/sawfish/wm/placement/top-left.jl 2007-12-01 13:41:12.000000000 +0100 @@ -86,7 +86,7 @@ (t (loop (next-position point)))))) (define (place-window-top-left w) - (let* ((workarea (calculate-workarea #:window w)) + (let* ((workarea (calculate-workarea #:window w #:head (current-head))) (dims (window-dimensions w)) (f-dims (window-frame-dimensions w)) (hints (window-size-hints w)) diff -urNad sawfish.orgi/lisp/sawfish/wm/placement.jl sawfish/lisp/sawfish/wm/placement.jl --- sawfish.orgi/lisp/sawfish/wm/placement.jl 2007-12-01 13:37:04.000000000 +0100 +++ sawfish/lisp/sawfish/wm/placement.jl 2007-12-01 13:41:29.000000000 +0100 @@ -210,6 +210,6 @@ (define-placement-mode 'randomly place-window-randomly #:for-normal t #:for-dialogs t) (define-placement-mode 'interactively place-window-interactively #:for-normal t) (define-placement-mode 'centered place-window-centered #:for-normal t #:for-dialogs t) - (define-placement-mode 'centered-on-parent place-window-centered-on-parent #:for-dialogs t) - (define-placement-mode 'under-pointer place-window-under-pointer #:for-dialogs t) + (define-placement-mode 'centered-on-parent place-window-centered-on-parent #:for-normal t #:for-dialogs t) + (define-placement-mode 'under-pointer place-window-under-pointer #:for-normal t #:for-dialogs t) (define-placement-mode 'none nop #:for-normal t #:for-dialogs t))
Community's reasons for inclusion or rejection[]
vote: pondering. I have dualhead also, and I can reproduce the bad behaviour you explained in this post so I'm eager to apply it. But I prefer some other's people opinion on how invasive this patch is, because I am in no good position to judge this. Janek Kozicki 00:08, 19 January 2008 (UTC)
- I will try to explain what happens with xinerame setup without the patch.
In function current-head: If you use e.g. nautilus to draw the desktop and you click on a desktop icon, function current-head calculated with the complete nautilus/desktop root window by var window-dimensions. If the right screen have 1280x1024 and the left 1280x1024 then (2560 . 1024) is use for the var window-dimensions. Var find-head in function current-head returns so always 1. It is difficult to explain (for me) but you can test it with: sawfish-client -e "(current-head (select-window))" and click on your desktop if you have two Heads with the same geometry and nautilus running it always returns 1. In function current-head-dimensions and current-head-offset: It returns current-head-dimensions and current-head-offset from head were the pointer is: Open an shell type in the shell: sawfish-client -e "(current-head-offset)" move your mouse to a other head as the shell and press enter. It returns by current-head-dimensions or current-head-offset from head where the pointer is. The patch fix this and windows now will placed correctly. I have test it with one head, with xinerame, no xinerama and twinview with two heads and it works but it is my first lisp code/patch. I hope my patch is better as my english :). fuchur
vote: yes. ok, patch accepted with improved function comments by Andrea Vettorello. Thanks a lot Janek Kozicki 16:40, 20 January 2008 (UTC)