Conkeror hangs when run using do-shell
Renaud Casenave-Péré
renaud at casenave-pere.fr
Sun Dec 8 07:28:10 UTC 2013
Hi,
On Sat, Dec 07 2013, Philippe Brochard wrote:
> All works as expected here with clisp and sbcl. The code you send is
> working for me. I use conkeror every days and I've never seen a hang
> up.
>
> Please can you have a deeper look. And report any problem or suspect
> behaviour.
You're right… It seems to work properly now. Then I don't know, it was probably
a bug within conkeror or xulrunner, or maybe the /dev/null redirection did the
trick. Sorry for the noise :/
> The same, all works as expected here with those lines in my .clfsmwrc
>
> ;--------------------------------------------------
> (setf *steal-focus* nil)
> (setf *default-nw-hook* 'leave-focus-frame-nw-hook)
> ;--------------------------------------------------
>
> Please, can you give use more details on what you expect.
With the above settings, it works well when you are running a new application
but not if the application is already running and it only open a new tab. The
same applies for emacsclient, for example:
Run emacs normally and put it in server mode.
In a terminal, ask emacs to open a buffer within the open emacs frame:
`emacsclient test-file`
I don't really know why it behave like this but if you do it that way, X will
generate :focus-out / :focus-in events to the emacs frame without clfswm asking
it to actually change the focus and only after that X will generate a
:configure-request event where *steal-focus* is checked.
I have looked around in clfswm source and I came up with a simple patch which
should affect only (eq *steal-focus* nil) configurations by storing the
currently focused window and by registering a :focus-in event-handler where I
check if X did change the focus without clfswm telling it to.
;--------------------------------------------------
diff --git a/src/clfswm.lisp b/src/clfswm.lisp
index 3b6545a..919bea2 100644
--- a/src/clfswm.lisp
+++ b/src/clfswm.lisp
@@ -129,6 +129,9 @@
(> root-y (- (screen-height) 3)))
(manage-focus window root-x root-y)))
+(define-handler main-mode :focus-in (window)
+ (unless (or *steal-focus* (child-equal-p window (focused-window)))
+ (focus-window (focused-window))))
(define-handler main-mode :exposure (window)
(awhen (find-frame-window window)
diff --git a/src/xlib-util.lisp b/src/xlib-util.lisp
index 5d8cb0f..7df2560 100644
--- a/src/xlib-util.lisp
+++ b/src/xlib-util.lisp
@@ -570,15 +570,21 @@ they should be windows. So use this function to make a window out of them."
(setf (xlib:window-priority window) :above)))
-(defun no-focus ()
- "don't focus any window but still read keyboard events."
- (xlib:set-input-focus *display* *no-focus-window* :pointer-root))
-
-(defun focus-window (window)
- "Give the window focus."
- (no-focus)
- (when (xlib:window-p window)
- (xlib:set-input-focus *display* window :parent)))
+(let ((focused-window nil))
+ (defun no-focus ()
+ "don't focus any window but still read keyboard events."
+ (xlib:set-input-focus *display* *no-focus-window* :pointer-root)
+ (setf focused-window nil))
+
+ (defun focus-window (window)
+ "Give the window focus."
+ (no-focus)
+ (when (xlib:window-p window)
+ (xlib:set-input-focus *display* window :parent)
+ (setf focused-window window)))
+
+ (defun focused-window ()
+ focused-window))
(defun raise-and-focus-window (window)
"Raise and focus."
;--------------------------------------------------
Please tell me if this patch is ok for you.
Thanks,
--
Renaud Casenave-Péré
More information about the clfswm-devel
mailing list