rendered paste body--- ../../trunk/beryl-plugins/src/neg.c 2006-11-26 09:49:23.000000000 -0600
+++ neg.c 2006-11-27 09:17:22.000000000 -0600
@@ -50,6 +50,9 @@
#define NEG_DISPLAY_OPTION_SCREEN_TOGGLE 1
#define NEG_DISPLAY_OPTION_NUM 2
+#define NEG_SCREEN_OPTION_EXCLUDE_LIST 0
+#define NEG_SCREEN_OPTION_NUM 1
+
static int displayPrivateIndex;
typedef struct _NEGDisplay
@@ -62,6 +65,7 @@
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 */
@@ -85,11 +89,24 @@
static void
NEGToggle (CompWindow * w)
{
+ CompOption *o;
+ int i;
+
+ NEG_SCREEN (w->screen);
NEG_WINDOW (w);
/* toggle window negative flag */
nw->isNeg = !nw->isNeg;
+ /* check exclude list */
+ 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);
}
@@ -534,7 +551,7 @@
static CompOption *
NEGGetDisplayOptions (CompDisplay * display, int *count)
{
- if (display)
+ if (display)
{
NEG_DISPLAY (display);
@@ -610,6 +627,67 @@
free (nd);
}
+static void
+NEGScreenInitOptions (NEGScreen * ns)
+{
+ CompOption *o;
+
+ o = &ns->opt[NEG_SCREEN_OPTION_EXCLUDE_LIST];
+ o->name = "exclude_list";
+ o->shortDesc = N_("WM_CLASS to exclude");
+ o->longDesc = N_("Windows classes to exclude from negating");
+ 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)
+{
+ 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)
+{
+ 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_LIST:
+ if (compSetOptionList (o, value))
+ return TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
static Bool
NEGInitScreen (CompPlugin * p, CompScreen * s)
{
@@ -721,8 +799,8 @@
NEGFiniWindow,
NEGGetDisplayOptions,
NEGSetDisplayOption,
- 0, /* GetScreenOptions */
- 0, /* SetScreenOption */
+ NEGGetScreenOptions,
+ NEGSetScreenOption,
NULL,
0,
0,