|Browse all patches|
Author[edit | edit source]
Fernando Carmona Varo <firstname.lastname@example.org>
Synopsis[edit | edit source]
This adds two new window hooks: 'after-raise-window-hook' and 'after-lower-window-hook' which are called at the end of raise-window and lower-window respectively.
I've been looking at the code and I think all functions related to raise/lower to top/bottom depend on this two functions, so I think this is the right place for the hook.
It should be noted, however, that this hooks wont be called if the depth of the windows is modified slightly by other means (not really raising to the top nor lowering to the bottom). But I think this is ok, since raising and lowering are commands that trigger other operations (like changing the depth of transients/group) and this is consistent with it.
UPDATE: I've remade the patch properly (using svn diff), and added before- hooks (I think this are in fact better for other purpose).
Patch testing[edit | edit source]
- 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.
Patch[edit | edit source]
Index: lisp/sawfish/wm/stacking.jl =================================================================== --- lisp/sawfish/wm/stacking.jl (revision 4269) +++ lisp/sawfish/wm/stacking.jl (working copy) @@ -64,13 +64,28 @@ (let ((tem (gensym))) `(let ((,tem (stacking-order))) (unwind-protect - (progn ,@forms) - (restack-windows ,tem))))) + (progn ,@forms) + (restack-windows ,tem))))) + (defvar before-raise-window-hook '() + "List of functions called before a window is raised. Each is called +with the raised window as arg.") + + (defvar before-lower-window-hook '() + "List of functions called before a window is lowered. Each is called +with the lowered window as arg.") + + (defvar after-raise-window-hook '() + "List of functions called after a window is raised. Each is called +with the raised window as arg.") + + (defvar after-lower-window-hook '() + "List of functions called after a window is lowered. Each is called +with the lowered window as arg.") + ;; this will always return an integer (define (window-depth w) (window-get w 'depth)) -� ;;; constraint mechanics (predicates actually..) (define (stacking-constraint:layer w) @@ -213,6 +228,7 @@ (define (raise-window w) "Raise the window to its highest allowed position in the stacking order." + (call-window-hook 'before-raise-window-hook w) ;; work downwards from top (let ((constraint (make-constraint w)) (stack (cons '() (delq w (stacking-order))))) @@ -226,10 +242,12 @@ nil) (t (stack-rotate-downwards stack) - (loop)))))) + (loop))))) + (call-window-hook 'after-raise-window-hook w)) (define (lower-window w) "Lower the window to its lowest allowed position in the stacking order." + (call-window-hook 'before-lower-window-hook w) (let ((constraint (make-constraint w)) (stack (cons (nreverse (delq w (stacking-order))) '()))) ;; work upwards from bottom @@ -244,8 +262,10 @@ nil) (t (stack-rotate-upwards stack) - (loop)))))) + (loop))))) + (call-window-hook 'after-lower-window-hook w)) + (define (stack-window-above above below) "Change the stacking of window ABOVE so that it is as closely above window BELOW as possible."
Community's reasons for inclusion or rejection[edit | edit source]
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: This brings more extensibility and will make a bug in tab script fixable without dirty hacking. --Ferk(talk!) 07:14, 7 August 2008 (UTC)
- vote: pondering. I suspect (but have not tested) that configure-notify-hook gets called after raise and lower. Could someone test it? Is there a use case for the hooks proposed here and is configure-notify-hook not usable for that purpose? Tkorvola 16:18, 8 August 2008 (UTC)
- I've tried right now using the hook you proposed. The use case is to make tabbed windows (in tabs script) reorder correctly in the stack each time one tab is raised or lowered. When I changed the raise hook to configure-notify the tabs did not ordered (windows were able to get in between the tabs). I added to configure-notify-hook a display-message to see when does it activate, and then lots of display-messages showed one after the other. This never happened with the raise/lower hooks. Not sure when does configure-notify-hook triggers. -Ferk(talk!) 01:58, 9 August 2008 (UTC)
- vote: pondering. The main reason seems to be tabs, so keep as suspended, tabs recode should address the issues. - GSR (Uploaded by Teika kazura 06:51, 16 May 2009 (UTC))
- vote: pondering. I think so, too. Let me supplement:
- The patch itself is safe, and it works.
- Stacking can also be done, for example, through 'restack-windows', defined in
src/functions.c, so I fear that these hooks are not sufficient.
- I don't know configure-notify-hook, so I can't say anything on it. (It's not documented in sawfish manual, and I don't know X.) But in general, limited purpose one is not bad. (Guessing by the name configure-notify-hook sounds quite general :)
- Lastly, let's confirm that, by character, the aim of this patch is not to provide configurable options for users. Because raise/lower-window code is simple, user can replace it with their own version for such purpose. - Teika kazura 06:51, 16 May 2009 (UTC)
Outdated comments are deleted for readability. See this version if you need them.