Le mercredi 24 janvier 2007 00:27, David Reveman a écrit :
> > Another question, is it possible to disable focus prevention?
>
> No, not at the moment. If someone provides a patch for that I'll include
> it.
>
> - David

Here is a patch to disable focus prevention.

Cedric.
diff -ur compiz_git/include/compiz.h compiz/include/compiz.h
--- compiz_git/include/compiz.h	2007-01-29 13:37:30.000000000 +0100
+++ compiz/include/compiz.h	2007-01-29 16:44:04.000000000 +0100
@@ -1286,7 +1286,8 @@
 #define COMP_SCREEN_OPTION_NUMBER_OF_DESKTOPS  9
 #define COMP_SCREEN_OPTION_DETECT_OUTPUTS      10
 #define COMP_SCREEN_OPTION_OUTPUTS	       11
-#define COMP_SCREEN_OPTION_NUM		       12
+#define COMP_SCREEN_OPTION_FOCUS_PREVENTION    12
+#define COMP_SCREEN_OPTION_NUM		       13
 
 #ifndef GLX_EXT_texture_from_pixmap
 #define GLX_BIND_TO_TEXTURE_RGB_EXT        0x20D0
diff -ur compiz_git/src/screen.c compiz/src/screen.c
--- compiz_git/src/screen.c	2007-01-29 13:37:30.000000000 +0100
+++ compiz/src/screen.c	2007-01-29 16:43:54.000000000 +0100
@@ -75,6 +75,8 @@
 
 #define OUTPUTS_DEFAULT "640x480+0+0"
 
+#define FOCUS_PREVENTION_DEFAULT TRUE
+
 #define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
 
 static int
@@ -460,6 +462,7 @@
     case COMP_SCREEN_OPTION_LIGHTING:
     case COMP_SCREEN_OPTION_UNREDIRECT_FS:
     case COMP_SCREEN_OPTION_SYNC_TO_VBLANK:
+    case COMP_SCREEN_OPTION_FOCUS_PREVENTION:
 	if (compSetBoolOption (o, value))
 	    return TRUE;
 	break;
@@ -680,6 +683,13 @@
     o->value.list.value->s = strdup (OUTPUTS_DEFAULT);
     o->rest.s.string       = NULL;
     o->rest.s.nString      = 0;
+
+    o = &screen->opt[COMP_SCREEN_OPTION_FOCUS_PREVENTION];
+    o->name       = "focus_prevention";
+    o->shortDesc  = N_("Focus prevention");
+    o->longDesc   = N_("Enable focus prevention");
+    o->type       = CompOptionTypeBool;
+    o->value.b    = FOCUS_PREVENTION_DEFAULT;
 }
 
 static void
diff -ur compiz_git/src/window.c compiz/src/window.c
--- compiz_git/src/window.c	2007-01-29 13:37:30.000000000 +0100
+++ compiz/src/window.c	2007-01-29 16:43:54.000000000 +0100
@@ -4223,8 +4223,10 @@
     if (!active || !getWindowUserTime (active, &aUserTime))
 	return TRUE;
 
-    if (XSERVER_TIME_IS_BEFORE (wUserTime, aUserTime))
-	return FALSE;
+    /* focus prevention */
+    if (w->screen->opt[COMP_SCREEN_OPTION_FOCUS_PREVENTION].value.b && 
+        XSERVER_TIME_IS_BEFORE (wUserTime, aUserTime))
+    return FALSE;
 
     return TRUE;
 }
_______________________________________________
compiz mailing list
compiz@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/compiz

Reply via email to