|Browse all patches|
Fernando Carmona Varo (script by Andreas Bombe)
This patch is based on Scrolling-viewport-switches script. It adds an option for switching viewports by moving a number of steps.
The original script does not work, as it needs viewport.jlc to be reloaded (and reloading it unsets the script changes). So I thought it would be better to make a patch for it to make it work, being integrated. I also modified it a bit for slightly better performance (previously it was doing 2 unneeded calls).
The maximum number of steps (slowest scroll) is set to 100. In my computer 100 is slow (well.. as intended) but works fine. However, it is maybe possible that older computers have problems, so maybe it's a good idea to test it and set a better number. The same can go for the default steps (5), I don't know if the feature would better be disabled by default (setting it to 1).
Patch testing Edit
- Copy/paste the patch listed below into some file, eg.
- If you don't have sawfish sources yet, have one, as described get it from GIT repo.
- Go into the directory where sawfish sources reside, eg.
- Test if the patch applies cleanly with this command:
patch -p1 --ignore-whitespace --dry-run < TEST.diffin case of problems try also:
- If it applies cleanly, then remove the
--dry-runfrom above command and run it again, otherwise ask on the mailing list.
- Compile sawfish:
./autogen.sh && make
- Install it for testing, but it depends on your linux distribution.
- It is always better to install sawfish as your distribution package, but it is different for each distribution.
- So you may try
make install, which will install sawifish in
/usr/local/share/sawfish/(if you have write access). But then make sure that you run the correct version and delete it from that directory afterwards, to avoid any conflicts.
- Se also
PS: edit this template if you feel that those instructions can be improved.
Index: lisp/sawfish/wm/viewport.jl =================================================================== --- lisp/sawfish/wm/viewport.jl (revision 4269) +++ lisp/sawfish/wm/viewport.jl (working copy) @@ -56,13 +56,20 @@ (defvar uniconify-to-current-viewport t "Windows uniconify to the current viewport.") + (defcustom scroll-viewport-steps 1 + "Number of steps in which to scroll between viewports (less steps = faster scrolling)." + :group workspace + :type number + :range (1 . 50)) + � ;;; raw viewport handling (defvar viewport-x-offset 0) (defvar viewport-y-offset 0) - (define (set-viewport x y) + (define (warp-viewport x y) + "Change view by incrementing the coordinates of the x,y position." ;; move W to its new position (define (move-window w) (unless (window-get w 'sticky-viewport) @@ -89,9 +96,21 @@ (t (loop (cdr rest) (cons (car rest) inside) outside)))) (setq viewport-x-offset x) - (setq viewport-y-offset y) - (call-hook 'viewport-moved-hook))) + (setq viewport-y-offset y))) + (define (set-viewport x y) + "Scroll viewport view by incrementing the coordinates of the x,y position. +The scrolling makes a number of increments equal to `scroll-viewport-steps'." + (unless (= scroll-viewport-steps 1) ; fast skip if scroll is unwanted + (let* ((xstep (quotient (- x viewport-x-offset) scroll-viewport-steps)) + (ystep (quotient (- y viewport-y-offset) scroll-viewport-steps)) + (step-count (if (= xstep ystep 0) 0 scroll-viewport-steps))) + (while (> step-count 1) + (warp-viewport (+ viewport-x-offset xstep) (+ viewport-y-offset ystep)) + (setq step-count (1- step-count))))) + (warp-viewport x y) + (call-hook 'viewport-moved-hook)) + (define (viewport-before-exiting) (set-screen-viewport 0 0))
Community's reasons for inclusion or rejection Edit
Patch submitters, please vote also! Yes, obviosuly your vote will be positive, but it's the place to give your explanation why this patch is good for all Sawfish users, and why it is correct - good reasons for inclusion.
When voting anonymously please write your name, so that it can be associated with your posts on the mailing list. If you are logged in you can sign yourself by typing four tilda characters: ~~~~.
- Please vote with: vote: yes., vote: no., vote: let's try in experimental., vote: pondering. or wait for next release.
- vote: yes. Author's vote: I like this feature, it's really a nice animation and works very fast and nice at few steps. But first I want to hear feedback since I'm not sure how would work this on other machines. -Ferk(talk!) 05:42, 8 August 2008 (UTC)
- vote: yes.. The patch did not apply on trunk on my system. I updated it, so that it does. Works perfect! Flashrider [Christopher Bratusek] 07:22, 8 August 2008 (UTC)
- vote: pondering. It works without problems and is really fun. I'm not sure if it's efficient for real work ─ mostly depends on personal taste :) I think that it must be disabled by default, and let users play with it when they find this option. Usually when I work, I have 200+ windows open, on 10x4 viewports, and sometimes under high system load (some calculations going on, etc...) switching between viewports can become really slow. My vote is YES if there is no performance drop with this feature disabled. I can't tell about performance just by looking at the code, because I'm bad at lisp. Maybe for example a single test if steps==1 is true and then doing all the rest would be enough to avoid any drop on performance with the feature disabled? Basically I would like to have it in sawfish, but I really don't want to lose any performance. Janek Kozicki 19:20, 9 August 2008 (UTC)
- Agreed, it does makes sense. I've changed the default to 1 and the max limit to 50 (better to be sure it's safe, and 50 is more than enough). I've also changed the code a bit. Previously it was doing only few arithmetics before testing, but I think it is fair to have a first test for a fast skipping. I've changed my vote to yes. -Ferk(talk!) 03:33, 10 August 2008 (UTC)
- vote: let's try in experimental. Patch added to experimental branch, for testing. Janek Kozicki 15:49, 17 September 2008 (UTC)
- vote: yes. I'm using it for a long time now, it's pretty cool, and does not really slow down. ... Normally I don't have more than 6 windows open. Using 1 step as default is ok, this is not really animated and does not need many cpu-cycles. commited rev4299 Flashrider [Christopher Bratusek] 21:03, 18 November 2008 (UTC)