[compiz] [PATCH] Extra Notifications

David Reveman davidr at novell.com
Fri Oct 13 12:14:26 PDT 2006


Some notification functions like these might be very nice to have. I'm
not sure how useful Create and Destroy notifies are, in general plugins
should never trigger on Create or Destroy notifies, at least not for any
animations. I think that wrapping handleEvent and masking of
DestroyNotify/CreateNotify events is efficient for those plugins that
actually need to be aware of creation and destruction of windows.

Unmap, Map, Minimize, Unminimize, Shade, Unshade notification functions
could be very useful. However it's not obvious how to implement them...
The tricky part is to figure out when these functions should be called.
For Map, Unshade and Unminimize functions to be useful for plugins that
want to do animations, they should be called when the window is mapped
and content is available so it can be rendered properly. Unmap, Shade
and Minimize can probably be called immediately, however while adding
these functions we probably want to rethink the way plugins currently
keep references to unmapped windows. It's currently not possible to keep
a reference to an unmapped window after it's mapped again. We need the
ability to do this to avoid the flicker you currently get when e.g.
quickly shading and unshading a window.

We probably don't want Unmap and Minimize functions to both be called
when a window is minimized...

Please continue to hack on this and I'm sure we can merge something that
will make life a lot easier for plugins sometime soon.

-David

On Fri, 2006-10-13 at 18:32 +0100, Mike Dransfield wrote: 
> 
> Mike Dransfield wrote:
> > 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.
> 
> 
> Attached is a slight correction for the window.c patch
> plain text document attachment (extra-notifications-window.c.diff)
> diff --git a/src/window.c b/src/window.c
> index 3346d89..96365a2 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)
>  {
>  }
> @@ -3774,6 +3812,7 @@ minimizeWindow (CompWindow *w)
>  	forEachWindowOnScreen (w->screen, minimizeTransients, (void *) w);
>  
>  	hideWindow (w);
> +	(*w->screen->windowMinimizeNotify) (w);
>      }
>  }
>  
> @@ -3798,6 +3837,8 @@ unminimizeWindow (CompWindow *w)
>  	showWindow (w);
>  
>  	forEachWindowOnScreen (w->screen, unminimizeTransients, (void *) w);
> +
> +	(*w->screen->windowUnminimizeNotify) (w);
>      }
>  }
>  
> _______________________________________________
> compiz mailing list
> compiz at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/compiz




More information about the compiz mailing list