Re: [PATCH] make edge-flip work on resolution-change



Am Sat, 28 Aug 2010 17:37:18 +0900 (JST)
schrieb Teika Kazura <teika lavabit com>:

> On Tue, 24 Aug 2010 06:58:25 +0200, Christopher Roy Bratusek wrote:
> >> No, registration to randr-hook has to be done in C. Flippers is used
> >> by infinite-desktop, too. (They can be used by any.) Distinction
> >> between src/flippers.c and wm/ext/edge-flip.jl is necessary.
> >> Thus your first patch sent to the ML was better in this regard.
> > 
> > Registration in c-part enables edge-flipping even if the user
> > disabled it.  I don't think there's a way to check user-variables in
> > c (at least I haven't seen it before.)
> 
> Fsymbol_value can be used, but as I said, the original implementation
> needs reform first, but
> 
> > As I thought. infinite-desktop also still works after resolution-change properly.
> 
> I see. It's terrible that infinite-desktop does "require edge-flip",
> but if it works, let's keep this hacking joy for later. :P
> 
> Teika (Teika kazura)
> 

Check the attached patch. Adds edge-flip-enabled as gaol'ed symbol, moves activation to
flippers.c. Successfully tested on my system.

Chris
diff --git a/lisp/sawfish/wm/ext/edge-flip.jl b/lisp/sawfish/wm/ext/edge-flip.jl
index 4fa6a45..0b8baa0 100644
--- a/lisp/sawfish/wm/ext/edge-flip.jl
+++ b/lisp/sawfish/wm/ext/edge-flip.jl
@@ -21,7 +21,6 @@
 (define-structure sawfish.wm.ext.edge-flip
 
     (export edge-flip-enable
-	    restart-flippers
 	    ;; These three functions are not for API, but let's keep 'em.
 	    edge-flip-for-edge
 	    edge-flip-synthesize
@@ -83,19 +82,12 @@
   (defvar after-edge-flip-hook '()
     "Hook called immediately after edge-flipping.")
 
-  (define (restart-flippers)
-    (if edge-flip-enabled
-      (progn
-        (disable-flippers)
-        (create-flippers)
-        (enable-flippers))))
-
   (define (edge-flip-enable)
     (if (and edge-flip-enabled (not edge-flip-only-when-moving))
 	(progn
 	  (require 'sawfish.wm.util.flippers)
-	  (enable-flippers)
-	  (add-hook 'randr-change-notify-hook restart-flippers))
+	  (recreate-flippers)
+	  (add-hook 'randr-change-notify-hook recreate-flippers))
       (when (featurep 'sawfish.wm.util.flippers)
 	(disable-flippers))))
 
diff --git a/lisp/sawfish/wm/gaol.jl b/lisp/sawfish/wm/gaol.jl
index 731ed98..cd54295 100644
--- a/lisp/sawfish/wm/gaol.jl
+++ b/lisp/sawfish/wm/gaol.jl
@@ -59,7 +59,8 @@
   (define safe-specials
     '(default-foreground display-name canonical-display-name
       default-font default-frame nil-frame frame-part-classes
-      decorate-transients batch-mode default-directory))
+      decorate-transients batch-mode default-directory
+      edge-flip-enabled))
 
   (define safe-features '(sawfish.wm.util.gtkrc
 			  sawfish.wm.util.x
diff --git a/src/flippers.c b/src/flippers.c
index 39df902..5ee2706 100644
--- a/src/flippers.c
+++ b/src/flippers.c
@@ -29,6 +29,7 @@ DEFSYM(top, "top");
 DEFSYM(bottom, "bottom");
 DEFSYM(enter_flipper_hook, "enter-flipper-hook");
 DEFSYM(leave_flipper_hook, "leave-flipper-hook");
+DEFSYM(edge_flip_enabled, "edge-flip-enabled");
 
 DEFUN("enable-flippers", Fenable_flippers, Senable_flippers, (void), rep_Subr0)
 {
@@ -142,6 +143,20 @@ DEFUN("create-flippers", Fcreate_flippers,
 
 }
 
+DEFUN("recreate-flippers", Frecreate_flippers,
+      Srecreate_flippers, (void), rep_Subr0)
+{
+	if (!rep_NILP(global_symbol_value (Qedge_flip_enabled)))
+	{
+
+		Fdisable_flippers();
+		Fcreate_flippers();
+		Fenable_flippers();
+	}
+
+	return Qt;
+}
+
 repv
 rep_dl_init (void)
 {
@@ -151,6 +166,7 @@ rep_dl_init (void)
     rep_ADD_SUBR(Sdisable_flippers);
     rep_ADD_SUBR(Sflippers_after_restacking);
     rep_ADD_SUBR(Screate_flippers);
+    rep_ADD_SUBR(Srecreate_flippers);
 
     rep_INTERN (left);
     rep_INTERN (right);
@@ -158,8 +174,9 @@ rep_dl_init (void)
     rep_INTERN (bottom);
     rep_INTERN_SPECIAL (enter_flipper_hook);
     rep_INTERN_SPECIAL (leave_flipper_hook);
+    rep_INTERN_SPECIAL (edge_flip_enabled);
 
-    if (!batch_mode_p ())
+    if (!batch_mode_p () && !rep_NILP(global_symbol_value (Qedge_flip_enabled)))
     {
 
 	Fcreate_flippers();
diff --git a/src/sawfish_subrs.h b/src/sawfish_subrs.h
index 33c5c32..f64f25b 100644
--- a/src/sawfish_subrs.h
+++ b/src/sawfish_subrs.h
@@ -103,6 +103,9 @@ extern repv Fcurrent_event_window (repv win);
 extern void events_init (void);
 extern void events_kill (void);
 
+/* from flippers.c */
+extern repv Qedge_flip_enable;
+
 /* from fonts.c */
 extern int font_type;
 extern repv Qdefault_font;


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