summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--cmake/CompizPlugin.cmake2
-rw-r--r--include/core/CMakeLists.txt2
-rw-r--r--include/core/propertywriter.h54
-rw-r--r--include/core/screen.h2
-rw-r--r--include/core/serialization.h150
-rw-r--r--metadata/core.xml.in6
-rw-r--r--plugins/annotate/src/annotate.cpp42
-rw-r--r--plugins/annotate/src/annotate.h17
-rw-r--r--plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h25
-rw-r--r--plugins/compiztoolbox/src/compiztoolbox.cpp155
-rw-r--r--plugins/obs/src/obs.cpp19
-rw-r--r--plugins/obs/src/obs.h14
-rw-r--r--plugins/resize/src/resize.cpp5
-rw-r--r--plugins/screenshot/src/screenshot.h4
-rw-r--r--plugins/switcher/src/switcher.h1
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/screen.cpp6
18 files changed, 325 insertions, 184 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9377d66..6f34afe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,7 +37,7 @@ set (COMPIZ_I18N_DIR ${CMAKE_SOURCE_DIR}/po)
set (ALL_LINGUAS af ar bg bn bn_IN bs ca cs cy da de el en_GB en_US es eu et fi fr gl gu he hi hr hu id it ja ka km ko lo lt mk mr nb nl or pa pl pt pt_BR ro ru sk sl sr sv ta tr uk vi xh zh_CN zh_TW zu)
set (GETTEXT_PACKAGE compiz)
-find_package (Boost 1.34.0 REQUIRED)
+find_package (Boost 1.34.0 REQUIRED COMPONENTS serialization)
set (COMPIZ_REQUIRES
x11
@@ -60,6 +60,8 @@ set (DECORATION_REQUIRES xrender)
compiz_pkg_check_modules (COMPIZ REQUIRED ${COMPIZ_REQUIRES})
compiz_pkg_check_modules (LIBDECORATION REQUIRED ${DECORATION_REQUIRES})
+list (APPEND COMPIZ_LIBRARIES ${Boost_LIBRARIES})
+
include (CompizDefaults)
set (COMPIZ_CFLAGS "${COMPIZ_CFLAGS} -I${Boost_INCLUDE_DIR}")
diff --git a/cmake/CompizPlugin.cmake b/cmake/CompizPlugin.cmake
index 9a42eab..832ae8a 100644
--- a/cmake/CompizPlugin.cmake
+++ b/cmake/CompizPlugin.cmake
@@ -400,6 +400,8 @@ function (_build_compiz_plugin plugin)
LINK_FLAGS "${${_PLUGIN}_LDFLAGSADD}"
)
endif (COMPIZ_BUILD_WITH_RPATH)
+
+ message ("libraries are " ${COMPIZ_LIBRARIES})
target_link_libraries (
${plugin} ${COMPIZ_LIBRARIES}
diff --git a/include/core/CMakeLists.txt b/include/core/CMakeLists.txt
index eac25a6..f541c9c 100644
--- a/include/core/CMakeLists.txt
+++ b/include/core/CMakeLists.txt
@@ -12,9 +12,11 @@ set (_headers
point.h
pluginclasshandler.h
pluginclasses.h
+ propertywriter.h
rect.h
region.h
screen.h
+ serialization.h
session.h
size.h
timer.h
diff --git a/include/core/propertywriter.h b/include/core/propertywriter.h
new file mode 100644
index 0000000..80ce5d2
--- /dev/null
+++ b/include/core/propertywriter.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright © 2010 Sam Spilsbury
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Dennis Kasprzyk not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Dennis Kasprzyk makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Sam Spilsbury <smspillaz@gmail.com>
+ */
+
+#ifndef _COMPPROPERTYWRITER_H
+#define _COMPPROPERTYWRITER_H
+
+#include "core.h"
+#include <X11/Xatom.h>
+
+static const CompOption::Vector nilValues;
+
+class PropertyWriter
+{
+ public:
+
+ PropertyWriter ();
+ PropertyWriter (CompString propName,
+ CompOption::Vector &readTemplate);
+
+ bool updateProperty (Window, CompOption::Vector &, int);
+ void deleteProperty (Window);
+ const CompOption::Vector & readProperty (Window);
+ void setReadTemplate (const CompOption::Vector &);
+ const CompOption::Vector & getReadTemplate ();
+
+ private:
+
+ CompOption::Vector mPropertyValues;
+ Atom mAtom;
+};
+
+#endif
diff --git a/include/core/screen.h b/include/core/screen.h
index 4d1e2f1..f107bb3 100644
--- a/include/core/screen.h
+++ b/include/core/screen.h
@@ -321,6 +321,8 @@ class CompScreen :
unsigned int nDesktop ();
CompActiveWindowHistory *currentHistory ();
+
+ bool shouldSerializePlugins () ;
const CompRegion & region () const;
diff --git a/include/core/serialization.h b/include/core/serialization.h
new file mode 100644
index 0000000..cb9ea1a
--- /dev/null
+++ b/include/core/serialization.h
@@ -0,0 +1,150 @@
+/*
+ * Copyright © 2010 Sam Spilsbury
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Dennis Kasprzyk not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior permission.
+ * Dennis Kasprzyk makes no representations about the suitability of this
+ * software for any purpose. It is provided "as is" without express or
+ * implied warranty.
+ *
+ * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
+ * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Authors: Sam Spilsbury <smspillaz@gmail.com>
+ */
+
+#ifndef _COMPSERIALIZATION_H
+#define _COMPSERIALIZATION_H
+
+#include <core/core.h>
+#include <core/timer.h>
+#include <core/propertywriter.h>
+
+#include <boost/archive/text_iarchive.hpp>
+#include <boost/archive/text_oarchive.hpp>
+
+#include <boost/serialization/export.hpp>
+
+#include <boost/serialization/list.hpp>
+#include <boost/serialization/vector.hpp>
+
+#include <sstream>
+#include <fstream>
+
+
+template <class T>
+class PluginStateWriter
+{
+ private:
+ PropertyWriter mPw;
+ Window mResource;
+ T *mClassPtr;
+ CompTimer mTimeout;
+
+ friend class boost::serialization::access;
+
+ bool
+ checkTimeout ()
+ {
+ if (!screen->shouldSerializePlugins ())
+ return false;
+
+ CompOption::Vector atomTemplate = mPw.readProperty (mResource);
+
+ if (atomTemplate.empty ())
+ return false;
+
+ if (!(atomTemplate.at (0).value ().type () == CompOption::TypeString))
+ return false;
+
+ std::istringstream iss (atomTemplate.at (0).value ().s ());
+ boost::archive::text_iarchive ia (iss);
+
+ ia >> *this;
+
+ postLoad ();
+
+ /* No need to store this data in XServer anymore, get rid of it */
+
+ mPw.deleteProperty (mResource);
+
+ return false;
+ };
+
+ public:
+
+ template <class Archive>
+ void serialize (Archive &ar, const unsigned int version)
+ {
+ ar & *mClassPtr;;
+ };
+
+ virtual void postLoad () {};
+
+ /* Classes get destroyed in the order of:
+ * derived -> this. Because variables might
+ * have thier destructors called, we provide
+ * a method to intercept this process
+ * and immediately serialize data such that it
+ * won't be unintentionally destroyed before the
+ * base CompPluginStateWriter destructor gets called
+ */
+
+ void writeSerializedData ()
+ {
+ if (!screen->shouldSerializePlugins ())
+ return;
+
+ CompOption::Vector atomTemplate = mPw.getReadTemplate ();
+ std::string str;
+ std::ostringstream oss (str);
+ boost::archive::text_oarchive oa (oss);
+
+ oa << *this;
+
+ CompOption::Value v (oss.str ().c_str ());
+ atomTemplate.at (0).set (v);
+
+ mPw.updateProperty (mResource, atomTemplate, XA_STRING);
+ }
+
+ PluginStateWriter (T *instance,
+ CompString pluginName,
+ Window xid) :
+ mResource (xid),
+ mClassPtr (instance)
+ {
+ if (screen->shouldSerializePlugins ())
+
+ {
+ CompString atomName = CompString ("_COMPIZ_") + pluginName +
+ CompString ("_STATE");
+ CompOption::Vector o;
+
+ o.resize (1);
+ o.at (0).setName ("data", CompOption::TypeString);
+
+ mPw = PropertyWriter (atomName, o);
+
+ mTimeout.setCallback (boost::bind (&PluginStateWriter::checkTimeout,
+ this));
+ mTimeout.setTimes (0, 0);
+ mTimeout.start ();
+ }
+ }
+
+ virtual ~PluginStateWriter () {};
+
+};
+
+#endif
diff --git a/metadata/core.xml.in b/metadata/core.xml.in
index 810f06c..6878521 100644
--- a/metadata/core.xml.in
+++ b/metadata/core.xml.in
@@ -43,6 +43,12 @@
<_long>Default window icon image</_long>
<default>icon</default>
</option>
+ <option name="do_serialize" type="bool">
+ <_short>Save plugin states on unload</_short>
+ <_long>Save the state of plugins when they are unloaded such
+ they will resume their past internal state when reloaded</_long>
+ <default>false</default>
+ </option>
<group>
<_short>Display Settings</_short>
<option name="overlapping_outputs" type="int">
diff --git a/plugins/annotate/src/annotate.cpp b/plugins/annotate/src/annotate.cpp
index bdbc4dd..0c67723 100644
--- a/plugins/annotate/src/annotate.cpp
+++ b/plugins/annotate/src/annotate.cpp
@@ -79,8 +79,29 @@ AnnoScreen::cairoContext ()
format, w, h);
cairo = cairo_create (surface);
-
- cairoClear (cairo);
+
+ if (cairoBuffer.size ())
+ {
+ cairo_t *cr = cairo_create (surface);
+ int stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, w);
+ cairo_surface_t *raw_source =
+ cairo_image_surface_create_for_data ((unsigned char *)
+ cairoBuffer.c_str (),
+ CAIRO_FORMAT_ARGB32,
+ w, h, stride);
+
+ if (cr && raw_source)
+ {
+ cairo_set_source_surface (cr, raw_source, 0, 0);
+ cairo_paint (cr);
+
+ cairo_surface_destroy (raw_source);
+ cairo_destroy (cr);
+ cairoBuffer.clear ();
+ }
+ }
+ else
+ cairoClear (cairo);
}
return cairo;
@@ -880,10 +901,23 @@ AnnoScreen::handleEvent (XEvent *event)
screen->handleEvent (event);
}
+void
+AnnoScreen::postLoad ()
+{
+ if (content)
+ {
+ cairoContext ();
+
+ gScreen->glPaintOutputSetEnabled (this, true);
+ }
+}
+
AnnoScreen::AnnoScreen (CompScreen *screen) :
PluginClassHandler <AnnoScreen, CompScreen> (screen),
+ PluginStateWriter <AnnoScreen> (this, "ANNOTATE", screen->root ()),
cScreen (CompositeScreen::get (screen)),
gScreen (GLScreen::get (screen)),
+ grabIndex (0),
pixmap (None),
surface (NULL),
damage (None),
@@ -921,7 +955,9 @@ AnnoScreen::AnnoScreen (CompScreen *screen) :
}
AnnoScreen::~AnnoScreen ()
-{
+{
+ writeSerializedData ();
+
if (cairo)
cairo_destroy (cairo);
if (surface)
diff --git a/plugins/annotate/src/annotate.h b/plugins/annotate/src/annotate.h
index 1f6af17..4ae2b6a 100644
--- a/plugins/annotate/src/annotate.h
+++ b/plugins/annotate/src/annotate.h
@@ -27,6 +27,7 @@
#include <cairo-xlib-xrender.h>
#include <core/core.h>
+#include <core/serialization.h>
#include <opengl/opengl.h>
#include <composite/composite.h>
@@ -57,6 +58,7 @@ enum DrawMode
class AnnoScreen :
public PluginClassHandler <AnnoScreen, CompScreen>,
+ public PluginStateWriter <AnnoScreen>,
public ScreenInterface,
public GLScreenInterface,
public AnnotateOptions
@@ -74,6 +76,7 @@ class AnnoScreen :
GLTexture::List texture;
cairo_surface_t *surface;
cairo_t *cairo;
+ CompString cairoBuffer; // used for serialization
bool content;
Damage damage;
@@ -82,6 +85,20 @@ class AnnoScreen :
CompPoint lineVector;
Ellipse ellipse;
+
+ template <class Archive>
+ void serialize (Archive & ar, const unsigned int count)
+ {
+ /* FIXME:
+ * cairo_surface_get_image_data is broken or something
+ * so serializing cairo bits is next to impossible at the moment
+ *
+ * ar & cairoBuffer;
+ * ar & content;
+ */
+ }
+
+ void postLoad ();
void handleEvent (XEvent *);
diff --git a/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h b/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h
index 46a0b6d..976bd47 100644
--- a/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h
+++ b/plugins/compiztoolbox/include/compiztoolbox/compiztoolbox.h
@@ -30,6 +30,7 @@
#include <core/core.h>
#include <core/atoms.h>
#include <core/countedlist.h>
+#include <core/propertywriter.h>
#include <composite/composite.h>
#include <opengl/opengl.h>
@@ -37,9 +38,10 @@
#include <X11/Xatom.h>
#include <X11/extensions/Xrender.h>
+#include <sstream>
#include <fstream>
-#define COMPIZ_COMPIZTOOLBOX_ABI 1
+#define COMPIZ_COMPIZTOOLBOX_ABI 2
typedef enum
{
@@ -62,26 +64,7 @@ typedef enum
AllViewports,
Panels,
Group
-} SwitchWindowSelection;
-
-class PropertyWriter
-{
- public:
-
- PropertyWriter ();
- PropertyWriter (CompString propName,
- CompOption::Vector &readTemplate);
-
- bool updateProperty (Window, CompOption::Vector &, bool, int);
- CompOption::Vector readProperty (Window);
- void setReadTemplate (const CompOption::Vector &);
- CompOption::Vector getReadTemplate ();
-
- private:
-
- CompOption::Vector mPropertyValues;
- Atom mAtom;
-};
+} SwitchWindowSelection;
class BaseSwitchScreen
{
diff --git a/plugins/compiztoolbox/src/compiztoolbox.cpp b/plugins/compiztoolbox/src/compiztoolbox.cpp
index 50dc733..68fbd2a 100644
--- a/plugins/compiztoolbox/src/compiztoolbox.cpp
+++ b/plugins/compiztoolbox/src/compiztoolbox.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright © 2005 Novell, Inc.
+ * Copyright © 2005 Novell, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
@@ -24,10 +24,11 @@
*/
#include <core/core.h>
-
+#include <core/propertywriter.h>
#include <compiztoolbox/compiztoolbox.h>
#include "compiztoolbox_options.h"
+
bool openGLAvailable;
class CompizToolboxScreen :
@@ -45,152 +46,6 @@ class CompizToolboxPluginVTable :
void fini ();
};
-PropertyWriter::PropertyWriter ()
-{
-}
-
-PropertyWriter::PropertyWriter (CompString propName,
- CompOption::Vector &readTemplate)
-{
- mPropertyValues = readTemplate;
- mAtom = XInternAtom (screen->dpy (), propName.c_str (), 0);
-}
-
-void
-PropertyWriter::setReadTemplate (const CompOption::Vector &readTemplate)
-{
- mPropertyValues = readTemplate;
-}
-
-CompOption::Vector
-PropertyWriter::getReadTemplate ()
-{
- return mPropertyValues;
-}
-
-bool
-PropertyWriter::updateProperty (Window id,
- CompOption::Vector &propertyData,
- bool remove,
- int type)
-{
- int count = 0;
- long int data[propertyData.size ()];
-
- if (remove)
- {
- XDeleteProperty (screen->dpy (), id, mAtom);
- return true;
- }
- else
- {
- mPropertyValues = propertyData;
-
- foreach (CompOption &o, propertyData)
- {
- switch (o.type ())
- {
- case CompOption::TypeBool:
- data[count] = o.value ().b ();
- break;
- case CompOption::TypeInt:
- data[count] = o.value ().i ();
- break;
- case CompOption::TypeFloat:
- data[count] = o.value ().f ();
- break;
- default:
- data[count] = 0;
- break;
- }
-
- count++;
- }
-
- XChangeProperty (screen->dpy (), id,
- mAtom, type, 32,
- PropModeReplace, (unsigned char *)data, 5);
- }
-
- return true;
-}
-
-CompOption::Vector
-PropertyWriter::readProperty (Window id)
-{
- Atom type;
- int retval, fmt;
- unsigned long nitems, exbyte;
- long int *data;
- int count = 0;
- CompOption::Vector propertyValues;
-
- propertyValues.clear ();
-
- if (mPropertyValues.empty ())
- return propertyValues;
-
- retval = XGetWindowProperty (screen->dpy (), id, mAtom, 0,
- mPropertyValues.size (), False, XA_CARDINAL,
- &type, &fmt, &nitems, &exbyte,
- (unsigned char **)&data);
-
- if (retval == Success && !mPropertyValues.empty ())
- {
- if (type == XA_CARDINAL && fmt == 32 &&
- nitems == mPropertyValues.size ())
- {
- propertyValues.resize (nitems);
-
- foreach (CompOption &o, propertyValues)
- {
- CompString tmpName;
- CompOption::Value tmpVal;
- char buf[64];
- snprintf (buf, 64, "%i", count);
- tmpName = CompString(buf);
- switch (mPropertyValues.at (count).type ())
- {
- case CompOption::TypeBool:
- tmpVal = CompOption::Value ((bool) data[count]);
- o.setName (tmpName, CompOption::TypeBool);
- o.set (tmpVal);
- break;
- case CompOption::TypeInt:
- tmpVal = CompOption::Value ((int) data[count]);
- o.setName (tmpName, CompOption::TypeInt);
- o.set (tmpVal);
- break;
- case CompOption::TypeFloat:
- tmpVal = CompOption::Value ((float) data[count]);
- o.setName (tmpName, CompOption::TypeFloat);
- o.set (tmpVal);
- break;
- default:
- tmpVal = CompOption::Value (CompOption::Value (0));
- o.setName (tmpName, CompOption::TypeInt);
- o.set (tmpVal);
- break;
- }
-
- count++;
- }
-
- XFree (data);
- }
- else if (fmt != 0)
- {
- XFree (data);
- }
- }
- else
- {
- return propertyValues;
- }
-
- return propertyValues;
-}
-
COMPIZ_PLUGIN_20090315 (compiztoolbox, CompizToolboxPluginVTable);
CompString
@@ -280,7 +135,7 @@ BaseSwitchScreen::setSelectedWindowHint ()
opts = selectWinAtom.getReadTemplate ();
opts.at (0).set (v);
- selectWinAtom.updateProperty (popupWindow, opts, false, XA_WINDOW);
+ selectWinAtom.updateProperty (popupWindow, opts, XA_WINDOW);
}
void
@@ -869,7 +724,7 @@ CompizToolboxPluginVTable::init ()
openGLAvailable = false;
CompPrivate p;
- p.uval = COMPIZ_COMPOSITE_ABI;
+ p.uval = COMPIZ_COMPIZTOOLBOX_ABI;
screen->storeValue ("compiztoolbox_ABI", p);
return true;
diff --git a/plugins/obs/src/obs.cpp b/plugins/obs/src/obs.cpp
index 94269e8..ee32eaf 100644
--- a/plugins/obs/src/obs.cpp
+++ b/plugins/obs/src/obs.cpp
@@ -145,10 +145,10 @@ ObsWindow::glPaint (const GLWindowPaintAttrib& attrib,
return gWindow->glPaint (attrib, transform, region, mask);
}
-/* Note: Normally plugins should wrap into PaintWindow to modify opacity,
- brightness and saturation. As some plugins bypass paintWindow when
+/* Note: Normally plugins should wrap into glPaintWindow to modify opacity,
+ brightness and saturation. As some plugins bypass glPaintWindow when
they draw windows and our custom values always need to be applied,
- we wrap into DrawWindow here */
+ we wrap into glDrawWindow here */
bool
ObsWindow::glDraw (const GLMatrix& transform,
@@ -278,8 +278,19 @@ ObsScreen::setOption (const CompString &name,
return true;
}
+void
+ObsWindow::postLoad ()
+{
+ for (unsigned int i = 0; i < MODIFIER_COUNT; i++)
+ {
+ if (customFactor[i] != 100)
+ modifierChanged (i);
+ }
+}
+
ObsWindow::ObsWindow (CompWindow *w) :
PluginClassHandler<ObsWindow, CompWindow> (w),
+ PluginStateWriter <ObsWindow> (this, "OBS", w->id ()),
window (w),
cWindow (CompositeWindow::get (w)),
gWindow (GLWindow::get (w)),
@@ -302,6 +313,8 @@ ObsWindow::ObsWindow (CompWindow *w) :
ObsWindow::~ObsWindow ()
{
+ writeSerializedData ();
+
updateHandle.stop ();
}
diff --git a/plugins/obs/src/obs.h b/plugins/obs/src/obs.h
index 94ff728..d288ddf 100644
--- a/plugins/obs/src/obs.h
+++ b/plugins/obs/src/obs.h
@@ -25,6 +25,7 @@
#include <core/core.h>
#include <core/pluginclasshandler.h>
+#include <core/serialization.h>
#include <composite/composite.h>
#include <opengl/opengl.h>
@@ -38,7 +39,7 @@
class ObsScreen :
public ScreenInterface,
- public PluginClassHandler<ObsScreen, CompScreen>,
+ public PluginClassHandler <ObsScreen, CompScreen>,
public ObsOptions
{
public:
@@ -56,7 +57,8 @@ class ObsScreen :
class ObsWindow :
public GLWindowInterface,
- public PluginClassHandler<ObsWindow, CompWindow>
+ public PluginClassHandler<ObsWindow, CompWindow>,
+ public PluginStateWriter <ObsWindow>
{
public:
ObsWindow (CompWindow *);
@@ -71,6 +73,14 @@ class ObsWindow :
void updatePaintModifier (unsigned int);
void modifierChanged (unsigned int);
bool updateTimeout ();
+
+ template <class Archive>
+ void serialize (Archive &ar, const unsigned int version)
+ {
+ ar & customFactor;
+ }
+
+ void postLoad ();
private:
CompWindow *window;
diff --git a/plugins/resize/src/resize.cpp b/plugins/resize/src/resize.cpp
index 579f39c..69955cf 100644
--- a/plugins/resize/src/resize.cpp
+++ b/plugins/resize/src/resize.cpp
@@ -170,16 +170,15 @@ ResizeScreen::updateWindowProperty ()
v = geometry.height;
data.at (3).set (v);
- resizeInformationAtom.updateProperty (w->id (), data, false, XA_CARDINAL);
+ resizeInformationAtom.updateProperty (w->id (), data, XA_CARDINAL);
}
void
ResizeScreen::finishResizing ()
{
w->ungrabNotify ();
- CompOption::Vector opts = resizeInformationAtom.getReadTemplate ();
- resizeInformationAtom.updateProperty (w->id (), opts, true, XA_CARDINAL);
+ resizeInformationAtom.deleteProperty (w->id ());
w = NULL;
}
diff --git a/plugins/screenshot/src/screenshot.h b/plugins/screenshot/src/screenshot.h
index 03a9e94..f2c4531 100644
--- a/plugins/screenshot/src/screenshot.h
+++ b/plugins/screenshot/src/screenshot.h
@@ -29,8 +29,10 @@
#include "screenshot_options.h"
-#include <compiztoolbox/compiztoolbox.h>
+#include <core/core.h>
+#include <core/propertywriter.h>
+#include <compiztoolbox/compiztoolbox.h>
#include <composite/composite.h>
#include <opengl/opengl.h>
diff --git a/plugins/switcher/src/switcher.h b/plugins/switcher/src/switcher.h
index e0118d6..91eaad0 100644
--- a/plugins/switcher/src/switcher.h
+++ b/plugins/switcher/src/switcher.h
@@ -33,6 +33,7 @@
#include <compiztoolbox/compiztoolbox.h>
#include <core/pluginclasshandler.h>
+#include <core/propertywriter.h>
#include "switcher_options.h"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8d923c3..17cad68 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -48,6 +48,7 @@ add_executable (compiz
windowgeometry.cpp
icon.cpp
modifierhandler.cpp
+ propertywriter.cpp
${_bcop_sources}
)
diff --git a/src/screen.cpp b/src/screen.cpp
index f5fc0d4..d1cc40f 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -4011,6 +4011,12 @@ CompScreen::currentHistory ()
return &priv->history[priv->currentHistory];
}
+bool
+CompScreen::shouldSerializePlugins ()
+{
+ return priv->optionGetDoSerialize ();
+}
+
void
PrivateScreen::removeDestroyed ()
{