summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2007-08-27 10:53:25 +0200
committerDanny Baumann <dannybaumann@web.de>2007-08-27 10:53:25 +0200
commit6a944fa6eaf1a2459c9fbb0220854a6e97178c54 (patch)
tree16548b55d7ff52b3fa3e388a87c1871298f86781
parent4cffb8c65b46ff03f5fe0ed674b3d4c5161c9cb0 (diff)
downloadwinrules-6a944fa6eaf1a2459c9fbb0220854a6e97178c54.tar.gz
winrules-6a944fa6eaf1a2459c9fbb0220854a6e97178c54.tar.bz2
Added option to suppress ARGB visuals for matched windows.
-rw-r--r--winrules.c62
-rw-r--r--winrules.xml.in5
2 files changed, 56 insertions, 11 deletions
diff --git a/winrules.c b/winrules.c
index ac38f42..e457523 100644
--- a/winrules.c
+++ b/winrules.c
@@ -36,26 +36,28 @@
#define WINRULES_SCREEN_OPTION_BELOW_MATCH 3
#define WINRULES_SCREEN_OPTION_STICKY_MATCH 4
#define WINRULES_SCREEN_OPTION_FULLSCREEN_MATCH 5
-#define WINRULES_SCREEN_OPTION_NOMOVE_MATCH 6
-#define WINRULES_SCREEN_OPTION_NORESIZE_MATCH 7
-#define WINRULES_SCREEN_OPTION_NOMINIMIZE_MATCH 8
-#define WINRULES_SCREEN_OPTION_NOMAXIMIZE_MATCH 9
-#define WINRULES_SCREEN_OPTION_NOCLOSE_MATCH 10
-#define WINRULES_SCREEN_OPTION_NOFOCUS_MATCH 11
-#define WINRULES_SCREEN_OPTION_SIZE_MATCHES 12
-#define WINRULES_SCREEN_OPTION_SIZE_WIDTH_VALUES 13
-#define WINRULES_SCREEN_OPTION_SIZE_HEIGHT_VALUES 14
-#define WINRULES_SCREEN_OPTION_NUM 15
+#define WINRULES_SCREEN_OPTION_NOARGB_MATCH 6
+#define WINRULES_SCREEN_OPTION_NOMOVE_MATCH 7
+#define WINRULES_SCREEN_OPTION_NORESIZE_MATCH 8
+#define WINRULES_SCREEN_OPTION_NOMINIMIZE_MATCH 9
+#define WINRULES_SCREEN_OPTION_NOMAXIMIZE_MATCH 10
+#define WINRULES_SCREEN_OPTION_NOCLOSE_MATCH 11
+#define WINRULES_SCREEN_OPTION_NOFOCUS_MATCH 12
+#define WINRULES_SCREEN_OPTION_SIZE_MATCHES 13
+#define WINRULES_SCREEN_OPTION_SIZE_WIDTH_VALUES 14
+#define WINRULES_SCREEN_OPTION_SIZE_HEIGHT_VALUES 15
+#define WINRULES_SCREEN_OPTION_NUM 16
static CompMetadata winrulesMetadata;
static int displayPrivateIndex;
typedef struct _WinrulesWindow {
-
unsigned int allowedActions;
unsigned int stateSetMask;
unsigned int protocolSetMask;
+
+ Bool hasAlpha;
} WinrulesWindow;
typedef struct _WinrulesDisplay {
@@ -164,6 +166,24 @@ winrulesSetNoFocus (CompWindow *w,
}
static void
+winrulesSetNoAlpha (CompWindow *w,
+ int optNum)
+{
+ WINRULES_SCREEN (w->screen);
+ WINRULES_WINDOW (w);
+
+ if (matchEval (&ws->opt[optNum].value.match, w))
+ {
+ ww->hasAlpha = w->alpha;
+ w->alpha = FALSE;
+ }
+ else
+ {
+ w->alpha = ww->hasAlpha;
+ }
+}
+
+static void
winrulesUpdateState (CompWindow *w,
int optNum,
int mask)
@@ -366,6 +386,21 @@ winrulesSetScreenOption (CompPlugin *plugin,
if (compSetMatchOption (o, value))
updateActionsMask = CompWindowActionCloseMask;
break;
+ case WINRULES_SCREEN_OPTION_NOARGB_MATCH:
+ if (compSetMatchOption (o, value))
+ {
+ CompWindow *w;
+
+ for (w = screen->windows; w; w = w->next)
+ {
+ if (!w->type & WINRULES_TARGET_WINDOWS)
+ continue;
+
+ winrulesSetNoAlpha (w, WINRULES_SCREEN_OPTION_NOARGB_MATCH);
+ }
+ return TRUE;
+ }
+ break;
case WINRULES_SCREEN_OPTION_NOFOCUS_MATCH:
if (compSetMatchOption (o, value))
{
@@ -522,6 +557,8 @@ winrulesApplyRules (void *closure)
WINRULES_SCREEN_OPTION_NOCLOSE_MATCH,
CompWindowActionCloseMask);
+ winrulesSetNoAlpha (w, WINRULES_SCREEN_OPTION_NOARGB_MATCH);
+
if (winrulesMatchSize (w, &width, &height))
winrulesUpdateWindowSize (w, width, height);
@@ -608,6 +645,7 @@ static const CompMetadataOptionInfo winrulesScreenOptionInfo[] = {
{ "below_match", "match", 0, 0, 0 },
{ "sticky_match", "match", 0, 0, 0 },
{ "fullscreen_match", "match", 0, 0, 0 },
+ { "no_argb_match", "match", 0, 0, 0 },
{ "no_move_match", "match", 0, 0, 0 },
{ "no_resize_match", "match", 0, 0, 0 },
{ "no_minimize_match", "match", 0, 0, 0 },
@@ -687,6 +725,8 @@ winrulesInitWindow (CompPlugin *p,
ww->allowedActions = ~0;
+ ww->hasAlpha = w->alpha;
+
w->privates[ws->windowPrivateIndex].ptr = ww;
compAddTimeout (0, winrulesApplyRules, w);
diff --git a/winrules.xml.in b/winrules.xml.in
index 63edb43..3566fe7 100644
--- a/winrules.xml.in
+++ b/winrules.xml.in
@@ -37,6 +37,11 @@
<_long>Fullscreen windows</_long>
<default/>
</option>
+ <option name="no_argb_match" type="match">
+ <_short>No ARGB visuals</_short>
+ <_long>Windows that should be treated as not supporting transparency</_long>
+ <default/>
+ </option>
<option name="no_move_match" type="match">
<_short>Non movable windows</_short>
<_long>Set window as non movable</_long>