summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in.in2
-rw-r--r--kcm/Makefile.am13
-rw-r--r--kcm/main.cpp63
-rw-r--r--kcm/main.h46
-rw-r--r--settings-backend/Makefile.am4
-rw-r--r--settings-backend/kconfig_backend.cpp100
-rw-r--r--src/Makefile.am4
7 files changed, 212 insertions, 20 deletions
diff --git a/configure.in.in b/configure.in.in
index dbcb4bd..3320bb9 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -19,6 +19,8 @@ BERYL_SETTINGS_REQUIRES="\
AC_ARG_ENABLE(berylsettings, AC_HELP_STRING([--disable-berylsettings], [disable beryl settings]), [berylsettings="${enableval}"], [berylsettings="yes"])
AM_CONDITIONAL(include_bs, test "$berylsettings" = "yes")
+KDE_PKG_CHECK_MODULES(XCOMPOSITE, "xcomposite",[],AC_MSG_ERROR([xcomposite not found]))
+
if test "$berylsettings" = "yes"; then
KDE_PKG_CHECK_MODULES(BERYLSETTINGS, $BERYL_SETTINGS_REQUIRES,
[berylsettings_found="yes"],AC_MSG_WARN([berylsettings not found.]))
diff --git a/kcm/Makefile.am b/kcm/Makefile.am
new file mode 100644
index 0000000..92d7acc
--- /dev/null
+++ b/kcm/Makefile.am
@@ -0,0 +1,13 @@
+INCLUDES = -I$(srcdir)/lib $(all_includes)
+
+kcm_beryl_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
+kcm_beryl_la_LIBADD = $(BERYLSETTINGS_LIBS) $(LIB_KDECORE) $(LIB_KDEUI)
+kcm_beryl_la_SOURCES = main.cpp
+
+KDE_CXXFLAGS = $(BERYLSETTINGS_CFLAGS)
+
+kde_module_LTLIBRARIES = kcm_beryl.la
+
+METASOURCES = AUTO
+
+xdg_apps_DATA = beryl.desktop
diff --git a/kcm/main.cpp b/kcm/main.cpp
new file mode 100644
index 0000000..4157bec
--- /dev/null
+++ b/kcm/main.cpp
@@ -0,0 +1,63 @@
+/*
+ * KControl module for Beryl and Aquamarine
+ *
+ * Copyright (c) 2006 Dennis Kasprzyk <onestone@beryl-project.org>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <kapplication.h>
+#include <kaboutdata.h>
+#include <kconfig.h>
+#include <kdebug.h>
+#include <dcopclient.h>
+#include <kgenericfactory.h>
+
+#include "main.h"
+
+typedef KGenericFactory<KCMBeryl, QWidget> KCMBerylFactory;
+K_EXPORT_COMPONENT_FACTORY( kcm_beryl, KCMBerylFactory("kcmberyl"))
+
+KCMBeryl::~KCMBeryl( )
+{
+ printf("Unload\n");
+}
+
+KCMBeryl::KCMBeryl(QWidget *parent, const char *name, const QStringList &)
+ : KCModule(KCMBerylFactory::instance(), parent, name)
+{
+ KAboutData *about =
+ new KAboutData(I18N_NOOP("kcmberyl"), I18N_NOOP("KDE Beryl/Aquamarine Control Module"),
+ 0, 0, KAboutData::License_GPL,
+ I18N_NOOP("(c) 2006 Dennis Kasprzyk"));
+
+ about->addAuthor("Dennis Kasprzyk", 0, "onestone@beryl-project.org");
+
+ setAboutData( about );
+}
+
+void KCMBeryl::load()
+{
+}
+
+void KCMBeryl::save()
+{
+}
+
+void KCMBeryl::defaults()
+{
+}
+
diff --git a/kcm/main.h b/kcm/main.h
new file mode 100644
index 0000000..df1120c
--- /dev/null
+++ b/kcm/main.h
@@ -0,0 +1,46 @@
+/*
+ * KControl module for Beryl and Aquamarine
+ *
+ * Copyright (c) 2006 Dennis Kasprzyk <onestone@beryl-project.org>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef KCM_BERYL_MAIN_H
+#define KCM_BERYL_MAIN_H
+
+#include <kcmodule.h>
+
+
+
+class KCMBeryl: public KCModule
+{
+ Q_OBJECT
+
+public:
+ KCMBeryl(QWidget *parent, const char *name, const QStringList &);
+ ~KCMBeryl();
+
+ virtual void load();
+ virtual void save();
+ virtual void defaults();
+
+private:
+
+};
+
+
+#endif
diff --git a/settings-backend/Makefile.am b/settings-backend/Makefile.am
index b9d02f2..fc4002d 100644
--- a/settings-backend/Makefile.am
+++ b/settings-backend/Makefile.am
@@ -1,7 +1,5 @@
INCLUDES = -I$(srcdir)/lib $(all_includes)
-if with_berylsettings
-
libkconfig_la_LDFLAGS = -module -avoid-version -no-undefined $(all_libraries)
libkconfig_la_LIBADD = $(BERYLSETTINGS_LIBS) $(LIB_KDECORE)
libkconfig_la_SOURCES = kconfig_backend.cpp
@@ -9,5 +7,3 @@ backenddir = $(plugindir)/backends
KDE_CXXFLAGS = $(BERYLSETTINGS_CFLAGS)
backend_LTLIBRARIES = libkconfig.la
-
-endif \ No newline at end of file
diff --git a/settings-backend/kconfig_backend.cpp b/settings-backend/kconfig_backend.cpp
index 0875372..4998df8 100644
--- a/settings-backend/kconfig_backend.cpp
+++ b/settings-backend/kconfig_backend.cpp
@@ -19,9 +19,13 @@
*
*/
+#include <qdir.h>
+
#include <kconfig.h>
#include <ksimpleconfig.h>
#include <kdebug.h>
+#include <kglobal.h>
+#include <kstandarddirs.h>
#include <kinstance.h>
#include <kshortcut.h>
#include <kipc.h>
@@ -270,19 +274,16 @@ static void readIntegratedOption(ConfigFiles *cFiles, BerylSetting * setting)
case OptionSpecial:
if (specialOptions[option].berylName == "command_screenshot")
{
- setting->read_only = TRUE;
setting->value.value.as_string =
g_strdup("ksnapshot");
}
if (specialOptions[option].berylName == "command_window_screenshot")
{
- setting->read_only = TRUE;
setting->value.value.as_string =
g_strdup("ksnapshot -c");
}
if (specialOptions[option].berylName == "command11")
{
- setting->read_only = TRUE;
setting->value.value.as_string =
g_strdup("xkill");
}
@@ -291,7 +292,6 @@ static void readIntegratedOption(ConfigFiles *cFiles, BerylSetting * setting)
|| specialOptions[option].berylName == "maximize_window_horizontally"
|| specialOptions[option].berylName == "maximize_window_vertically")
{
- setting->read_only = TRUE;
int val = 0;
beryl_setting_value_set_keysym(&setting->value,&val);
beryl_setting_value_set_keymods(&setting->value,&val);
@@ -342,6 +342,82 @@ static void readIntegratedOption(ConfigFiles *cFiles, BerylSetting * setting)
}
}
+gboolean get_setting_is_integrated(BerylSetting * setting)
+{
+ return beryl_settings_context_get_de_integration_enabled(setting->parent->context)
+ && isIntegratedOption(setting);
+}
+
+
+gboolean get_setting_is_read_only(BerylSetting * setting)
+{
+ if (!beryl_settings_context_get_de_integration_enabled(setting->parent->context)
+ || !isIntegratedOption(setting))
+ return FALSE;
+
+ int option = 0;
+ for (unsigned int i = 0; i < N_SOPTIONS; i++)
+ {
+ if (setting->name == specialOptions[i].berylName &&
+ QString(setting->parent->name) == specialOptions[i].berylPlugin)
+ {
+ option = i;
+ break;
+ }
+ }
+ switch (specialOptions[option].type)
+ {
+ case OptionSpecial:
+ if (specialOptions[option].berylName == "command_screenshot")
+ {
+ return TRUE;
+ }
+ if (specialOptions[option].berylName == "command_window_screenshot")
+ {
+ return TRUE; }
+ if (specialOptions[option].berylName == "command11")
+ {
+ return TRUE;
+ }
+ if (specialOptions[option].berylName == "unmaximize_window"
+ || specialOptions[option].berylName == "maximize_window"
+ || specialOptions[option].berylName == "maximize_window_horizontally"
+ || specialOptions[option].berylName == "maximize_window_vertically")
+ {
+ return TRUE;
+ }
+ break;
+ default:
+ break;
+ }
+ return FALSE;
+}
+
+
+GSList * get_existing_profiles(void)
+{
+ QDir dir(KGlobal::dirs()->saveLocation("config", QString::null, false),"berylrc.*");
+ QStringList files = dir.entryList();
+
+ GSList * ret = NULL;
+
+ QStringList::iterator it;
+ for (it = files.begin(); it != files.end(); it++)
+ {
+ QString str = (*it);
+ if (str.length() > 8)
+ {
+ QString profile = str.right(str.length() - 8);
+ if (!profile.isEmpty())
+ {
+ gchar * p = g_strdup(profile.ascii());
+ ret=g_slist_append(ret,p);
+ }
+ }
+ }
+ return ret;
+}
+
void read_setting(BerylSettingsContext * c, BerylSetting * setting)
{
ConfigFiles *cFiles = (ConfigFiles *)c->backend_private_ptr;
@@ -353,12 +429,8 @@ void read_setting(BerylSettingsContext * c, BerylSetting * setting)
group += "_screen";
cfg->setGroup(group);
- setting->de_integrated = FALSE;
- setting->read_only = FALSE;
-
- if (c->de_integration && isIntegratedOption(setting))
+ if (beryl_settings_context_get_de_integration_enabled(c) && isIntegratedOption(setting))
{
- setting->de_integrated = TRUE;
readIntegratedOption(cFiles, setting);
return;
}
@@ -845,7 +917,7 @@ void write_setting(BerylSettingsContext * c, BerylSetting * setting)
group += "_screen";
cfg->setGroup(group);
- if (c->de_integration && isIntegratedOption(setting))
+ if (beryl_settings_context_get_de_integration_enabled(c) && isIntegratedOption(setting))
{
writeIntegratedOption(cFiles, setting);
return;
@@ -1018,10 +1090,10 @@ gboolean read_init(BerylSettingsContext * c)
ConfigFiles *cFiles = new ConfigFiles;
QString configName("berylrc");
- if (c->profile)
+ if (beryl_settings_context_get_profile(c))
{
configName += ".";
- configName += c->profile;
+ configName += beryl_settings_context_get_profile(c);
}
cFiles->beryl = new KSimpleConfig(configName);
cFiles->kwin = new KConfig("kwinrc",true);
@@ -1050,10 +1122,10 @@ gboolean write_init(BerylSettingsContext * c)
ConfigFiles *cFiles = new ConfigFiles;
QString configName("berylrc");
- if (c->profile)
+ if (beryl_settings_context_get_profile(c))
{
configName += ".";
- configName += c->profile;
+ configName += beryl_settings_context_get_profile(c);
}
cFiles->beryl = new KSimpleConfig(configName);
cFiles->kwin = new KConfig("kwinrc");
diff --git a/src/Makefile.am b/src/Makefile.am
index 6638858..bcfb211 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,9 +15,9 @@ aquamarine_SOURCES = aquamarine.cpp \
defaultShadow.cpp \
settings.kcfgc
-aquamarine_LDADD = $(LIB_KDECORE) -lkdecorations $(BERYLSETTINGS_LIBS)
+aquamarine_LDADD = $(LIB_KDECORE) -lkdecorations $(BERYLSETTINGS_LIBS) $(XCOMPOSITE_LIBS)
aquamarine_LDFLAGS = $(all_libraries)
-KDE_CXXFLAGS = $(BERYLSETTINGS_CFLAGS)
+KDE_CXXFLAGS = $(BERYLSETTINGS_CFLAGS) $(XCOMPOSITE_CFLAGS)
METASOURCES = AUTO