[compiz] [PATCH] Add override_redirect matching support

Erkin Bahceci erkinbah at gmail.com
Tue May 1 16:59:10 PDT 2007


Hi,
Here is a patch that adds override_redirect matching support to
match.c, allowing expressions like:
    override_redirect=0
or like:
    (type=Unknown | Menu) | override_redirect=1

This is necessary to be able to match popup and dropdown menus in
Mozilla applications.

Regards,
Erkin
-------------- next part --------------
From b8db3033de62f4c270eebfac0df0fe895b7ab739 Mon Sep 17 00:00:00 2001
From: Erkin Bahceci <erkinbah at gmail.com>
Date: Tue, 1 May 2007 18:51:15 -0500
Subject: [PATCH] Add override_redirect matching support.

---
 src/match.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/src/match.c b/src/match.c
index d100a21..9935266 100644
--- a/src/match.c
+++ b/src/match.c
@@ -662,6 +662,16 @@ matchEvalIdExp (CompDisplay *display,
     return (private.val == window->id);
 }
 
+static Bool
+matchEvalOverrideRedirectExp (CompDisplay *display,
+			      CompWindow  *window,
+			      CompPrivate private)
+{
+    Bool overrideRedirect = window->attrib.override_redirect;
+    return ((private.val == 1 && overrideRedirect) ||
+	    (private.val == 0 && !overrideRedirect));
+}
+
 void
 matchInitExp (CompDisplay  *display,
 	      CompMatchExp *exp,
@@ -677,7 +687,12 @@ matchInitExp (CompDisplay  *display,
 	exp->eval      = matchEvalStateExp;
 	exp->priv.uval = windowStateFromString (value + 6);
     }
-    else
+    else if (strncmp (value, "override_redirect=", 18) == 0)
+    {
+	exp->eval     = matchEvalOverrideRedirectExp;
+	exp->priv.val = strtol (value + 18, NULL, 0);
+    }
+    else 
     {
 	if (strncmp (value, "type=", 5) == 0)
 	    value += 5;
-- 
1.4.4.2


More information about the compiz mailing list