Re: Problem with sawfish and GNOME global menus



The attached patch fixes the Harald's, by adding 'intern' declaration
in events.c. Without it, in focus-*-hook (eq mode 'while-grabbed)
never returns t.  And Sawfish crashes when you try to print 'mode'.

I also attached a script to watch focus-*-hook. If "anything unusual"
happens, it prints to popup and stderr. Usage is written at the top.

Now I'm testing it, though I don't have many GUI applications, including
Gnome global menu. Maybe I won't see any change.

Thanks all.
commit b35118d1cab5eceeca0cad101d901b38ceac9fb1
Author: Teika kazura <teika lavabit com>
Date:   Mon Dec 27 20:25:25 2010 +0900

    rep_INTERN(while_grabbed);

diff --git a/src/events.c b/src/events.c
index 076aa6e..1dd5420 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1893,7 +1893,8 @@ events_init (void)
     rep_INTERN(normal);
     rep_INTERN(grab);
     rep_INTERN(ungrab);
-
+    rep_INTERN(while_grabbed);
+    
     rep_mark_static (&current_event_window);
     rep_mark_static (&saved_current_context_map);
 
;; Usage: in ~/.sawfish/rc, add
;;  (load "/path/to/watch-focus-in-out")
;; Do **NOT** put the suffix jl in the above line

(defvar dont-report-these
  '(move-viewport-right
    move-viewport-left
    move-viewport-up
    move-viewport-down)
  "Don't report focus changes induced by these commands."
  ;; Cycle commands are checked seperately. See below.
  #|
  In most (all?) focus changes by commands, "mode" is while-grabbed,
  but I choose to check each command name, rather than "mode".
  One reason is merely to study things. :P
  |#
  )

(define (watch-focus-in/out w mode prefix)
  (require 'rep.io.timers)
  ;; Filter "usual" calls of focus-*-hook
  (unless (or
	   ;; Not interesting at all
	   (eq mode 'normal)
	   ;; Cycle-*
	   (and this-command
		(string-match "^cycle-"
			      (symbol-name this-command)))
	   ;; Other commands are stored in last-command
	   (and (not this-command)
		(memq last-command dont-report-these-commands)))
    (let* ((str
	    (format nil
		    "%s
 last-command: %s, this-command: %s
 window: \"%s\"
 mode: %s"
		    prefix
		    (unless this-command last-command)
		    this-command
		    (window-name w) mode)))
      (display-message str
		       ;; print at x = center, y = 600
		       '((position . (nil . 600))))
      (format standard-error "%s\n" str)
      (make-timer
       ;; Erase the popup after 3 seconds
       (lambda () (display-message)) 3))))

(add-hook 'focus-in-hook
	  (lambda (w mode)
	    (watch-focus-in/out w mode "focus-in")))

(add-hook 'focus-out-hook
	  (lambda (w mode)
	    (watch-focus-in/out w mode "focus-out")))

;; Local Variables:
;; mode: sawfish
;; End:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]