summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Riedi <andrewriedi@gmail.com>2007-06-12 12:17:35 -0700
committerAndrew Riedi <andrewriedi@gmail.com>2007-06-12 12:17:35 -0700
commit1664bc208001020107e28ea84d8f90bfc9b3bb53 (patch)
treeed1d8cbbe78c6e82d2f6ecf8915888f69ad320d8
parent8b280608237835b88fb83b3d8d402a42bdce0be8 (diff)
downloadworkarounds-1664bc208001020107e28ea84d8f90bfc9b3bb53.tar.gz
workarounds-1664bc208001020107e28ea84d8f90bfc9b3bb53.tar.bz2
Make plug-in respect the options.
-rw-r--r--plugin.info1
-rw-r--r--workarounds.c60
-rw-r--r--workarounds.h37
3 files changed, 87 insertions, 11 deletions
diff --git a/plugin.info b/plugin.info
index eadfbe2..ada615e 100644
--- a/plugin.info
+++ b/plugin.info
@@ -1 +1,2 @@
PLUGIN = workarounds
+CFLAGS_ADD = -I./build
diff --git a/workarounds.c b/workarounds.c
index 79aa936..96fb071 100644
--- a/workarounds.c
+++ b/workarounds.c
@@ -19,28 +19,60 @@
*/
#include <compiz.h>
+#include <workarounds_options.h>
+#include "workarounds.h"
static CompMetadata workaroundsMetadata;
static int displayPrivateIndex;
+static void workaroundsDisplayOptionChanged( CompDisplay *d, CompOption *opt,
+ WorkaroundsDisplayOptions num )
+{
+ WORKAROUNDS_DISPLAY( d );
+
+ switch( num ) {
+ case WorkaroundsDisplayOptionLegacyApps:
+ wd->legacyApps = opt->value.b;
+ break;
+ default:
+ break;
+ }
+}
+
+static Bool workaroundsInitDisplay( CompPlugin *plugin, CompDisplay *d )
+{
+ workaroundsSetLegacyAppsNotify( d, workaroundsDisplayOptionChanged );
+
+ return TRUE;
+}
+
+static void workaroundsFiniDisplay( CompPlugin *plugin, CompDisplay *d )
+{
+}
+
static Bool workaroundsInitWindow( CompPlugin *plugin, CompWindow *w )
{
- unsigned int type;
+ WORKAROUNDS_DISPLAY( w->screen->display );
- type = w->wmType;
+ if ( wd->legacyApps )
+ {
+ unsigned int type;
- /* Some code to make Wine and legacy applications work. */
- if (w->width == w->screen->width && w->height == w->screen->height &&
- !(w->type & CompWindowTypeFullscreenMask) &&
- !(type & CompWindowTypeDesktopMask))
- type = CompWindowTypeFullscreenMask;
+ type = w->wmType;
- w->type = type;
+ /* Some code to make Wine and legacy applications work. */
+ if (w->width == w->screen->width && w->height == w->screen->height &&
+ !(w->type & CompWindowTypeFullscreenMask) &&
+ !(type & CompWindowTypeDesktopMask))
+ type = CompWindowTypeFullscreenMask;
+
+ w->type = type;
+ }
return TRUE;
}
-static void workaroundsFiniWindow( CompPlugin *p, CompWindow *w )
+static void workaroundsFiniWindow( CompPlugin *plugin, CompWindow *w )
{
}
@@ -85,8 +117,8 @@ CompPluginVTable workaroundsVTable =
workaroundsGetMetadata,
workaroundsInit,
workaroundsFini,
- 0, /* InitDisplay */
- 0, /* FiniDisplay */
+ workaroundsInitDisplay,
+ workaroundsFiniDisplay,
0, /* InitScreen */
0, /* FiniScreen */
workaroundsInitWindow,
@@ -100,3 +132,9 @@ CompPluginVTable workaroundsVTable =
0, /* Features */
0 /* nFeatures */
};
+
+CompPluginVTable *getCompPluginInfo( void )
+{
+ return &workaroundsVTable;
+}
+
diff --git a/workarounds.h b/workarounds.h
new file mode 100644
index 0000000..ff00a80
--- /dev/null
+++ b/workarounds.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2007 Andrew Riedi <andrewriedi@gmail.com>
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Workarounds' header file.
+ */
+
+#ifndef COMPIZ_WORKAROUNDS_H
+#define COMPIZ_WORKAROUNDS_H
+
+typedef struct _WorkaroundsDisplay {
+ int screenPrivateIndex;
+
+ /* Options */
+ Bool legacyApps;
+} WorkaroundsDisplay;
+
+#define GET_WORKAROUNDS_DISPLAY(d) \
+ ((WorkaroundsDisplay *) (d)->privates[displayPrivateIndex].ptr)
+
+#define WORKAROUNDS_DISPLAY(d) \
+ WorkaroundsDisplay *wd = GET_WORKAROUNDS_DISPLAY (d)
+
+#endif /* COMPIZ_WORKAROUNDS_H */