Here a patch to add actions restrictions to core. What it do: - add restrictActionsMask to CompWindow. - add constrainWindowActions() returning "filtered" window actions - add changeWindowActions() taking care of restrictActionsMask I have do some testing with winrules, seems to works well. David, maybe you have a better idea? http://hibbert.univ-lille3.fr/~cbellegarde/Compiz/actionsRestrictions.patch Cedric
On Tue, 2007-03-06 at 11:39 +0100, Cedric wrote:> Here a patch to add actions restrictions to core. > > What it do: > - add restrictActionsMask to CompWindow. > - add constrainWindowActions() returning "filtered" window actions > - add changeWindowActions() taking care of restrictActionsMask > > I have do some testing with winrules, seems to works well. > David, maybe you have a better idea?This only allows one plugin to restrict actions. We want to allow any number of plugins to restrict available actions. I quickly added a getAllowedActionsForWindow screen function that should take care of this. Wrap getAllowedActionsForWindow and do something like this in your plugin implementation of that function: static unsigned int pluginGetOutputExtentsForWindow (CompWindow *w) { unsigned int actions; PLUGIN_WINDOW (w); UNWRAP (ps, w->screen, getAllowedActionsForWindow); actions = (*w->screen->getAllowedActionsForWindow) (w); WRAP (ps, w->screen, getAllowedActionsForWindow, pluginGetAllowedActionsForWindow); return actions & pluginAllowedActions; } and call recalcWindowActions whenever you want it updated. Any problems, just let me know. - David
> On Tue, 2007-03-06 at 11:39 +0100, Cedric wrote: >> Here a patch to add actions restrictions to core. >> >> What it do: >> - add restrictActionsMask to CompWindow. >> - add constrainWindowActions() returning "filtered" window actions >> - add changeWindowActions() taking care of restrictActionsMask >> >> I have do some testing with winrules, seems to works well. >> David, maybe you have a better idea? > > This only allows one plugin to restrict actions. We want to allow any > number of plugins to restrict available actions. > > I quickly added a getAllowedActionsForWindow screen function that should > take care of this. Wrap getAllowedActionsForWindow and do something like > this in your plugin implementation of that function: > > static unsigned int > pluginGetOutputExtentsForWindow (CompWindow *w) > { > unsigned int actions; > > PLUGIN_WINDOW (w); > > UNWRAP (ps, w->screen, getAllowedActionsForWindow); > actions = (*w->screen->getAllowedActionsForWindow) (w); > WRAP (ps, w->screen, getAllowedActionsForWindow, > pluginGetAllowedActionsForWindow); > > return actions & pluginAllowedActions; > } > > and call recalcWindowActions whenever you want it updated. > > Any problems, just let me know. > > - DavidThere is a little but a bit funny typing error - it is necessary to delete the tilde on line 696 of window.c, otherwise all common actions will be taken from all the windows. Vasek
2007/3/6, David Reveman <davidr@novell.com>:> On Tue, 2007-03-06 at 11:39 +0100, Cedric wrote: > Any problems, just let me know. > > - DavidYes, in addWindow(), windowInitPlugins() should be call before recalcWindowActions(). Otherwise, you will not be able to set allowedActions based on some PluginWindow attributes.