summaryrefslogtreecommitdiff
path: root/beryl-plugins/src/neg.c
diff options
context:
space:
mode:
authorkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-02 16:26:33 +0000
committerkristian <kristian@d7aaf104-2d23-0410-ae22-9d23157bf5a3>2006-12-02 16:26:33 +0000
commitc31c5e2d5c6b525350c2f807095f8b2819a59bd5 (patch)
treead9bf35f3a435cdb444fff636424005fb608b4ce /beryl-plugins/src/neg.c
parentd85d0131318217e03b20d15639fced7af7957eb5 (diff)
downloadmarex-dev-c31c5e2d5c6b525350c2f807095f8b2819a59bd5.tar.gz
marex-dev-c31c5e2d5c6b525350c2f807095f8b2819a59bd5.tar.bz2
indent -i8 -kr . All whitespace-changes.
See man indent for details of what -kr does. git-svn-id: file:///beryl/trunk@1499 d7aaf104-2d23-0410-ae22-9d23157bf5a3
Diffstat (limited to 'beryl-plugins/src/neg.c')
-rw-r--r--beryl-plugins/src/neg.c1419
1 files changed, 741 insertions, 678 deletions
diff --git a/beryl-plugins/src/neg.c b/beryl-plugins/src/neg.c
index 0268603..1505db7 100644
--- a/beryl-plugins/src/neg.c
+++ b/beryl-plugins/src/neg.c
@@ -41,7 +41,7 @@
/* defaults */
static char *excludeWinType[] = {
- N_("Desktop")
+ N_("Desktop")
};
#define N_EXCLUDE_WIN_TYPE (sizeof (excludeWinType) / sizeof (excludeWinType[0]))
@@ -62,27 +62,24 @@ static char *excludeWinType[] = {
static int displayPrivateIndex;
-typedef struct _NEGDisplay
-{
- int screenPrivateIndex;
- CompOption opt[NEG_DISPLAY_OPTION_NUM]; /* array of display options */
+typedef struct _NEGDisplay {
+ int screenPrivateIndex;
+ CompOption opt[NEG_DISPLAY_OPTION_NUM]; /* array of display options */
} NEGDisplay;
-typedef struct _NEGSCreen
-{
- int windowPrivateIndex;
- CompOption opt[NEG_SCREEN_OPTION_NUM]; /* array of screen options */
- DrawWindowTextureProc drawWindowTexture; /* function pointer */
- DamageWindowRectProc damageWindowRect; /* function pointer */
- PaintWindowProc paintWindow; /* function pointer */
- Bool isNeg; /* negative screen flag */
- unsigned int excludeWMask;
+typedef struct _NEGSCreen {
+ int windowPrivateIndex;
+ CompOption opt[NEG_SCREEN_OPTION_NUM]; /* array of screen options */
+ DrawWindowTextureProc drawWindowTexture; /* function pointer */
+ DamageWindowRectProc damageWindowRect; /* function pointer */
+ PaintWindowProc paintWindow; /* function pointer */
+ Bool isNeg; /* negative screen flag */
+ unsigned int excludeWMask;
} NEGScreen;
-typedef struct _NEGWindow
-{
- Bool isNeg; /* negative window flag */
+typedef struct _NEGWindow {
+ Bool isNeg; /* negative window flag */
} NEGWindow;
#define GET_NEG_DISPLAY(d) ((NEGDisplay *) (d)->privates[displayPrivateIndex].ptr)
@@ -94,772 +91,838 @@ typedef struct _NEGWindow
#define NUM_OPTIONS(s) (sizeof ((s)->opt) / sizeof (CompOption))
-static void
-NEGToggle (CompWindow * w)
+static void NEGToggle(CompWindow * w)
{
- CompOption *o;
- int i;
+ CompOption *o;
+ int i;
- NEG_SCREEN (w->screen);
- NEG_WINDOW (w);
+ NEG_SCREEN(w->screen);
+ NEG_WINDOW(w);
- /* toggle window negative flag */
- nw->isNeg = !nw->isNeg;
+ /* toggle window negative flag */
+ nw->isNeg = !nw->isNeg;
- /* check exclude list */
- if (ns->excludeWMask & w->type)
- nw->isNeg = FALSE;
+ /* check exclude list */
+ if (ns->excludeWMask & w->type)
+ nw->isNeg = FALSE;
- o = &ns->opt[NEG_SCREEN_OPTION_EXCLUDE_LIST];
- for (i = 0; i < o->value.list.nValue; i++)
- {
- if (w->resClass && (strcmp (o->value.list.value[i].s, w->resClass) == 0))
- nw->isNeg = FALSE;
- }
+ o = &ns->opt[NEG_SCREEN_OPTION_EXCLUDE_LIST];
+ for (i = 0; i < o->value.list.nValue; i++) {
+ if (w->resClass
+ && (strcmp(o->value.list.value[i].s, w->resClass) ==
+ 0))
+ nw->isNeg = FALSE;
+ }
- /* cause repainting */
- addWindowDamage (w);
+ /* cause repainting */
+ addWindowDamage(w);
}
-static void
-NEGToggleScreen (CompScreen * s)
+static void NEGToggleScreen(CompScreen * s)
{
- CompWindow *w;
- NEG_SCREEN (s);
+ CompWindow *w;
+ NEG_SCREEN(s);
- /* toggle screen negative flag */
- ns->isNeg = !ns->isNeg;
+ /* toggle screen negative flag */
+ ns->isNeg = !ns->isNeg;
- /* toggle every window */
- for (w = s->windows; w; w = w->next)
- if (w)
- NEGToggle (w);
+ /* toggle every window */
+ for (w = s->windows; w; w = w->next)
+ if (w)
+ NEGToggle(w);
}
static Bool
-negToggle (CompDisplay * d, CompAction * action, CompActionState state,
- CompOption * option, int nOption)
+negToggle(CompDisplay * d, CompAction * action, CompActionState state,
+ CompOption * option, int nOption)
{
- CompWindow *w;
- Window xid;
+ CompWindow *w;
+ Window xid;
- xid = getIntOptionNamed (option, nOption, "window", 0);
+ xid = getIntOptionNamed(option, nOption, "window", 0);
- w = findWindowAtDisplay (d, xid);
+ w = findWindowAtDisplay(d, xid);
- if (w)
- NEGToggle (w);
+ if (w)
+ NEGToggle(w);
- return TRUE;
+ return TRUE;
}
static Bool
-negToggleAll (CompDisplay * d, CompAction * action, CompActionState state,
- CompOption * option, int nOption)
+negToggleAll(CompDisplay * d, CompAction * action, CompActionState state,
+ CompOption * option, int nOption)
{
- CompScreen *s;
- Window xid;
+ CompScreen *s;
+ Window xid;
- xid = getIntOptionNamed (option, nOption, "root", 0);
+ xid = getIntOptionNamed(option, nOption, "root", 0);
- s = findScreenAtDisplay (d, xid);
+ s = findScreenAtDisplay(d, xid);
- if (s)
- NEGToggleScreen (s);
+ if (s)
+ NEGToggleScreen(s);
- return TRUE;
+ return TRUE;
}
static void
-NEGDrawWindowTexture (CompWindow * w,
- CompTexture * texture,
- const WindowPaintAttrib * attrib, unsigned int mask)
+NEGDrawWindowTexture(CompWindow * w,
+ CompTexture * texture,
+ const WindowPaintAttrib * attrib, unsigned int mask)
{
- int filter;
-
- NEG_SCREEN (w->screen);
- NEG_WINDOW (w);
-
- /* PAINT_WINDOW_DECORATION_MASK is set when the decorations are being painted
- * I didn't want to paint them negative too
- */
- if (nw->isNeg && !(mask & PAINT_WINDOW_DECORATION_MASK))
- {
-
- /* this is for the most part taken from paint.c */
-
- /* push the current matrix */
- glPushMatrix ();
-
- /* we need this to handle windows that are not regular, like during scale */
- if (mask & PAINT_WINDOW_TRANSFORMED_MASK)
- {
- glTranslatef (w->attrib.x, w->attrib.y, 0.0f);
- glScalef (attrib->xScale, attrib->yScale, 0.0f);
- glTranslatef (attrib->xTranslate / attrib->xScale - w->attrib.x,
- attrib->yTranslate / attrib->yScale - w->attrib.y,
- 0.0f);
-
- filter = w->screen->filter[WINDOW_TRANS_FILTER];
- }
- else if (mask & PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK)
- {
- filter = w->screen->filter[SCREEN_TRANS_FILTER];
- }
- else
- {
- filter = w->screen->filter[NOTHING_TRANS_FILTER];
- }
-
- /* if we can addjust saturation, even if it's just on and off */
- if (w->screen->canDoSaturated && attrib->saturation != COLOR)
- {
- GLfloat constant[4];
-
- /* if the paint mask has this set we want to blend */
- if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
- glEnable (GL_BLEND);
-
- /* enable the texture */
- enableTexture (w->screen, texture, filter);
-
- /* texture combiner */
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PRIMARY_COLOR);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_PRIMARY_COLOR);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR); /* negate */
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
-
- glColor4f (1.0f, 1.0f, 1.0f, 0.5f);
-
- /* make another texture active */
- w->screen->activeTexture (GL_TEXTURE1_ARB);
-
- /* enable that texture */
- enableTexture (w->screen, texture, filter);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_CONSTANT);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
-
- /* if we can do saturation that is in between min and max */
- if (w->screen->canDoSlightlySaturated && attrib->saturation > 0)
- {
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
-
- constant[0] = 0.5f + 0.5f * RED_SATURATION_WEIGHT;
- constant[1] = 0.5f + 0.5f * GREEN_SATURATION_WEIGHT;
- constant[2] = 0.5f + 0.5f * BLUE_SATURATION_WEIGHT;
- constant[3] = 1.0;
-
- glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
-
- /* mack another texture active */
- w->screen->activeTexture (GL_TEXTURE2_ARB);
-
- /* enable that texture */
- enableTexture (w->screen, texture, filter);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE0);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE2_RGB, GL_CONSTANT);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR); /* negate */
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
-
- /* color constant */
- constant[3] = attrib->saturation / 65535.0f;
-
- glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
-
- /* if we are not opaque or not fully bright */
- if (attrib->opacity < OPAQUE || attrib->brightness != BRIGHT)
- {
- /* activate a new texture */
- w->screen->activeTexture (GL_TEXTURE3_ARB);
-
- /* enable that texture */
- enableTexture (w->screen, texture, filter);
-
- /* color constant */
- constant[3] = attrib->opacity / 65535.0f;
- constant[0] = constant[1] = constant[2] =
- constant[3] * attrib->brightness / 65535.0f;
-
- glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR,
- constant);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
- GL_COMBINE);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_PREVIOUS);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_CONSTANT);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_CONSTANT);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA,
- GL_SRC_ALPHA);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA,
- GL_SRC_ALPHA);
-
- /* draw the window geometry */
- (*w->screen->drawWindowGeometry) (w);
-
- /* disable the current texture */
- disableTexture (w->screen, texture);
-
- /* set texture mode back to replace */
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
- GL_REPLACE);
-
- /* re-activate last texture */
- w->screen->activeTexture (GL_TEXTURE2_ARB);
- }
- else
- {
- /* fully opaque and bright */
-
- /* draw the window geometry */
- (*w->screen->drawWindowGeometry) (w);
- }
-
- /* disable the current texture */
- disableTexture (w->screen, texture);
-
- /* set the texture mode back to replace */
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- /* re-activate last texture */
- w->screen->activeTexture (GL_TEXTURE1_ARB);
- }
- else
- {
- /* fully saturated or fully unsaturated */
-
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_PREVIOUS);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_CONSTANT);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
-
- /* color constant */
- constant[3] = attrib->opacity / 65535.0f;
- constant[0] = constant[1] = constant[2] =
- constant[3] * attrib->brightness / 65535.0f;
-
- constant[0] =
- 0.5f + 0.5f * RED_SATURATION_WEIGHT * constant[0];
- constant[1] =
- 0.5f + 0.5f * GREEN_SATURATION_WEIGHT * constant[1];
- constant[2] =
- 0.5f + 0.5f * BLUE_SATURATION_WEIGHT * constant[2];
-
- glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
-
- /* draw the window geometry */
- (*w->screen->drawWindowGeometry) (w);
- }
-
- /* disable the current texture */
- disableTexture (w->screen, texture);
-
- /* set the texture mode back to replace */
- glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-
- /* re-activate last texture */
- w->screen->activeTexture (GL_TEXTURE0_ARB);
-
- /* disable that texture */
- disableTexture (w->screen, texture);
-
- /* set the default color */
- glColor4usv (defaultColor);
-
- /* set screens texture mode back to replace */
- screenTexEnvMode (w->screen, GL_REPLACE);
-
- /* if it's a translucent window, disable blending */
- if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
- glDisable (GL_BLEND);
- }
- else
- {
- /* no saturation adjustments */
-
- /* enable the current texture */
- enableTexture (w->screen, texture, filter);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR); /* negate */
-
-
- /* we are not opaque or fully bright */
- if ((mask & PAINT_WINDOW_TRANSLUCENT_MASK) || attrib->brightness != BRIGHT)
- {
- GLfloat constant[4];
-
- /* enable blending */
- glEnable (GL_BLEND);
-
- /* color constant */
- constant[3] = attrib->opacity / 65535.0f;
- constant[0] = constant[3] * attrib->brightness / 65535.0f;
- constant[1] = constant[3] * attrib->brightness / 65535.0f;
- constant[2] = constant[3] * attrib->brightness / 65535.0f;
- glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, constant);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_CONSTANT);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR); /* negate */
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);
-
- glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
- glTexEnvf (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE);
- glTexEnvf (GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_CONSTANT);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
- glTexEnvf (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
-
- /* draw the window geometry */
- (*w->screen->drawWindowGeometry) (w);
-
- /* disable blending */
- glDisable (GL_BLEND);
-
- }
- else
- {
- /* no adjustments to saturation, brightness or opacity */
-
- /* draw the window geometry */
- (*w->screen->drawWindowGeometry) (w);
- }
-
- /* disable the current texture */
- disableTexture (w->screen, texture);
-
- /* set the screens texture mode back to replace */
- screenTexEnvMode (w->screen, GL_REPLACE);
- }
- /* pop previous matrix */
- glPopMatrix ();
- }
- else
- {
- /* not negative */
- UNWRAP (ns, w->screen, drawWindowTexture);
- (*w->screen->drawWindowTexture) (w, texture, attrib, mask);
- WRAP (ns, w->screen, drawWindowTexture, NEGDrawWindowTexture);
- }
+ int filter;
+
+ NEG_SCREEN(w->screen);
+ NEG_WINDOW(w);
+
+ /* PAINT_WINDOW_DECORATION_MASK is set when the decorations are being painted
+ * I didn't want to paint them negative too
+ */
+ if (nw->isNeg && !(mask & PAINT_WINDOW_DECORATION_MASK)) {
+
+ /* this is for the most part taken from paint.c */
+
+ /* push the current matrix */
+ glPushMatrix();
+
+ /* we need this to handle windows that are not regular, like during scale */
+ if (mask & PAINT_WINDOW_TRANSFORMED_MASK) {
+ glTranslatef(w->attrib.x, w->attrib.y, 0.0f);
+ glScalef(attrib->xScale, attrib->yScale, 0.0f);
+ glTranslatef(attrib->xTranslate / attrib->xScale -
+ w->attrib.x,
+ attrib->yTranslate / attrib->yScale -
+ w->attrib.y, 0.0f);
+
+ filter = w->screen->filter[WINDOW_TRANS_FILTER];
+ } else if (mask & PAINT_WINDOW_ON_TRANSFORMED_SCREEN_MASK) {
+ filter = w->screen->filter[SCREEN_TRANS_FILTER];
+ } else {
+ filter = w->screen->filter[NOTHING_TRANS_FILTER];
+ }
+
+ /* if we can addjust saturation, even if it's just on and off */
+ if (w->screen->canDoSaturated
+ && attrib->saturation != COLOR) {
+ GLfloat constant[4];
+
+ /* if the paint mask has this set we want to blend */
+ if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
+ glEnable(GL_BLEND);
+
+ /* enable the texture */
+ enableTexture(w->screen, texture, filter);
+
+ /* texture combiner */
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
+ GL_COMBINE);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB,
+ GL_INTERPOLATE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB,
+ GL_TEXTURE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB,
+ GL_PRIMARY_COLOR);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB,
+ GL_PRIMARY_COLOR);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR); /* negate */
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB,
+ GL_SRC_COLOR);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB,
+ GL_SRC_ALPHA);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
+ GL_REPLACE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA,
+ GL_TEXTURE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA,
+ GL_SRC_ALPHA);
+
+ glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
+
+ /* make another texture active */
+ w->screen->activeTexture(GL_TEXTURE1_ARB);
+
+ /* enable that texture */
+ enableTexture(w->screen, texture, filter);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
+ GL_COMBINE);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB,
+ GL_DOT3_RGB);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB,
+ GL_PREVIOUS);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB,
+ GL_CONSTANT);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB,
+ GL_SRC_COLOR);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB,
+ GL_SRC_COLOR);
+
+ /* if we can do saturation that is in between min and max */
+ if (w->screen->canDoSlightlySaturated
+ && attrib->saturation > 0) {
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
+ GL_REPLACE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA,
+ GL_PREVIOUS);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+
+ constant[0] =
+ 0.5f + 0.5f * RED_SATURATION_WEIGHT;
+ constant[1] =
+ 0.5f + 0.5f * GREEN_SATURATION_WEIGHT;
+ constant[2] =
+ 0.5f + 0.5f * BLUE_SATURATION_WEIGHT;
+ constant[3] = 1.0;
+
+ glTexEnvfv(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_COLOR, constant);
+
+ /* mack another texture active */
+ w->screen->activeTexture(GL_TEXTURE2_ARB);
+
+ /* enable that texture */
+ enableTexture(w->screen, texture, filter);
+
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_MODE, GL_COMBINE);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB,
+ GL_INTERPOLATE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB,
+ GL_TEXTURE0);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB,
+ GL_PREVIOUS);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE2_RGB,
+ GL_CONSTANT);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR); /* negate */
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB,
+ GL_SRC_COLOR);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB,
+ GL_SRC_ALPHA);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
+ GL_REPLACE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA,
+ GL_PREVIOUS);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+
+ /* color constant */
+ constant[3] =
+ attrib->saturation / 65535.0f;
+
+ glTexEnvfv(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_COLOR, constant);
+
+ /* if we are not opaque or not fully bright */
+ if (attrib->opacity < OPAQUE
+ || attrib->brightness != BRIGHT) {
+ /* activate a new texture */
+ w->screen->
+ activeTexture(GL_TEXTURE3_ARB);
+
+ /* enable that texture */
+ enableTexture(w->screen, texture,
+ filter);
+
+ /* color constant */
+ constant[3] =
+ attrib->opacity / 65535.0f;
+ constant[0] = constant[1] =
+ constant[2] =
+ constant[3] *
+ attrib->brightness / 65535.0f;
+
+ glTexEnvfv(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_COLOR,
+ constant);
+
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_MODE,
+ GL_COMBINE);
+
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_COMBINE_RGB,
+ GL_MODULATE);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_SOURCE0_RGB,
+ GL_PREVIOUS);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_SOURCE1_RGB,
+ GL_CONSTANT);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND0_RGB,
+ GL_SRC_COLOR);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND1_RGB,
+ GL_SRC_COLOR);
+
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_COMBINE_ALPHA,
+ GL_MODULATE);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_SOURCE0_ALPHA,
+ GL_PREVIOUS);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_SOURCE1_ALPHA,
+ GL_CONSTANT);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND0_ALPHA,
+ GL_SRC_ALPHA);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND1_ALPHA,
+ GL_SRC_ALPHA);
+
+ /* draw the window geometry */
+ (*w->screen->
+ drawWindowGeometry) (w);
+
+ /* disable the current texture */
+ disableTexture(w->screen, texture);
+
+ /* set texture mode back to replace */
+ glTexEnvi(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_MODE,
+ GL_REPLACE);
+
+ /* re-activate last texture */
+ w->screen->
+ activeTexture(GL_TEXTURE2_ARB);
+ } else {
+ /* fully opaque and bright */
+
+ /* draw the window geometry */
+ (*w->screen->
+ drawWindowGeometry) (w);
+ }
+
+ /* disable the current texture */
+ disableTexture(w->screen, texture);
+
+ /* set the texture mode back to replace */
+ glTexEnvi(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_MODE, GL_REPLACE);
+
+ /* re-activate last texture */
+ w->screen->activeTexture(GL_TEXTURE1_ARB);
+ } else {
+ /* fully saturated or fully unsaturated */
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
+ GL_MODULATE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA,
+ GL_PREVIOUS);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA,
+ GL_CONSTANT);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
+
+ /* color constant */
+ constant[3] = attrib->opacity / 65535.0f;
+ constant[0] = constant[1] = constant[2] =
+ constant[3] * attrib->brightness /
+ 65535.0f;
+
+ constant[0] =
+ 0.5f +
+ 0.5f * RED_SATURATION_WEIGHT *
+ constant[0];
+ constant[1] =
+ 0.5f +
+ 0.5f * GREEN_SATURATION_WEIGHT *
+ constant[1];
+ constant[2] =
+ 0.5f +
+ 0.5f * BLUE_SATURATION_WEIGHT *
+ constant[2];
+
+ glTexEnvfv(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_COLOR, constant);
+
+ /* draw the window geometry */
+ (*w->screen->drawWindowGeometry) (w);
+ }
+
+ /* disable the current texture */
+ disableTexture(w->screen, texture);
+
+ /* set the texture mode back to replace */
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
+ GL_REPLACE);
+
+ /* re-activate last texture */
+ w->screen->activeTexture(GL_TEXTURE0_ARB);
+
+ /* disable that texture */
+ disableTexture(w->screen, texture);
+
+ /* set the default color */
+ glColor4usv(defaultColor);
+
+ /* set screens texture mode back to replace */
+ screenTexEnvMode(w->screen, GL_REPLACE);
+
+ /* if it's a translucent window, disable blending */
+ if (mask & PAINT_WINDOW_TRANSLUCENT_MASK)
+ glDisable(GL_BLEND);
+ } else {
+ /* no saturation adjustments */
+
+ /* enable the current texture */
+ enableTexture(w->screen, texture, filter);
+
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
+ GL_COMBINE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB,
+ GL_REPLACE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB,
+ GL_TEXTURE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR); /* negate */
+
+
+ /* we are not opaque or fully bright */
+ if ((mask & PAINT_WINDOW_TRANSLUCENT_MASK)
+ || attrib->brightness != BRIGHT) {
+ GLfloat constant[4];
+
+ /* enable blending */
+ glEnable(GL_BLEND);
+
+ /* color constant */
+ constant[3] = attrib->opacity / 65535.0f;
+ constant[0] =
+ constant[3] * attrib->brightness /
+ 65535.0f;
+ constant[1] =
+ constant[3] * attrib->brightness /
+ 65535.0f;
+ constant[2] =
+ constant[3] * attrib->brightness /
+ 65535.0f;
+ glTexEnvfv(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_COLOR, constant);
+
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB,
+ GL_MODULATE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB,
+ GL_TEXTURE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB,
+ GL_CONSTANT);
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR); /* negate */
+ glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB,
+ GL_SRC_COLOR);
+
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_TEXTURE_ENV_MODE, GL_COMBINE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_ALPHA,
+ GL_MODULATE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_ALPHA,
+ GL_TEXTURE);
+ glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_ALPHA,
+ GL_CONSTANT);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
+ glTexEnvf(GL_TEXTURE_ENV,
+ GL_OPERAND1_ALPHA, GL_SRC_ALPHA);
+
+ /* draw the window geometry */
+ (*w->screen->drawWindowGeometry) (w);
+
+ /* disable blending */
+ glDisable(GL_BLEND);
+
+ } else {
+ /* no adjustments to saturation, brightness or opacity */
+
+ /* draw the window geometry */
+ (*w->screen->drawWindowGeometry) (w);
+ }
+
+ /* disable the current texture */
+ disableTexture(w->screen, texture);
+
+ /* set the screens texture mode back to replace */
+ screenTexEnvMode(w->screen, GL_REPLACE);
+ }
+ /* pop previous matrix */
+ glPopMatrix();
+ } else {
+ /* not negative */
+ UNWRAP(ns, w->screen, drawWindowTexture);
+ (*w->screen->drawWindowTexture) (w, texture, attrib, mask);
+ WRAP(ns, w->screen, drawWindowTexture,
+ NEGDrawWindowTexture);
+ }
}
-static Bool
-NEGDamageWindowRect (CompWindow * w, Bool initial, BoxPtr rect)
+static Bool NEGDamageWindowRect(CompWindow * w, Bool initial, BoxPtr rect)
{
- int status;
+ int status;
- NEG_SCREEN (w->screen);
- NEG_WINDOW (w);
+ NEG_SCREEN(w->screen);
+ NEG_WINDOW(w);
- /* the window is initial when it is being mapped */
- if (initial)
- {
- /* if the screen is negative, negate the new window */
- if (ns->isNeg && !nw->isNeg)
- NEGToggle (w);
- }
+ /* the window is initial when it is being mapped */
+ if (initial) {
+ /* if the screen is negative, negate the new window */
+ if (ns->isNeg && !nw->isNeg)
+ NEGToggle(w);
+ }
- UNWRAP (ns, w->screen, damageWindowRect);
- status = (*w->screen->damageWindowRect) (w, initial, rect);
- WRAP (ns, w->screen, damageWindowRect, NEGDamageWindowRect);
+ UNWRAP(ns, w->screen, damageWindowRect);
+ status = (*w->screen->damageWindowRect) (w, initial, rect);
+ WRAP(ns, w->screen, damageWindowRect, NEGDamageWindowRect);
- return status;
+ return status;
}
static Bool
-NEGPaintWindow (CompWindow * w, const WindowPaintAttrib * attrib,
- Region region, unsigned int mask)
+NEGPaintWindow(CompWindow * w, const WindowPaintAttrib * attrib,
+ Region region, unsigned int mask)
{
- int status;
+ int status;
- NEG_SCREEN (w->screen);
+ NEG_SCREEN(w->screen);
- /* doing nothing */
+ /* doing nothing */
- UNWRAP (ns, w->screen, paintWindow);
- status = (*w->screen->paintWindow) (w, attrib, region, mask);
- WRAP (ns, w->screen, paintWindow, NEGPaintWindow);
+ UNWRAP(ns, w->screen, paintWindow);
+ status = (*w->screen->paintWindow) (w, attrib, region, mask);
+ WRAP(ns, w->screen, paintWindow, NEGPaintWindow);
- return status;
+ return status;
}
-static void
-NEGDisplayInitOptions (NEGDisplay * nd)
+static void NEGDisplayInitOptions(NEGDisplay * nd)
{
- CompOption *o;
-
- o = &nd->opt[NEG_DISPLAY_OPTION_WINDOW_TOGGLE];
- o->name = "window_toggle";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Toggle Window Negative");
- o->longDesc = N_("Toggle window negative");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = negToggle;
- o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = CompBindingTypeKey;
- o->value.action.state = CompActionStateInitKey;
- o->value.action.state |= CompActionStateInitButton;
- o->value.action.key.modifiers = NEG_TOGGLE_MODIFIERS_DEFAULT;
- o->value.action.key.keysym =
- XStringToKeysym (NEG_TOGGLE_KEY_DEFAULT);
-
- o = &nd->opt[NEG_DISPLAY_OPTION_SCREEN_TOGGLE];
- o->name = "screen_toggle";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Toggle Screen Negative");
- o->longDesc = N_("Toggle screen negative");
- o->type = CompOptionTypeAction;
- o->value.action.initiate = negToggleAll;
- o->value.action.terminate = 0;
- o->value.action.bell = FALSE;
- o->value.action.edgeMask = 0;
- o->value.action.type = CompBindingTypeKey;
- o->value.action.state = CompActionStateInitKey;
- o->value.action.state |= CompActionStateInitButton;
- o->value.action.key.modifiers = NEG_TOGGLE_ALL_MODIFIERS_DEFAULT;
- o->value.action.key.keysym =
- XStringToKeysym (NEG_TOGGLE_ALL_KEY_DEFAULT);
+ CompOption *o;
+
+ o = &nd->opt[NEG_DISPLAY_OPTION_WINDOW_TOGGLE];
+ o->name = "window_toggle";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Toggle Window Negative");
+ o->longDesc = N_("Toggle window negative");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = negToggle;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.state = CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.key.modifiers = NEG_TOGGLE_MODIFIERS_DEFAULT;
+ o->value.action.key.keysym =
+ XStringToKeysym(NEG_TOGGLE_KEY_DEFAULT);
+
+ o = &nd->opt[NEG_DISPLAY_OPTION_SCREEN_TOGGLE];
+ o->name = "screen_toggle";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Toggle Screen Negative");
+ o->longDesc = N_("Toggle screen negative");
+ o->type = CompOptionTypeAction;
+ o->value.action.initiate = negToggleAll;
+ o->value.action.terminate = 0;
+ o->value.action.bell = FALSE;
+ o->value.action.edgeMask = 0;
+ o->value.action.type = CompBindingTypeKey;
+ o->value.action.state = CompActionStateInitKey;
+ o->value.action.state |= CompActionStateInitButton;
+ o->value.action.key.modifiers = NEG_TOGGLE_ALL_MODIFIERS_DEFAULT;
+ o->value.action.key.keysym =
+ XStringToKeysym(NEG_TOGGLE_ALL_KEY_DEFAULT);
}
-static CompOption *
-NEGGetDisplayOptions (CompDisplay * display, int *count)
+static CompOption *NEGGetDisplayOptions(CompDisplay * display, int *count)
{
- if (display)
- {
- NEG_DISPLAY (display);
-
- *count = NUM_OPTIONS (nd);
- return nd->opt;
- }
- else
- {
- NEGDisplay * nd=malloc(sizeof(NEGDisplay));
- NEGDisplayInitOptions(nd);
- *count = NUM_OPTIONS(nd);
- return nd->opt;
- }
+ if (display) {
+ NEG_DISPLAY(display);
+
+ *count = NUM_OPTIONS(nd);
+ return nd->opt;
+ } else {
+ NEGDisplay *nd = malloc(sizeof(NEGDisplay));
+ NEGDisplayInitOptions(nd);
+ *count = NUM_OPTIONS(nd);
+ return nd->opt;
+ }
}
static Bool
-NEGSetDisplayOption (CompDisplay * display, char *name,
- CompOptionValue * value)
+NEGSetDisplayOption(CompDisplay * display, char *name,
+ CompOptionValue * value)
{
- CompOption *o;
- int index;
-
- NEG_DISPLAY (display);
-
- o = compFindOption (nd->opt, NUM_OPTIONS (nd), name, &index);
- if (!o)
- return FALSE;
-
- switch (index)
- {
- case NEG_DISPLAY_OPTION_WINDOW_TOGGLE:
- case NEG_DISPLAY_OPTION_SCREEN_TOGGLE:
- if (setDisplayAction (display, o, value))
- return TRUE;
- break;
-
- default:
- break;
- }
- return FALSE;
+ CompOption *o;
+ int index;
+
+ NEG_DISPLAY(display);
+
+ o = compFindOption(nd->opt, NUM_OPTIONS(nd), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index) {
+ case NEG_DISPLAY_OPTION_WINDOW_TOGGLE:
+ case NEG_DISPLAY_OPTION_SCREEN_TOGGLE:
+ if (setDisplayAction(display, o, value))
+ return TRUE;
+ break;
+
+ default:
+ break;
+ }
+ return FALSE;
}
-static Bool
-NEGInitDisplay (CompPlugin * p, CompDisplay * d)
+static Bool NEGInitDisplay(CompPlugin * p, CompDisplay * d)
{
- NEGDisplay *nd;
+ NEGDisplay *nd;
- nd = malloc (sizeof (NEGDisplay));
- if (!nd)
- return FALSE;
+ nd = malloc(sizeof(NEGDisplay));
+ if (!nd)
+ return FALSE;
- nd->screenPrivateIndex = allocateScreenPrivateIndex (d);
- if (nd->screenPrivateIndex < 0)
- {
- free (nd);
- return FALSE;
- }
+ nd->screenPrivateIndex = allocateScreenPrivateIndex(d);
+ if (nd->screenPrivateIndex < 0) {
+ free(nd);
+ return FALSE;
+ }
- /* initialize the display options */
- NEGDisplayInitOptions (nd);
+ /* initialize the display options */
+ NEGDisplayInitOptions(nd);
- d->privates[displayPrivateIndex].ptr = nd;
+ d->privates[displayPrivateIndex].ptr = nd;
- return TRUE;
+ return TRUE;
}
-static void
-NEGFiniDisplay (CompPlugin * p, CompDisplay * d)
+static void NEGFiniDisplay(CompPlugin * p, CompDisplay * d)
{
- NEG_DISPLAY (d);
- freeScreenPrivateIndex (d, nd->screenPrivateIndex);
- free (nd);
+ NEG_DISPLAY(d);
+ freeScreenPrivateIndex(d, nd->screenPrivateIndex);
+ free(nd);
}
-static void
-NEGScreenInitOptions (NEGScreen * ns)
+static void NEGScreenInitOptions(NEGScreen * ns)
{
- CompOption *o;
- int i;
-
- o = &ns->opt[NEG_SCREEN_OPTION_EXCLUDE_WINDOW_TYPE];
- o->name = "exclude_window_types";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Exclude Window Types");
- o->longDesc = N_("Window types that should not be negated");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = N_EXCLUDE_WIN_TYPE;
- o->value.list.value = malloc (sizeof (CompOptionValue) * N_EXCLUDE_WIN_TYPE);
- for (i = 0; i < N_EXCLUDE_WIN_TYPE; i++)
- o->value.list.value[i].s = strdup (excludeWinType[i]);
- o->rest.s.string = (char **)windowTypeString;
- o->rest.s.nString = nWindowTypeString;
-
- ns->excludeWMask = compWindowTypeMaskFromStringList (&o->value);
-
- o = &ns->opt[NEG_SCREEN_OPTION_EXCLUDE_LIST];
- o->name = "exclude_list";
- o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("WM_CLASS to exclude");
- o->longDesc = N_("Window classes which should not be nagated");
- o->type = CompOptionTypeList;
- o->value.list.type = CompOptionTypeString;
- o->value.list.nValue = 0;
- o->value.list.value = 0;
- o->rest.s.string = 0;
- o->rest.s.nString = 0;
+ CompOption *o;
+ int i;
+
+ o = &ns->opt[NEG_SCREEN_OPTION_EXCLUDE_WINDOW_TYPE];
+ o->name = "exclude_window_types";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("Exclude Window Types");
+ o->longDesc = N_("Window types that should not be negated");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = N_EXCLUDE_WIN_TYPE;
+ o->value.list.value =
+ malloc(sizeof(CompOptionValue) * N_EXCLUDE_WIN_TYPE);
+ for (i = 0; i < N_EXCLUDE_WIN_TYPE; i++)
+ o->value.list.value[i].s = strdup(excludeWinType[i]);
+ o->rest.s.string = (char **) windowTypeString;
+ o->rest.s.nString = nWindowTypeString;
+
+ ns->excludeWMask = compWindowTypeMaskFromStringList(&o->value);
+
+ o = &ns->opt[NEG_SCREEN_OPTION_EXCLUDE_LIST];
+ o->name = "exclude_list";
+ o->group = N_("");
+ o->subGroup = N_("");
+ o->displayHints = "";
+ o->shortDesc = N_("WM_CLASS to exclude");
+ o->longDesc = N_("Window classes which should not be nagated");
+ o->type = CompOptionTypeList;
+ o->value.list.type = CompOptionTypeString;
+ o->value.list.nValue = 0;
+ o->value.list.value = 0;
+ o->rest.s.string = 0;
+ o->rest.s.nString = 0;
}
-static CompOption *
-NEGGetScreenOptions (CompScreen * screen, int *count)
+static CompOption *NEGGetScreenOptions(CompScreen * screen, int *count)
{
- if (screen)
- {
- NEG_SCREEN (screen);
- *count = NUM_OPTIONS (ns);
- return ns->opt;
- }
- else
- {
- NEGScreen *ns = malloc (sizeof (NEGScreen));
- NEGScreenInitOptions (ns);
- *count = NUM_OPTIONS (ns);
- return ns->opt;
- }
+ if (screen) {
+ NEG_SCREEN(screen);
+ *count = NUM_OPTIONS(ns);
+ return ns->opt;
+ } else {
+ NEGScreen *ns = malloc(sizeof(NEGScreen));
+ NEGScreenInitOptions(ns);
+ *count = NUM_OPTIONS(ns);
+ return ns->opt;
+ }
}
static Bool
-NEGSetScreenOption (CompScreen * screen, char *name, CompOptionValue * value)
+NEGSetScreenOption(CompScreen * screen, char *name,
+ CompOptionValue * value)
{
- CompOption *o;
- int index;
-
- NEG_SCREEN (screen);
-
- o = compFindOption (ns->opt, NUM_OPTIONS (ns), name, &index);
- if (!o)
- return FALSE;
-
- switch (index)
- {
- case NEG_SCREEN_OPTION_EXCLUDE_WINDOW_TYPE:
- if (compSetOptionList (o, value))
- {
- ns->excludeWMask = compWindowTypeMaskFromStringList (&o->value);
- return TRUE;
- }
- break;
-
- case NEG_SCREEN_OPTION_EXCLUDE_LIST:
- if (compSetOptionList (o, value))
- return TRUE;
- break;
-
- default:
- break;
- }
-
- return FALSE;
+ CompOption *o;
+ int index;
+
+ NEG_SCREEN(screen);
+
+ o = compFindOption(ns->opt, NUM_OPTIONS(ns), name, &index);
+ if (!o)
+ return FALSE;
+
+ switch (index) {
+ case NEG_SCREEN_OPTION_EXCLUDE_WINDOW_TYPE:
+ if (compSetOptionList(o, value)) {
+ ns->excludeWMask =
+ compWindowTypeMaskFromStringList(&o->value);
+ return TRUE;
+ }
+ break;
+
+ case NEG_SCREEN_OPTION_EXCLUDE_LIST:
+ if (compSetOptionList(o, value))
+ return TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
}
-static Bool
-NEGInitScreen (CompPlugin * p, CompScreen * s)
+static Bool NEGInitScreen(CompPlugin * p, CompScreen * s)
{
- NEGScreen *ns;
- NEG_DISPLAY (s->display);
-
- ns = malloc (sizeof (NEGScreen));
- if (!ns)
- return FALSE;
-
- ns->windowPrivateIndex = allocateWindowPrivateIndex (s);
- if (ns->windowPrivateIndex < 0)
- {
- free (ns);
- return FALSE;
- }
-
- /* initialize the screen variables
- * you know what happens if you don't
- */
- ns->isNeg = FALSE;
-
- /* Initialize the screen options */
- NEGScreenInitOptions (ns);
-
- /* add screen actions */
- addScreenAction (s,
- &nd->opt[NEG_DISPLAY_OPTION_WINDOW_TOGGLE].value.action);
- addScreenAction (s,
- &nd->opt[NEG_DISPLAY_OPTION_SCREEN_TOGGLE].value.action);
-
- /* wrap overloaded functions */
- WRAP (ns, s, drawWindowTexture, NEGDrawWindowTexture);
- WRAP (ns, s, damageWindowRect, NEGDamageWindowRect);
- WRAP (ns, s, paintWindow, NEGPaintWindow);
-
- s->privates[nd->screenPrivateIndex].ptr = ns;
-
- return TRUE;
+ NEGScreen *ns;
+ NEG_DISPLAY(s->display);
+
+ ns = malloc(sizeof(NEGScreen));
+ if (!ns)
+ return FALSE;
+
+ ns->windowPrivateIndex = allocateWindowPrivateIndex(s);
+ if (ns->windowPrivateIndex < 0) {
+ free(ns);
+ return FALSE;
+ }
+
+ /* initialize the screen variables
+ * you know what happens if you don't
+ */
+ ns->isNeg = FALSE;
+
+ /* Initialize the screen options */
+ NEGScreenInitOptions(ns);
+
+ /* add screen actions */
+ addScreenAction(s,
+ &nd->opt[NEG_DISPLAY_OPTION_WINDOW_TOGGLE].value.
+ action);
+ addScreenAction(s,
+ &nd->opt[NEG_DISPLAY_OPTION_SCREEN_TOGGLE].value.
+ action);
+
+ /* wrap overloaded functions */
+ WRAP(ns, s, drawWindowTexture, NEGDrawWindowTexture);
+ WRAP(ns, s, damageWindowRect, NEGDamageWindowRect);
+ WRAP(ns, s, paintWindow, NEGPaintWindow);
+
+ s->privates[nd->screenPrivateIndex].ptr = ns;
+
+ return TRUE;
}
-static void
-NEGFiniScreen (CompPlugin * p, CompScreen * s)
+static void NEGFiniScreen(CompPlugin * p, CompScreen * s)
{
- NEG_SCREEN (s);
- NEG_DISPLAY (s->display);
- freeWindowPrivateIndex (s, ns->windowPrivateIndex);
- UNWRAP (ns, s, drawWindowTexture);
- UNWRAP (ns, s, damageWindowRect);
- UNWRAP (ns, s, paintWindow);
- removeScreenAction (s,
- &nd->opt[NEG_DISPLAY_OPTION_WINDOW_TOGGLE].value.action);
- removeScreenAction (s,
- &nd->opt[NEG_DISPLAY_OPTION_SCREEN_TOGGLE].value.action);
- free (ns);
+ NEG_SCREEN(s);
+ NEG_DISPLAY(s->display);
+ freeWindowPrivateIndex(s, ns->windowPrivateIndex);
+ UNWRAP(ns, s, drawWindowTexture);
+ UNWRAP(ns, s, damageWindowRect);
+ UNWRAP(ns, s, paintWindow);
+ removeScreenAction(s,
+ &nd->opt[NEG_DISPLAY_OPTION_WINDOW_TOGGLE].
+ value.action);
+ removeScreenAction(s,
+ &nd->opt[NEG_DISPLAY_OPTION_SCREEN_TOGGLE].
+ value.action);
+ free(ns);
}
-static Bool
-NEGInitWindow (CompPlugin * p, CompWindow * w)
+static Bool NEGInitWindow(CompPlugin * p, CompWindow * w)
{
- NEGWindow *nw;
+ NEGWindow *nw;
- NEG_SCREEN (w->screen);
+ NEG_SCREEN(w->screen);
- nw = malloc (sizeof (NEGWindow));
- if (!nw)
- return FALSE;
+ nw = malloc(sizeof(NEGWindow));
+ if (!nw)
+ return FALSE;
- nw->isNeg = FALSE;
+ nw->isNeg = FALSE;
- w->privates[ns->windowPrivateIndex].ptr = nw;
+ w->privates[ns->windowPrivateIndex].ptr = nw;
- return TRUE;
+ return TRUE;
}
-static void
-NEGFiniWindow (CompPlugin * p, CompWindow * w)
+static void NEGFiniWindow(CompPlugin * p, CompWindow * w)
{
- NEG_WINDOW (w);
- free (nw);
+ NEG_WINDOW(w);
+ free(nw);
}
-static Bool
-NEGInit (CompPlugin * p)
+static Bool NEGInit(CompPlugin * p)
{
- displayPrivateIndex = allocateDisplayPrivateIndex ();
- if (displayPrivateIndex < 0)
- return FALSE;
+ displayPrivateIndex = allocateDisplayPrivateIndex();
+ if (displayPrivateIndex < 0)
+ return FALSE;
- return TRUE;
+ return TRUE;
}
-static void
-NEGFini (CompPlugin * p)
+static void NEGFini(CompPlugin * p)
{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex(displayPrivateIndex);
}
CompPluginVTable NEGVTable = {
- "neg",
- N_("Negative"),
- N_("Used to set a window or the screen negative"),
- NEGInit,
- NEGFini,
- NEGInitDisplay,
- NEGFiniDisplay,
- NEGInitScreen,
- NEGFiniScreen,
- NEGInitWindow,
- NEGFiniWindow,
- NEGGetDisplayOptions,
- NEGSetDisplayOption,
- NEGGetScreenOptions,
- NEGSetScreenOption,
- NULL,
- 0,
- 0,
- 0,
- BERYL_ABI_INFO,
- "beryl-plugins"
+ "neg",
+ N_("Negative"),
+ N_("Used to set a window or the screen negative"),
+ NEGInit,
+ NEGFini,
+ NEGInitDisplay,
+ NEGFiniDisplay,
+ NEGInitScreen,
+ NEGFiniScreen,
+ NEGInitWindow,
+ NEGFiniWindow,
+ NEGGetDisplayOptions,
+ NEGSetDisplayOption,
+ NEGGetScreenOptions,
+ NEGSetScreenOption,
+ NULL,
+ 0,
+ 0,
+ 0,
+ BERYL_ABI_INFO,
+ "beryl-plugins"
};
-CompPluginVTable *
-getCompPluginInfo (void)
+CompPluginVTable *getCompPluginInfo(void)
{
- return &NEGVTable;
+ return &NEGVTable;
}