diff options
author | onestone <onestone> | 2006-12-07 00:54:55 +0000 |
---|---|---|
committer | onestone <onestone> | 2006-12-07 00:54:55 +0000 |
commit | e02162a4315bc27567a195b3851de10ada6e184f (patch) | |
tree | f661d934cbcaf28db2a141cabd82fc17820e6730 /src | |
parent | 367f29f773d711747a76facbf5335cbafda73826 (diff) | |
download | aquamarine-e02162a4315bc27567a195b3851de10ada6e184f.tar.gz aquamarine-e02162a4315bc27567a195b3851de10ada6e184f.tar.bz2 |
aquamarine: removed kde integration
kconfig-backend: added kde integrated settings reading
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/aquamarine.cpp | 3 | ||||
-rw-r--r-- | src/decorator.cpp | 23 | ||||
-rw-r--r-- | src/decorator.h | 8 | ||||
-rw-r--r-- | src/integration.cpp | 338 | ||||
-rw-r--r-- | src/integration.h | 67 |
6 files changed, 11 insertions, 431 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index d7d18fb..e6fefd0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,8 +8,7 @@ aquamarine_SOURCES = aquamarine.cpp \ window.cpp \ switcher.cpp \ KWinInterface.skel \ - options.cpp \ - integration.cpp + options.cpp aquamarine_LDADD = $(LIB_KDECORE) -lkdecorations $(BERYLSETTINGS_LIBS) aquamarine_LDFLAGS = $(all_libraries) diff --git a/src/aquamarine.cpp b/src/aquamarine.cpp index 3e9718a..716f263 100644 --- a/src/aquamarine.cpp +++ b/src/aquamarine.cpp @@ -49,9 +49,6 @@ static const KCmdLineOptions options[] = { {"replace", "Replace existing window decorator", 0}, {"deco <deco>", "Decoration", 0}, -#ifdef HAVE_BERYL_SETTINGS - {"integration", "Integrate KDE settings into Beryl", 0}, -#endif KCmdLineLastOption }; diff --git a/src/decorator.cpp b/src/decorator.cpp index 09b7c04..3176512 100644 --- a/src/decorator.cpp +++ b/src/decorator.cpp @@ -40,10 +40,17 @@ #include "decorator.h" #include "options.h" #include "utils.h" -#include "integration.h" #include <stdio.h> +#ifdef HAVE_BERYL_SETTINGS + +extern "C" { +#include <beryl-settings.h> +} + +#endif + #define GRAVITY_WEST (1 << 0) #define GRAVITY_EAST (1 << 1) #define GRAVITY_NORTH (1 << 2) @@ -125,14 +132,6 @@ m_kwinmodule (new KWinModule (this, KWinModule::INFO_ALL)), m_switcher (0) m_config = new KConfig ("kwinrc"); m_config->setGroup ("Style"); -#ifdef HAVE_BERYL_SETTINGS - m_integrate = args->isSet ("integration"); - printf("Integration : %s\n",m_integrate? "Enabled" : "Disabled"); - if (m_integrate) - { - m_integration = new Aquamarine::Integration (); - } -#endif connect (this, SIGNAL (settingsChanged (int)), SLOT (slotSettingsChanged (int))); @@ -463,8 +462,7 @@ Aquamarine::Decorator::reconfigure () changed = m_options->updateSettings (); #ifdef HAVE_BERYL_SETTINGS - if (m_integrate) - m_integration->updateSettings(); + beryl_settings_send_reload_signal(); #endif if (m_plugins->reset (changed)) @@ -483,8 +481,7 @@ Aquamarine::Decorator::slotSettingsChanged (int) { kdDebug () << k_funcinfo << endl; #ifdef HAVE_BERYL_SETTINGS - if (m_integrate) - m_integration->updateSettings(); + beryl_settings_send_reload_signal(); #endif } diff --git a/src/decorator.h b/src/decorator.h index 8100b40..c55d1dc 100644 --- a/src/decorator.h +++ b/src/decorator.h @@ -69,10 +69,6 @@ namespace Aquamarine class Options; class Switcher; -#ifdef HAVE_BERYL_SETTINGS - class Integration; -#endif - class PluginManager:public KDecorationPlugins { public: @@ -163,10 +159,6 @@ namespace Aquamarine WId m_activeWM; bool m_restart; -#ifdef HAVE_BERYL_SETTINGS - bool m_integrate; - Aquamarine::Integration * m_integration; -#endif }; } diff --git a/src/integration.cpp b/src/integration.cpp deleted file mode 100644 index a068f3d..0000000 --- a/src/integration.cpp +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Aquamarine the KDE window decorator - * - * Copyright (c) 2006 Dennis Kasprzyk <onestone@beryl-project.org> - * Copyright (c) 2006 Volker Krause <vkrause@kde.org> - * - * Uses code of: - * Emerald window decorator (www.beryl-project.org) - * gtk-window-decorator (www.freedesktop.org/wiki/Software/Compiz) - * KWin window manager (www.kde.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. - * - */ - -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif - -#ifdef HAVE_BERYL_SETTINGS - -#include <kconfig.h> -#include <kshortcut.h> -#include <kdebug.h> - -#include "integration.h" - -Aquamarine::Integration::Integration () -{ - updateSettings (); -} - -void -Aquamarine::Integration::updateSettings () -{ - KConfig *gc = new KConfig("kdeglobals",false,false); - KConfig *kwc = new KConfig("kwinrc",false); - gc->setGroup("Global Shortcuts"); - kwc->setGroup("Windows"); - - BerylSettingsContext *settings = beryl_settings_context_new(); - beryl_settings_context_read(settings); - - BerylSettingsPlugin *core,*move,*resize,*rotate,*plane,*switcher; - core = beryl_settings_context_find_plugin(settings, NULL); - move = beryl_settings_context_find_plugin(settings, "move"); - resize = beryl_settings_context_find_plugin(settings, "resize"); - rotate = beryl_settings_context_find_plugin(settings, "rotate"); - plane = beryl_settings_context_find_plugin(settings, "plane"); - switcher = beryl_settings_context_find_plugin(settings, "switcher"); - - bool changed = false; - - // core - changed |= KdeKeyToBeryl(gc->readEntry("Window Close"), core, "close_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Run Command"), core, "run"); - changed |= KdeKeyToBeryl(gc->readEntry("Popup Launch Menu"), core, "main_menu"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Lower"), core, "lower_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Maximize"), core, "toggle_window_maximized"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Minimize"), core, "minimize_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Maximize Horizontal"), core, "toggle_maximize_window_horizontally"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Maximize Vertical"), core, "toggle_maximize_window_vertically"); - changed |= KdeKeyToBeryl(gc->readEntry("Toggle Showing Desktop"), core, "show_desktop"); - changed |= KdeKeyToBeryl(gc->readEntry("Desktop Screenshot"), core, "run_command_screenshot"); - changed |= KdeStrToBeryl("ksnapshot", core, "command_screenshot"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Screenshot"), core, "run_command_window_screenshot"); - changed |= KdeStrToBeryl("ksnapshot -c", core, "command_window_screenshot"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Operations Menu"), core, "window_menu"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Shade"), core, "toggle_window_shaded"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Raise"), core, "raise_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Fullscreen"), core, "toggle_window_fullscreen"); - - changed |= KdeKeyToBeryl("none", core, "unmaximize_window"); - changed |= KdeKeyToBeryl("none", core, "maximize_window"); - changed |= KdeKeyToBeryl("none", core, "maximize_window_horizontally"); - changed |= KdeKeyToBeryl("none", core, "maximize_window_vertically"); - - changed |= KdeStrToBeryl("xkill", core, "command11"); - changed |= KdeKeyToBeryl(gc->readEntry("Kill Window"), core, "run_command11"); - - changed |= KdeBoolToBeryl(kwc->readBoolEntry("AutoRaise"), core, "autoraise"); - changed |= KdeIntToBeryl(kwc->readNumEntry("AutoRaiseInterval"), core, "autoraise_delay"); - changed |= KdeBoolToBeryl(kwc->readBoolEntry("ClickRaise"), core, "raise_on_click"); - changed |= KdeBoolToBeryl(kwc->readEntry("FocusPolicy") == "ClickToFocus", core, "click_to_focus"); - - switch (kwc->readNumEntry("FocusStealingPreventionLevel")) - { - case 1: - changed |= KdeStrToBeryl("Low", core, "focus_stealing_prevention_level"); - break; - case 2: - changed |= KdeStrToBeryl("Normal", core, "focus_stealing_prevention_level"); - break; - case 3: - changed |= KdeStrToBeryl("High", core, "focus_stealing_prevention_level"); - break; - case 4: - changed |= KdeStrToBeryl("Extreme", core, "focus_stealing_prevention_level"); - break; - default: - changed |= KdeStrToBeryl("None", core, "focus_stealing_prevention_level"); - break; - } - - kwc->setGroup("Desktops"); - changed |= KdeIntToBeryl(kwc->readNumEntry("Number"), core, "number_of_desktops"); - kwc->setGroup("Windows"); - - // move - changed |= KdeBoolToBeryl(kwc->readBoolEntry("MoveResizeMaximizedWindows"), move, "snapoff_maximized"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Move"), move, "initiate"); - - // resize - if (kwc->readEntry("ResizeMode") == "Opaque") - changed |= KdeStrToBeryl("Normal", resize, "resize_mode"); - else if (kwc->readEntry("ResizeMode") == "Transparent") - changed |= KdeStrToBeryl("Outline", resize, "resize_mode"); - changed |= KdeKeyToBeryl(gc->readEntry("Window Resize"), resize, "initiate"); - - // rotate - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Next Desktop"), rotate, "rotate_right"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Previous Desktop"), rotate, "rotate_left"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 1"), rotate, "rotate_to_1"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 2"), rotate, "rotate_to_2"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 3"), rotate, "rotate_to_3"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 4"), rotate, "rotate_to_4"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 5"), rotate, "rotate_to_5"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 6"), rotate, "rotate_to_6"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 7"), rotate, "rotate_to_7"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 8"), rotate, "rotate_to_8"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 9"), rotate, "rotate_to_9"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 10"), rotate, "rotate_to_10"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 11"), rotate, "rotate_to_11"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 12"), rotate, "rotate_to_12"); - - changed |= KdeKeyToBeryl(gc->readEntry("Window to Next Desktop"), rotate, "rotate_right_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Previous Desktop"), rotate, "rotate_left_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 1"), rotate, "rotate_to_1_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 2"), rotate, "rotate_to_2_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 3"), rotate, "rotate_to_3_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 4"), rotate, "rotate_to_4_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 5"), rotate, "rotate_to_5_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 6"), rotate, "rotate_to_6_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 7"), rotate, "rotate_to_7_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 8"), rotate, "rotate_to_8_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 9"), rotate, "rotate_to_9_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 10"), rotate, "rotate_to_10_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 11"), rotate, "rotate_to_11_window"); - changed |= KdeKeyToBeryl(gc->readEntry("Window to Desktop 12"), rotate, "rotate_to_12_window"); - - // plane - changed |= KdeKeyToBeryl(gc->readEntry("Switch One Desktop Up"), rotate, "plane_up"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch One Desktop Down"), rotate, "plane_down"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch One Desktop to the Left"), rotate, "plane_left"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch One Desktop to the Right"), rotate, "plane_right"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 1"), rotate, "plane_to_1"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 2"), rotate, "plane_to_2"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 3"), rotate, "plane_to_3"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 4"), rotate, "plane_to_4"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 5"), rotate, "plane_to_5"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 6"), rotate, "plane_to_6"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 7"), rotate, "plane_to_7"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 8"), rotate, "plane_to_8"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 9"), rotate, "plane_to_9"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 10"), rotate, "plane_to_10"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 11"), rotate, "plane_to_11"); - changed |= KdeKeyToBeryl(gc->readEntry("Switch to Desktop 12"), rotate, "plane_to_12"); - - // switcher - changed |= KdeKeyToBeryl(gc->readEntry("Walk Through Windows"), switcher, "next"); - changed |= KdeKeyToBeryl(gc->readEntry("Walk Through Windows (Reverse)"), switcher, "prev"); - - if (changed) - { - beryl_settings_context_write(settings); - beryl_settings_send_reload_signal(); - } - - beryl_settings_context_destroy(settings); - delete gc; - delete kwc; -} - -bool Aquamarine::Integration::KdeKeyToBeryl (QString keyString, BerylSettingsPlugin * plugin, char * beryl_name) -{ - if (!plugin) - return false; - - BerylSetting *setting; - - KKey key(keyString); - - setting = beryl_settings_plugin_find_setting(plugin, beryl_name, FALSE); - if (!setting) - return false; - - gint keysym; - gint keymod; - gboolean enabled; - beryl_setting_value_get_keysym(&setting->value,&keysym); - beryl_setting_value_get_keymods(&setting->value,&keymod); - beryl_setting_value_get_key_enabled(&setting->value,&enabled); - - gboolean kde_enabled = !key.isNull(); - int kde_keysym = key.sym(); - int kde_keymod = 0; - - if (key.modFlags() & KKey::SHIFT) - kde_keymod |= ShiftMask; - if (key.modFlags() & KKey::CTRL) - kde_keymod |= ControlMask; - if (key.modFlags() & KKey::ALT) - kde_keymod |= CompAltMask; - if (key.modFlags() & KKey::WIN) - kde_keymod |= CompSuperMask; - - if (keysym != kde_keysym || keymod != kde_keymod || enabled != kde_enabled) - { - kdDebug () << "Changing keybinding for \"" << beryl_name << "\" to \"" - << key.toString() << "\"" << endl; - beryl_setting_value_set_keysym(&setting->value,&kde_keysym); - beryl_setting_value_set_keymods(&setting->value,&kde_keymod); - beryl_setting_value_set_key_enabled(&setting->value,&kde_enabled); - return true; - } - else - { - kdDebug () << "Keybinding \"" << key.toString() << "\" for \"" << beryl_name - << "\" is already set in Beryl" << endl; - return false; - } -} - -bool Aquamarine::Integration::KdeStrToBeryl (QString val, BerylSettingsPlugin * plugin, char * beryl_name) -{ - if (!plugin) - return false; - - BerylSetting *setting; - - setting = beryl_settings_plugin_find_setting(plugin, beryl_name, FALSE); - if (!setting) - return false; - - const gchar *bstr; - beryl_setting_value_get_string(&setting->value,&bstr); - - QString berylStr(bstr); - - if (berylStr != val) - { - kdDebug () << "Changing string value for \"" << beryl_name << "\" to \"" - << val << "\"" << endl; - const gchar *to = val.ascii(); - beryl_setting_value_set_string(&setting->value,&to); - return true; - } - else - { - kdDebug () << "String value \"" << val << "\" for \"" << beryl_name - << "\" is already set in Beryl" << endl; - return false; - } -} - -bool Aquamarine::Integration::KdeBoolToBeryl (bool val, BerylSettingsPlugin * plugin, char * beryl_name) -{ - if (!plugin) - return false; - - BerylSetting *setting; - - setting = beryl_settings_plugin_find_setting(plugin, beryl_name, FALSE); - if (!setting) - return false; - - gboolean bbool; - beryl_setting_value_get_bool(&setting->value,&bbool); - - gboolean berylBool = val; - - if (berylBool != bbool) - { - kdDebug () << "Changing bool value for \"" << beryl_name << "\" to \"" - << val << "\"" << endl; - beryl_setting_value_set_bool(&setting->value,&berylBool); - return true; - } - else - { - kdDebug () << "Bool value \"" << val << "\" for \"" << beryl_name - << "\" is already set in Beryl" << endl; - return false; - } -} - -bool Aquamarine::Integration::KdeIntToBeryl (int val, BerylSettingsPlugin * plugin, char * beryl_name) -{ - if (!plugin) - return false; - - BerylSetting *setting; - - setting = beryl_settings_plugin_find_setting(plugin, beryl_name, FALSE); - if (!setting) - return false; - - gint bint; - beryl_setting_value_get_bool(&setting->value,&bint); - - if (bint != val) - { - kdDebug () << "Changing int value for \"" << beryl_name << "\" to \"" - << val << "\"" << endl; - beryl_setting_value_set_int(&setting->value,&val); - return true; - } - else - { - kdDebug () << "Int value \"" << val << "\" for \"" << beryl_name - << "\" is already set in Beryl" << endl; - return false; - } -} - -#endif diff --git a/src/integration.h b/src/integration.h deleted file mode 100644 index db76763..0000000 --- a/src/integration.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Aquamarine the KDE window decorator - * - * Copyright (c) 2006 Dennis Kasprzyk <onestone@beryl-project.org> - * Copyright (c) 2006 Volker Krause <vkrause@kde.org> - * - * Uses code of: - * Emerald window decorator (www.beryl-project.org) - * gtk-window-decorator (www.freedesktop.org/wiki/Software/Compiz) - * KWin window manager (www.kde.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 AQUAMARINE_INTEGRATION_H -#define AQUAMARINE_INTEGRATION_H - -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif - -#ifdef HAVE_BERYL_SETTINGS - -extern "C" { -#include <beryl-settings.h> -} - -class KConfig; - -namespace Aquamarine -{ - - class Integration - { - public: - - Integration (); - - void updateSettings (); - - private: - - bool KdeKeyToBeryl (QString keyString, BerylSettingsPlugin * plugin, char * beryl_name); - bool KdeStrToBeryl (QString val, BerylSettingsPlugin * plugin, char * beryl_name); - bool KdeBoolToBeryl (bool val, BerylSettingsPlugin * plugin, char * beryl_name); - bool KdeIntToBeryl (int val, BerylSettingsPlugin * plugin, char * beryl_name); - }; - -} - -#endif -#endif |