Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP3
compiz-plugins-main
compiz-plugins-main-better-neg.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File compiz-plugins-main-better-neg.patch of Package compiz-plugins-main
--- a/metadata/neg.xml.in +++ b/metadata/neg.xml.in @@ -22,15 +22,15 @@ </option> </display> <screen> + <option name="toggle_by_default" type="bool"> + <_short>Auto-Toggle Matched Windows</_short> + <_long>Automatically toggle windows in the match list by default</_long> + <default>false</default> + </option> <option name="neg_match" type="match"> <_short>Negative Windows</_short> - <_long>Windows to be negative by default</_long> - <default>any</default> - </option> - <option name="exclude_match" type="match"> - <_short>Exclude Windows</_short> - <_long>Windows to exclude from negating</_long> - <default>type=Desktop</default> + <_long>Windows to affect when negating</_long> + <default>!(type=Desktop)</default> </option> </screen> </plugin> --- a/src/neg/neg.c +++ b/src/neg/neg.c @@ -40,7 +40,7 @@ typedef struct _NEGDisplay } NEGDisplay; -typedef struct _NEGSCreen +typedef struct _NEGScreen { int windowPrivateIndex; @@ -55,6 +55,7 @@ typedef struct _NEGSCreen typedef struct _NEGWindow { Bool isNeg; /* negative window flag */ + Bool matched; } NEGWindow; #define GET_NEG_CORE(c) \ @@ -78,16 +79,15 @@ typedef struct _NEGWindow static void -NEGToggle (CompWindow *w) +NEGUpdateState (CompWindow *w) { NEG_WINDOW (w); - /* toggle window negative flag */ - nw->isNeg = !nw->isNeg; - - /* check exclude list */ - if (matchEval (negGetExcludeMatch (w->screen), w)) - nw->isNeg = FALSE; + /* check include list */ + if (matchEval (negGetNegMatch (w->screen), w)) + nw->isNeg = !nw->isNeg; + else + nw->isNeg = FALSE; /* cause repainting */ addWindowDamage (w); @@ -106,7 +106,7 @@ NEGToggleScreen (CompScreen *s) /* toggle every window */ for (w = s->windows; w; w = w->next) if (w) - NEGToggle (w); + NEGUpdateState (w); } static Bool @@ -123,7 +123,7 @@ negToggle (CompDisplay *d, w = findWindowAtDisplay (d, xid); if (w) - NEGToggle (w); + NEGUpdateState (w); return TRUE; } @@ -549,10 +549,15 @@ static void NEGWindowAdd (CompScreen *s, CompWindow *w) { - /* nw->isNeg is initialized to FALSE in InitWindow, so we only - have to toggle it to TRUE if necessary */ - if (matchEval (negGetNegMatch (s), w)) - NEGToggle (w); + NEG_SCREEN (s); + NEG_WINDOW (w); + + nw->matched = matchEval (negGetNegMatch (s), w); + + /* nw->isNeg is initialized to FALSE in InitWindow, so we only + have to toggle it to TRUE if necessary */ + if (ns->isNeg && nw->matched) + NEGUpdateState (w); } static void @@ -562,24 +567,48 @@ NEGScreenOptionChanged (CompScreen { switch (num) { + case NegScreenOptionToggleByDefault: + { + CompWindow *w; + + NEG_SCREEN (s); + + ns->isNeg = opt[NegScreenOptionToggleByDefault].value.b; + + for (w = s->windows; w; w = w->next) + { + NEG_WINDOW (w); + if (ns->isNeg) + { + if (!nw->isNeg) + NEGUpdateState (w); + } + else + { + if (nw->isNeg) + NEGUpdateState (w); + } + } + } + break; case NegScreenOptionNegMatch: - case NegScreenOptionExcludeMatch: { CompWindow *w; NEG_SCREEN (s); for (w = s->windows; w; w = w->next) { - Bool isNeg; - NEG_WINDOW (w); + NEG_WINDOW (w); - isNeg = matchEval (negGetNegMatch (s), w); - isNeg = isNeg && !matchEval (negGetExcludeMatch (s), w); + nw->matched = matchEval (negGetNegMatch (w->screen), w); - if (isNeg && ns->isNeg && !nw->isNeg) - NEGToggle (w); - else if (!isNeg && nw->isNeg) - NEGToggle (w); + if (nw->matched) + { + if ((ns->isNeg || negGetToggleByDefault (s)) && !nw->isNeg) + NEGUpdateState (w); + } + else if (nw->isNeg) + NEGUpdateState (w); } } break; @@ -711,8 +740,8 @@ NEGInitScreen (CompPlugin *p, ns->negFunction = 0; ns->negAlphaFunction = 0; + negSetToggleByDefaultNotify (s, NEGScreenOptionChanged); negSetNegMatchNotify (s, NEGScreenOptionChanged); - negSetExcludeMatchNotify (s, NEGScreenOptionChanged); /* wrap overloaded functions */ WRAP (ns, s, drawWindowTexture, NEGDrawWindowTexture); @@ -753,6 +782,7 @@ NEGInitWindow (CompPlugin *p, return FALSE; nw->isNeg = FALSE; + nw->matched = FALSE; w->base.privates[ns->windowPrivateIndex].ptr = nw;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor