I am working on exposing events to external apps via the dbus plugin
I found that I really wanted extra Notify Procedures so that I didn't
have to do too much direct access to xlib (If I understand rightly, plugin
developers shouldn't have to do too much xlib work inside the plugins)
I added Create, Destroy, Map, Unmap, Minimize and Unminimize
Hopefully this can be included as I know a few other people would like
more notifications that can be easilly used in plugins.
-------------- next part --------------
diff --git a/include/compiz.h b/include/compiz.h
index 61a9de5..ccce7c3 100644
--- a/include/compiz.h
+++ b/include/compiz.h
@@ -1245,6 +1245,14 @@ typedef void (*SetWindowScaleProc) (Comp
typedef Bool (*FocusWindowProc) (CompWindow *window);
+typedef void (*WindowCreateNotifyProc) (CompWindow *window);
+
+typedef void (*WindowDestroyNotifyProc) (CompWindow *window);
+
+typedef void (*WindowMapNotifyProc) (CompWindow *window);
+
+typedef void (*WindowUnmapNotifyProc) (CompWindow *window);
+
typedef void (*WindowResizeNotifyProc) (CompWindow *window);
typedef void (*WindowMoveNotifyProc) (CompWindow *window,
@@ -1265,6 +1273,10 @@ typedef void (*WindowGrabNotifyProc) (Co
typedef void (*WindowUngrabNotifyProc) (CompWindow *window);
+typedef void (*WindowMinimizeNotifyProc) (CompWindow *window);
+
+typedef void (*WindowUnminimizeNotifyProc) (CompWindow *window);
+
typedef void (*WindowStateChangeNotifyProc) (CompWindow *window);
#define COMP_SCREEN_DAMAGE_PENDING_MASK (1 << 0)
@@ -1497,10 +1509,16 @@ struct _CompScreen {
FocusWindowProc focusWindow;
SetWindowScaleProc setWindowScale;
+ WindowCreateNotifyProc windowCreateNotify;
+ WindowDestroyNotifyProc windowDestroyNotify;
+ WindowMapNotifyProc windowMapNotify;
+ WindowUnmapNotifyProc windowUnmapNotify;
WindowResizeNotifyProc windowResizeNotify;
WindowMoveNotifyProc windowMoveNotify;
WindowGrabNotifyProc windowGrabNotify;
WindowUngrabNotifyProc windowUngrabNotify;
+ WindowMinimizeNotifyProc windowMinimizeNotify;
+ WindowUnminimizeNotifyProc windowUnminimizeNotify;
WindowStateChangeNotifyProc windowStateChangeNotify;
@@ -2012,6 +2030,18 @@ Bool
focusWindow (CompWindow *w);
void
+windowCreateNotify (CompWindow *w);
+
+void
+windowDestroyNotify (CompWindow *w);
+
+void
+windowMapNotify (CompWindow *w);
+
+void
+windowUnmapNotify (CompWindow *w);
+
+void
windowResizeNotify (CompWindow *w);
void
@@ -2031,6 +2061,12 @@ void
windowUngrabNotify (CompWindow *w);
void
+windowMinimizeNotify (CompWindow *w);
+
+void
+windowUnminimizeNotify (CompWindow *w);
+
+void
windowStateChangeNotify (CompWindow *w);
void
-------------- next part --------------
diff --git a/src/screen.c b/src/screen.c
index 5a1c145..1d404d9 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1180,10 +1180,16 @@ addScreen (CompDisplay *display,
s->focusWindow = focusWindow;
s->setWindowScale = setWindowScale;
+ s->windowCreateNotify = windowCreateNotify;
+ s->windowDestroyNotify = windowDestroyNotify;
+ s->windowMapNotify = windowMapNotify;
+ s->windowUnmapNotify = windowUnmapNotify;
s->windowResizeNotify = windowResizeNotify;
s->windowMoveNotify = windowMoveNotify;
s->windowGrabNotify = windowGrabNotify;
s->windowUngrabNotify = windowUngrabNotify;
+ s->windowMinimizeNotify = windowMinimizeNotify;
+ s->windowUnminimizeNotify = windowUnminimizeNotify;
s->windowStateChangeNotify = windowStateChangeNotify;
-------------- next part --------------
diff --git a/src/window.c b/src/window.c
index 3346d89..23f9419 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1786,6 +1786,8 @@ addWindow (CompScreen *screen,
w->attrib.x, w->attrib.y,
w->attrib.width, ++w->attrib.height - 1,
w->attrib.border_width);
+
+ (*w->screen->windowCreateNotify) (w);
}
void
@@ -1819,6 +1821,8 @@ removeWindow (CompWindow *w)
void
destroyWindow (CompWindow *w)
{
+ (*w->screen->windowDestroyNotify) (w);
+
w->id = 1;
w->mapNum = 0;
@@ -1943,6 +1947,8 @@ mapWindow (CompWindow *w)
w->attrib.width, ++w->attrib.height - 1,
w->attrib.border_width);
}
+
+ (*w->screen->windowMapNotify) (w);
}
void
@@ -1984,6 +1990,8 @@ unmapWindow (CompWindow *w)
updateWorkareaForScreen (w->screen);
updateClientListForScreen (w->screen);
+
+ (*w->screen->windowUnmapNotify) (w);
}
static int
@@ -2355,6 +2363,26 @@ focusWindow (CompWindow *w)
}
void
+windowCreateNotify (CompWindow *w)
+{
+}
+
+void
+windowDestroyNotify (CompWindow *w)
+{
+}
+
+void
+windowMapNotify (CompWindow *w)
+{
+}
+
+void
+windowUnmapNotify (CompWindow *w)
+{
+}
+
+void
windowResizeNotify (CompWindow *w)
{
}
@@ -2382,6 +2410,16 @@ windowUngrabNotify (CompWindow *w)
}
void
+windowMinimizeNotify (CompWindow *w)
+{
+}
+
+void
+windowUnminimizeNotify (CompWindow *w)
+{
+}
+
+void
windowStateChangeNotify (CompWindow *w)
{
}
@@ -3775,6 +3813,8 @@ minimizeWindow (CompWindow *w)
hideWindow (w);
}
+
+ (*w->screen->windowMinimizeNotify) (w);
}
static void
@@ -3786,6 +3826,8 @@ unminimizeTransients (CompWindow *w,
if (w->transientFor == ancestor->id ||
isGroupTransient (w, ancestor->clientLeader))
unminimizeWindow (w);
+
+ (*w->screen->windowUnminimizeNotify) (w);
}
void