Re: [Sawfish] Activate workspace if 'focus-windows-when-mapped set patch

[ Thread Index | Date Index | More Archives ]


On Sat, 31 Mar 2012 18:50:47 +0200
wrote fuchur <flohtransporter@xxxxxxxxx>:

>On Sat, 31 Mar 2012 12:50:07 +0900 (JST)
>wrote Teika Kazura <teika@xxxxxxxxxxx>:
>>Why anyone hasn't complained so far??
>>Let me give a slight fix. It should be combined with the handling
>>of focus-when-mapped, which is done in wm/state/transient.jl. (You can
>>search by "git grep", like:
>> $ git grep focus-when-mapped
>>Or you can use "ack" command.)
>>I wrote a patch. It also ensures that the switching of the
>>workspace is done before set-input-focus. It should be so if your
>>focus-mode is enter-exit. It's done in map-notify-hook.
>>fuchur, could you test it? I don't use workspaces. (Please use the
>>original focus.jl)
>>Teika (Teika kazura)
>I have test your patch, and the patch is not work. I have also do some
>tests. w returns the correct window by (set-input-focus w) in "(define
>(transient-map-window w)" if the window appears on the current
>workspace, but appears the window on a other workspaces as the selected
>w is by (set-input-focus w) nil.
>At this moment i can't see how to fix it in transient-map-window, you
>know i'm not a programmer, here only "learning by doing and testing".

Ok, with this small changes your patch here works perfect.


GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
--- sawfish/lisp/sawfish/wm/state/transient.jl.orgi
+++ sawfish/lisp/sawfish/wm/state/transient.jl
@@ -163,8 +163,10 @@
   ;;    or non-transients may get focus depending on options (yes, we
   ;;    also handle non-transients).
   (define (transient-map-window w)
+    (require 'sawfish.wm.workspace)
     (when (and (window-really-wants-input-p w)
-               (window-visible-p w)
+               (or (window-visible-p w)
+                   (car (window-workspaces w)))
                (or (let ((focus (input-focus)))
                      (and focus (transient-of-p w focus #:allow-root t)))
                    (let ((x-for-id (window-transient-p w)))
@@ -177,6 +179,8 @@
                                (not (window-get w 'never-focus))
                                (not (window-get w 'inhibit-focus-when-mapped)))
                               (window-get w 'focus-when-mapped))))))
+      (unless (window-in-workspace-p w current-workspace)
+        (select-workspace (car (window-workspaces w))))
       (set-input-focus w)))
   ;; If a transient window gets unmapped that currently has the input

Attachment: signature.asc
Description: PGP signature

Mail converted by MHonArc 2.6.19+