summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2007-08-24 10:22:54 +0200
committerDanny Baumann <dannybaumann@web.de>2007-08-24 10:22:54 +0200
commit4cffb8c65b46ff03f5fe0ed674b3d4c5161c9cb0 (patch)
tree5221efe690a178319b86c6b005614168c0a9be17
parent1bf15439e2d8f9beec0a8a85eed98178b5d027c4 (diff)
downloadwinrules-4cffb8c65b46ff03f5fe0ed674b3d4c5161c9cb0.tar.gz
winrules-4cffb8c65b46ff03f5fe0ed674b3d4c5161c9cb0.tar.bz2
Wrap into matchExpHandlerChanged and matchPropertyChanged functions to get notified when we need to re-check the matches.
-rw-r--r--winrules.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/winrules.c b/winrules.c
index 75f62ea..ac38f42 100644
--- a/winrules.c
+++ b/winrules.c
@@ -60,7 +60,10 @@ typedef struct _WinrulesWindow {
typedef struct _WinrulesDisplay {
int screenPrivateIndex;
- HandleEventProc handleEvent;
+
+ HandleEventProc handleEvent;
+ MatchExpHandlerChangedProc matchExpHandlerChanged;
+ MatchPropertyChangedProc matchPropertyChanged;
} WinrulesDisplay;
typedef struct _WinrulesScreen {
@@ -525,6 +528,38 @@ winrulesApplyRules (void *closure)
return FALSE;
}
+
+static void
+winrulesMatchExpHandlerChanged (CompDisplay *d)
+{
+ CompScreen *s;
+ CompWindow *w;
+
+ WINRULES_DISPLAY (d);
+
+ UNWRAP (wd, d, matchExpHandlerChanged);
+ (*d->matchExpHandlerChanged) (d);
+ WRAP (wd, d, matchExpHandlerChanged, winrulesMatchExpHandlerChanged);
+
+ /* match options are up to date after the call to matchExpHandlerChanged */
+ for (s = d->screens; s; s = s->next)
+ for (w = s->windows; w; w = w->next)
+ winrulesApplyRules (w);
+}
+
+static void
+winrulesMatchPropertyChanged (CompDisplay *d,
+ CompWindow *w)
+{
+ WINRULES_DISPLAY (d);
+
+ winrulesApplyRules (w);
+
+ UNWRAP (wd, d, matchPropertyChanged);
+ (*d->matchPropertyChanged) (d, w);
+ WRAP (wd, d, matchPropertyChanged, winrulesMatchPropertyChanged);
+}
+
static Bool
winrulesInitDisplay (CompPlugin *p,
CompDisplay *d)
@@ -541,7 +576,11 @@ winrulesInitDisplay (CompPlugin *p,
free (wd);
return FALSE;
}
+
WRAP (wd, d, handleEvent, winrulesHandleEvent);
+ WRAP (wd, d, matchExpHandlerChanged, winrulesMatchExpHandlerChanged);
+ WRAP (wd, d, matchPropertyChanged, winrulesMatchPropertyChanged);
+
d->privates[displayPrivateIndex].ptr = wd;
return TRUE;
@@ -554,7 +593,11 @@ winrulesFiniDisplay (CompPlugin *p,
WINRULES_DISPLAY (d);
freeScreenPrivateIndex (d, wd->screenPrivateIndex);
+
UNWRAP (wd, d, handleEvent);
+ UNWRAP (wd, d, matchExpHandlerChanged);
+ UNWRAP (wd, d, matchPropertyChanged);
+
free (wd);
}