[compiz] [PATCH] Compiz Events
Mike Dransfield
mike at blueroot.co.uk
Wed Oct 18 12:41:27 PDT 2006
I wrote this quick patch because I want plugins to be able to
communicate with each other with events. Using the option values to
communicate with each other is a bit cumbersome if you want to monitor
for changes or do anything which requires events.
It is just a small patch and works in the compiz way (ie by wrapping the
core
event).
Some potential events that I can think of at the moment are 'option changed'
and 'cube settle on top' (Maybe a widget plugin can use this)
Plugins can send compiz events like this.
(*d->handleCompizEvent) (d, "switcher", "NEXT_EVENT", option,
nOption);
In this case, switcher is sending the NEXT_EVENT signal. It is probably
best
to deal with strings for the events since they do not have to be defined
and
are easily passed to external applications.
The option can be any type of extra information passed as a pointer to a
CompOption as per normal.
Some sort of standard should be set out for the naming of events like this.
-------------- next part --------------
diff --git a/include/compiz.h b/include/compiz.h
index 61a9de5..a7eff50 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -568,6 +568,12 @@ typedef void (*FiniPluginForDisplayProc)
typedef void (*HandleEventProc) (CompDisplay *display,
XEvent *event);
+typedef void (*HandleCompizEventProc) (CompDisplay *display,
+ char *pluginName,
+ char *eventName,
+ CompOption *option,
+ int nOption);
+
typedef Bool (*CallBackProc) (void *closure);
typedef void (*ForEachWindowProc) (CompWindow *window,
@@ -749,7 +755,8 @@ struct _CompDisplay {
InitPluginForDisplayProc initPluginForDisplay;
FiniPluginForDisplayProc finiPluginForDisplay;
- HandleEventProc handleEvent;
+ HandleEventProc handleEvent;
+ HandleCompizEventProc handleCompizEvent;
CompPrivate *privates;
};
@@ -853,6 +860,12 @@ setDisplayAction (CompDisplay *displ
void
handleEvent (CompDisplay *display,
XEvent *event);
+void
+handleCompizEvent (CompDisplay *display,
+ char *pluginName,
+ char *eventName,
+ CompOption *option,
+ int nOption);
void
handleSyncAlarm (CompWindow *w);
-------------- next part --------------
diff --git a/src/display.c b/src/display.c
index 4abdaed..dd70c51 100644
--- a/src/display.c
+++ b/src/display.c
@@ -2507,6 +2507,7 @@ #endif
d->finiPluginForDisplay = finiPluginForDisplay;
d->handleEvent = handleEvent;
+ d->handleCompizEvent = handleCompizEvent;
d->supportedAtom = XInternAtom (dpy, "_NET_SUPPORTED", 0);
d->supportingWmCheckAtom = XInternAtom (dpy, "_NET_SUPPORTING_WM_CHECK", 0);
-------------- next part --------------
diff --git a/src/event.c b/src/event.c
index 2d182be..ce92780 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1059,6 +1059,14 @@ handleActionEvent (CompDisplay *d,
return FALSE;
}
+void handleCompizEvent (CompDisplay *d,
+ char *pluginName,
+ char *eventName,
+ CompOption *option,
+ int nOption)
+{
+}
+
void
handleEvent (CompDisplay *d,
XEvent *event)
More information about the compiz
mailing list