summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Thomas <markbt@efaref.net>2008-02-10 14:15:02 +0000
committerMark Thomas <markbt@efaref.net>2008-02-10 14:15:02 +0000
commitd41f3ba3791a111d7cc12268003fbbc0929c2e49 (patch)
treea9b641d983bde5b90515b3eae1d591c3c0a0e4a8
parent21a6a8a7398ca1b8bee8d6495105257832c0e75c (diff)
downloadstatic-d41f3ba3791a111d7cc12268003fbbc0929c2e49.tar.gz
static-d41f3ba3791a111d7cc12268003fbbc0929c2e49.tar.bz2
Rename to "static"
-rw-r--r--plugin.info2
-rw-r--r--static.c281
-rw-r--r--static.xml.in (renamed from staticdock.xml.in)6
-rw-r--r--staticdock.c281
4 files changed, 285 insertions, 285 deletions
diff --git a/plugin.info b/plugin.info
index 994dfb5..684dd63 100644
--- a/plugin.info
+++ b/plugin.info
@@ -1 +1 @@
-PLUGIN = staticdock
+PLUGIN = static
diff --git a/static.c b/static.c
new file mode 100644
index 0000000..3ff6fb4
--- /dev/null
+++ b/static.c
@@ -0,0 +1,281 @@
+/*
+ * Compiz Static Windows plugin
+ *
+ * static.c
+ *
+ * Copyright : (C) 2008 by Mark Thomas
+ * E-mail : markbt@efaref.net
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <stdlib.h>
+#include <compiz.h>
+
+#include "static_options.h"
+
+static int displayPrivateIndex;
+
+typedef struct _StaticDisplay
+{
+ int screenPrivateIndex;
+}
+StaticDisplay;
+
+typedef enum _StaticMode
+{
+ STATIC_ALL,
+ STATIC_NORMAL,
+ STATIC_STATIC
+}
+StaticMode;
+
+typedef struct _StaticScreen
+{
+ PaintWindowProc paintWindow;
+ PaintOutputProc paintOutput;
+ PaintTransformedOutputProc paintTransformedOutput;
+
+ StaticMode staticMode;
+}
+StaticScreen;
+
+#define GET_STATIC_DISPLAY(d) \
+ ((StaticDisplay *) (d)->privates[displayPrivateIndex].ptr)
+#define STATIC_DISPLAY(d) \
+ StaticDisplay *sd = GET_STATIC_DISPLAY(d);
+
+#define GET_STATIC_SCREEN(s, sd) \
+ ((StaticScreen *) (s)->privates[(sd)->screenPrivateIndex].ptr)
+#define STATIC_SCREEN(s) \
+ StaticScreen *ss = GET_STATIC_SCREEN(s, GET_STATIC_DISPLAY(s->display))
+
+static Bool
+isStatic(CompWindow *w)
+{
+ return matchEval(staticGetWindowMatch(w->screen), w);
+}
+
+static void
+staticPaintTransformedOutput (CompScreen *s,
+ const ScreenPaintAttrib *sAttrib,
+ const CompTransform *transform,
+ Region region,
+ CompOutput *output,
+ unsigned int mask)
+{
+ STATIC_SCREEN(s);
+
+ /* We are now painting in transformed mode.
+ * Start painting only normal windows.
+ */
+ ss->staticMode = STATIC_NORMAL;
+
+ UNWRAP (ss, s, paintTransformedOutput);
+ (*s->paintTransformedOutput) (s, sAttrib, transform, region, output, mask);
+ WRAP (ss, s, paintTransformedOutput, staticPaintTransformedOutput);
+}
+
+static Bool
+staticPaintOutput(CompScreen *s,
+ const ScreenPaintAttrib *sAttrib,
+ const CompTransform *transform,
+ Region region,
+ CompOutput *output,
+ unsigned int mask)
+{
+ Bool status;
+
+ STATIC_SCREEN (s);
+
+ /* Initially we are painting all windows.
+ * This may change if we switch to transformed mode.
+ */
+ ss->staticMode = STATIC_ALL;
+
+ UNWRAP (ss, s, paintOutput);
+ status = (*s->paintOutput) (s, sAttrib, transform, region,
+ output, mask);
+ WRAP (ss, s, paintOutput, staticPaintOutput);
+
+ if ( ss->staticMode == STATIC_NORMAL )
+ {
+ /* We switched to Transformed mode somewhere along the line.
+ * Now paint the dock windows untransformed by bypassing
+ * the virtual table.
+ */
+
+ ss->staticMode = STATIC_STATIC;
+
+ paintTransformedOutput (s, sAttrib, transform, &s->region,
+ output, mask);
+
+ ss->staticMode = STATIC_NORMAL;
+ }
+
+ return status;
+}
+
+
+static Bool
+staticPaintWindow (CompWindow *w,
+ const WindowPaintAttrib *attrib,
+ const CompTransform *transform,
+ Region region,
+ unsigned int mask)
+{
+ CompScreen *s = w->screen;
+ Bool status = TRUE;
+ STATIC_SCREEN (s);
+
+ if (ss->staticMode == STATIC_STATIC && !isStatic(w))
+ {
+ /* We are not painting normal windows */
+ return FALSE;
+ }
+
+ if (ss->staticMode == STATIC_NORMAL && isStatic(w))
+ {
+ /* We are not painting static windows */
+ return FALSE;
+ }
+
+ UNWRAP (ss, s, paintWindow);
+ status = (*s->paintWindow) (w, attrib, transform, region, mask);
+ WRAP (ss, s, paintWindow, staticPaintWindow);
+
+ return status;
+}
+
+
+static Bool
+staticInitScreen (CompPlugin *p,
+ CompScreen *s)
+{
+ StaticScreen *ss;
+
+ STATIC_DISPLAY (s->display);
+
+ ss = calloc (1, sizeof (StaticScreen) );
+
+ if (!ss)
+ return FALSE;
+
+ WRAP (ss, s, paintWindow, staticPaintWindow);
+ WRAP (ss, s, paintOutput, staticPaintOutput);
+ WRAP (ss, s, paintTransformedOutput, staticPaintTransformedOutput);
+
+ s->privates[sd->screenPrivateIndex].ptr = ss;
+
+ return TRUE;
+}
+
+static void
+staticFiniScreen (CompPlugin *p,
+ CompScreen *s)
+{
+ STATIC_SCREEN (s);
+
+ UNWRAP (ss, s, paintTransformedOutput);
+ UNWRAP (ss, s, paintOutput);
+ UNWRAP (ss, s, paintWindow);
+
+ free (ss);
+}
+
+static Bool
+staticInitDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ StaticDisplay *sd;
+
+ sd = malloc (sizeof (StaticDisplay) );
+
+ if (!sd)
+ return FALSE;
+
+ sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
+
+ if (sd->screenPrivateIndex < 0)
+ {
+ free (sd);
+ return FALSE;
+ }
+
+ d->privates[displayPrivateIndex].ptr = sd;
+
+ return TRUE;
+}
+
+static void
+staticFiniDisplay (CompPlugin *p,
+ CompDisplay *d)
+{
+ STATIC_DISPLAY (d);
+
+ freeScreenPrivateIndex (d, sd->screenPrivateIndex);
+
+ free (sd);
+}
+
+static Bool
+staticInit (CompPlugin *p)
+{
+ displayPrivateIndex = allocateDisplayPrivateIndex();
+
+ printf("DPI:%d\n", displayPrivateIndex);
+
+ if (displayPrivateIndex < 0)
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+staticFini (CompPlugin *p)
+{
+ if (displayPrivateIndex >= 0)
+ freeDisplayPrivateIndex (displayPrivateIndex);
+}
+
+static int
+staticGetVersion (CompPlugin *plugin,
+ int version)
+{
+ return ABIVERSION;
+}
+
+CompPluginVTable staticVTable = {
+
+ "static",
+ staticGetVersion,
+ 0,
+ staticInit,
+ staticFini,
+ staticInitDisplay,
+ staticFiniDisplay,
+ staticInitScreen,
+ staticFiniScreen,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+};
+
+CompPluginVTable *
+getCompPluginInfo (void)
+{
+ return &staticVTable;
+}
diff --git a/staticdock.xml.in b/static.xml.in
index 988f213..109b7a7 100644
--- a/staticdock.xml.in
+++ b/static.xml.in
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<compiz>
- <plugin name="staticdock" useBcop="true">
- <_short>Static Dock</_short>
- <_long>Keep dock or panel windows static</_long>
+ <plugin name="static" useBcop="true">
+ <_short>Static Windows</_short>
+ <_long>Keep windows such as dock or panels static</_long>
<category>Desktop</category>
<deps>
<relation type="before">
diff --git a/staticdock.c b/staticdock.c
deleted file mode 100644
index 2abaaa5..0000000
--- a/staticdock.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Compiz Static Dock plugin
- *
- * staticdock.c
- *
- * Copyright : (C) 2008 by Mark Thomas
- * E-mail : markbt@efaref.net
- *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- */
-
-#include <stdlib.h>
-#include <compiz.h>
-
-#include "staticdock_options.h"
-
-static int displayPrivateIndex;
-
-typedef struct _StaticDockDisplay
-{
- int screenPrivateIndex;
-}
-StaticDockDisplay;
-
-typedef enum _StaticDockMode
-{
- STATICDOCK_ALL,
- STATICDOCK_NORMAL,
- STATICDOCK_DOCK
-}
-StaticDockMode;
-
-typedef struct _StaticDockScreen
-{
- PaintWindowProc paintWindow;
- PaintOutputProc paintOutput;
- PaintTransformedOutputProc paintTransformedOutput;
-
- StaticDockMode staticdockMode;
-}
-StaticDockScreen;
-
-#define GET_STATICDOCK_DISPLAY(d) \
- ((StaticDockDisplay *) (d)->privates[displayPrivateIndex].ptr)
-#define STATICDOCK_DISPLAY(d) \
- StaticDockDisplay *sd = GET_STATICDOCK_DISPLAY(d);
-
-#define GET_STATICDOCK_SCREEN(s, sd) \
- ((StaticDockScreen *) (s)->privates[(sd)->screenPrivateIndex].ptr)
-#define STATICDOCK_SCREEN(s) \
- StaticDockScreen *ss = GET_STATICDOCK_SCREEN(s, GET_STATICDOCK_DISPLAY(s->display))
-
-static Bool
-isDock(CompWindow *w)
-{
- return matchEval(staticdockGetWindowMatch(w->screen), w);
-}
-
-static void
-staticdockPaintTransformedOutput (CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask)
-{
- STATICDOCK_SCREEN(s);
-
- /* We are now painting in transformed mode.
- * Start painting only normal windows.
- */
- ss->staticdockMode = STATICDOCK_NORMAL;
-
- UNWRAP (ss, s, paintTransformedOutput);
- (*s->paintTransformedOutput) (s, sAttrib, transform, region, output, mask);
- WRAP (ss, s, paintTransformedOutput, staticdockPaintTransformedOutput);
-}
-
-static Bool
-staticdockPaintOutput(CompScreen *s,
- const ScreenPaintAttrib *sAttrib,
- const CompTransform *transform,
- Region region,
- CompOutput *output,
- unsigned int mask)
-{
- Bool status;
-
- STATICDOCK_SCREEN (s);
-
- /* Initially we are painting all windows.
- * This may change if we switch to transformed mode.
- */
- ss->staticdockMode = STATICDOCK_ALL;
-
- UNWRAP (ss, s, paintOutput);
- status = (*s->paintOutput) (s, sAttrib, transform, region,
- output, mask);
- WRAP (ss, s, paintOutput, staticdockPaintOutput);
-
- if ( ss->staticdockMode == STATICDOCK_NORMAL )
- {
- /* We switched to Transformed mode somewhere along the line.
- * Now paint the dock windows untransformed by bypassing
- * the virtual table.
- */
-
- ss->staticdockMode = STATICDOCK_DOCK;
-
- paintTransformedOutput (s, sAttrib, transform, &s->region,
- output, mask);
-
- ss->staticdockMode = STATICDOCK_NORMAL;
- }
-
- return status;
-}
-
-
-static Bool
-staticdockPaintWindow (CompWindow *w,
- const WindowPaintAttrib *attrib,
- const CompTransform *transform,
- Region region,
- unsigned int mask)
-{
- CompScreen *s = w->screen;
- Bool status = TRUE;
- STATICDOCK_SCREEN (s);
-
- if (ss->staticdockMode == STATICDOCK_DOCK && !isDock(w))
- {
- /* We are not painting normal windows */
- return FALSE;
- }
-
- if (ss->staticdockMode == STATICDOCK_NORMAL && isDock(w))
- {
- /* We are not painting dock windows */
- return FALSE;
- }
-
- UNWRAP (ss, s, paintWindow);
- status = (*s->paintWindow) (w, attrib, transform, region, mask);
- WRAP (ss, s, paintWindow, staticdockPaintWindow);
-
- return status;
-}
-
-
-static Bool
-staticdockInitScreen (CompPlugin *p,
- CompScreen *s)
-{
- StaticDockScreen *ss;
-
- STATICDOCK_DISPLAY (s->display);
-
- ss = calloc (1, sizeof (StaticDockScreen) );
-
- if (!ss)
- return FALSE;
-
- WRAP (ss, s, paintWindow, staticdockPaintWindow);
- WRAP (ss, s, paintOutput, staticdockPaintOutput);
- WRAP (ss, s, paintTransformedOutput, staticdockPaintTransformedOutput);
-
- s->privates[sd->screenPrivateIndex].ptr = ss;
-
- return TRUE;
-}
-
-static void
-staticdockFiniScreen (CompPlugin *p,
- CompScreen *s)
-{
- STATICDOCK_SCREEN (s);
-
- UNWRAP (ss, s, paintTransformedOutput);
- UNWRAP (ss, s, paintOutput);
- UNWRAP (ss, s, paintWindow);
-
- free (ss);
-}
-
-static Bool
-staticdockInitDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- StaticDockDisplay *sd;
-
- sd = malloc (sizeof (StaticDockDisplay) );
-
- if (!sd)
- return FALSE;
-
- sd->screenPrivateIndex = allocateScreenPrivateIndex (d);
-
- if (sd->screenPrivateIndex < 0)
- {
- free (sd);
- return FALSE;
- }
-
- d->privates[displayPrivateIndex].ptr = sd;
-
- return TRUE;
-}
-
-static void
-staticdockFiniDisplay (CompPlugin *p,
- CompDisplay *d)
-{
- STATICDOCK_DISPLAY (d);
-
- freeScreenPrivateIndex (d, sd->screenPrivateIndex);
-
- free (sd);
-}
-
-static Bool
-staticdockInit (CompPlugin *p)
-{
- displayPrivateIndex = allocateDisplayPrivateIndex();
-
- printf("DPI:%d\n", displayPrivateIndex);
-
- if (displayPrivateIndex < 0)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-staticdockFini (CompPlugin *p)
-{
- if (displayPrivateIndex >= 0)
- freeDisplayPrivateIndex (displayPrivateIndex);
-}
-
-static int
-staticdockGetVersion (CompPlugin *plugin,
- int version)
-{
- return ABIVERSION;
-}
-
-CompPluginVTable staticdockVTable = {
-
- "staticdock",
- staticdockGetVersion,
- 0,
- staticdockInit,
- staticdockFini,
- staticdockInitDisplay,
- staticdockFiniDisplay,
- staticdockInitScreen,
- staticdockFiniScreen,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
-};
-
-CompPluginVTable *
-getCompPluginInfo (void)
-{
- return &staticdockVTable;
-}