diff --git a/.cvsignore b/.cvsignore diff --git a/AUTHORS b/AUTHORS diff --git a/COPYING b/COPYING diff --git a/COPYING.GPL b/COPYING.GPL diff --git a/COPYING.MIT b/COPYING.MIT diff --git a/ChangeLog b/ChangeLog diff --git a/INSTALL b/INSTALL diff --git a/Makefile.am b/Makefile.am diff --git a/NEWS b/NEWS diff --git a/README b/README diff --git a/TODO b/TODO diff --git a/autogen.sh b/autogen.sh diff --git a/compiz.pc.in b/compiz.pc.in diff --git a/configure.ac b/configure.ac diff --git a/gtk/.cvsignore b/gtk/.cvsignore diff --git a/gtk/Makefile.am b/gtk/Makefile.am diff --git a/gtk/gnome/Makefile.am b/gtk/gnome/Makefile.am diff --git a/gtk/gnome/compiz-window-manager.c b/gtk/gnome/compiz-window-manager.c diff --git a/gtk/gnome/compiz-window-manager.h b/gtk/gnome/compiz-window-manager.h diff --git a/gtk/gnome/compiz.desktop.in b/gtk/gnome/compiz.desktop.in diff --git a/gtk/window-decorator/.cvsignore b/gtk/window-decorator/.cvsignore diff --git a/gtk/window-decorator/Makefile.am b/gtk/window-decorator/Makefile.am diff --git a/gtk/window-decorator/TODO b/gtk/window-decorator/TODO diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c diff --git a/gtk/window-decorator/gwd.schemas.in b/gtk/window-decorator/gwd.schemas.in diff --git a/images/.cvsignore b/images/.cvsignore diff --git a/images/Makefile.am b/images/Makefile.am diff --git a/images/background.png b/images/background.png diff --git a/images/freedesktop.png b/images/freedesktop.png diff --git a/images/icon.png b/images/icon.png diff --git a/include/.cvsignore b/include/.cvsignore diff --git a/include/Makefile.am b/include/Makefile.am diff --git a/include/compiz.h b/include/compiz.h diff --git a/kde/.cvsignore b/kde/.cvsignore diff --git a/kde/Makefile.am b/kde/Makefile.am diff --git a/kde/window-decorator/.cvsignore b/kde/window-decorator/.cvsignore diff --git a/kde/window-decorator/Makefile.am b/kde/window-decorator/Makefile.am diff --git a/kde/window-decorator/decorations.cpp b/kde/window-decorator/decorations.cpp diff --git a/kde/window-decorator/decorations.h b/kde/window-decorator/decorations.h diff --git a/kde/window-decorator/main.cpp b/kde/window-decorator/main.cpp diff --git a/kde/window-decorator/qdecorator.cpp b/kde/window-decorator/qdecorator.cpp diff --git a/kde/window-decorator/qdecorator.h b/kde/window-decorator/qdecorator.h diff --git a/kde/window-decorator/qwmscreen.cpp b/kde/window-decorator/qwmscreen.cpp diff --git a/kde/window-decorator/qwmscreen.h b/kde/window-decorator/qwmscreen.h diff --git a/kde/window-decorator/qwmutils.cpp b/kde/window-decorator/qwmutils.cpp diff --git a/kde/window-decorator/qwmutils.h b/kde/window-decorator/qwmutils.h diff --git a/kde/window-decorator/qwmwindow.cpp b/kde/window-decorator/qwmwindow.cpp diff --git a/kde/window-decorator/qwmwindow.h b/kde/window-decorator/qwmwindow.h diff --git a/plugins/.cvsignore b/plugins/.cvsignore diff --git a/plugins/Makefile.am b/plugins/Makefile.am diff --git a/plugins/annotate.c b/plugins/annotate.c diff --git a/plugins/clone.c b/plugins/clone.c diff --git a/plugins/compiz.schemas.in b/plugins/compiz.schemas.in diff --git a/plugins/cube.c b/plugins/cube.c diff --git a/plugins/dbus.c b/plugins/dbus.c diff --git a/plugins/decoration.c b/plugins/decoration.c diff --git a/plugins/fade.c b/plugins/fade.c diff --git a/plugins/gconf-dump.c b/plugins/gconf-dump.c diff --git a/plugins/gconf.c b/plugins/gconf.c index 35b11ef..5fe80d2 100644 --- a/plugins/gconf.c +++ b/plugins/gconf.c @@ -74,6 +74,109 @@ #define GET_GCONF_SCREEN(s, gd) #define GCONF_SCREEN(s) \ GConfScreen *gs = GET_GCONF_SCREEN (s, GET_GCONF_DISPLAY (s->display)) +struct keymapping { + const char *compiz; + const char *metacity; +}; + +static struct keymapping compiz_keymapping[]={ + {"/apps/compiz/general/allscreens/options/close_window_key", + "/apps/metacity/window_keybindings/close"}, + {"/apps/compiz/general/allscreens/options/main_menu_key", + "/apps/metacity/global_keybindings/panel_main_menu"}, + {"/apps/compiz/general/allscreens/options/run_key", + "/apps/metacity/global_keybindings/panel_run_dialog"}, + {"/apps/compiz/general/allscreens/options/run_command0_key", + "/apps/metacity/global_keybindings/run_command_0"}, + {"/apps/compiz/general/allscreens/options/run_command1_key", + "/apps/metacity/global_keybindings/run_command_1"}, + {"/apps/compiz/general/allscreens/options/run_command2_key", + "/apps/metacity/global_keybindings/run_command_2"}, + {"/apps/compiz/general/allscreens/options/run_command3_key", + "/apps/metacity/global_keybindings/run_command_3"}, + {"/apps/compiz/general/allscreens/options/run_command4_key", + "/apps/metacity/global_keybindings/run_command_4"}, + {"/apps/compiz/general/allscreens/options/run_command5_key", + "/apps/metacity/global_keybindings/run_command_5"}, + {"/apps/compiz/general/allscreens/options/run_command6_key", + "/apps/metacity/global_keybindings/run_command_6"}, + {"/apps/compiz/general/allscreens/options/run_command7_key", + "/apps/metacity/global_keybindings/run_command_7"}, + {"/apps/compiz/general/allscreens/options/run_command8_key", + "/apps/metacity/global_keybindings/run_command_8"}, + {"/apps/compiz/general/allscreens/options/run_command9_key", + "/apps/metacity/global_keybindings/run_command_9"}, + {"/apps/compiz/general/allscreens/options/run_command10_key", + "/apps/metacity/global_keybindings/run_command_10"}, + {"/apps/compiz/general/allscreens/options/run_command11_key", + "/apps/metacity/global_keybindings/run_command_11"}, + {"/apps/compiz/general/allscreens/options/raise_window_key", + "/apps/metacity/window_keybindings/raise"}, + {"/apps/compiz/general/allscreens/options/lower_window_key", + "/apps/metacity/window_keybindings/lower"}, + {"/apps/compiz/general/allscreens/options/unmaximize_window_key", + "/apps/metacity/window_keybindings/unmaximize"}, + {"/apps/compiz/general/allscreens/options/minimize_window_key", + "/apps/metacity/window_keybindings/minimize"}, + {"/apps/compiz/general/allscreens/options/maximize_window_key", + "/apps/metacity/window_keybindings/maximize"}, + {"/apps/compiz/general/allscreens/options/maximize_window_horizontally_key", + "/apps/metacity/window_keybindings/maximize_horizontally"}, + {"/apps/compiz/general/allscreens/options/maximize_window_vertically_key", + "/apps/metacity/window_keybindings/maximize_vertically"}, + {"/apps/compiz/general/allscreens/options/run_command_screenshot_key", + "/apps/metacity/global_keybindings/run_command_screenshot"}, + {"/apps/compiz/general/allscreens/options/run_command_window_screenshot_key", + "/apps/metacity/global_keybindings/run_command_window_screenshot"}, + {"/apps/compiz/general/allscreens/options/window_menu_key", + "/apps/metacity/window_keybindings/activate_window_menu"}, + {"/apps/compiz/general/allscreens/options/show_desktop_key", + "/apps/metacity/global_keybindings/show_desktop"}, + {"/apps/compiz/general/allscreens/options/toggle_window_maximized_key", + "/apps/metacity/window_keybindings/toggle_maximized"}, + {"/apps/compiz/general/allscreens/options/toggle_window_shaded_key", + "/apps/metacity/window_keybindings/toggle_shaded"}, + {NULL, NULL} +}; + +static const gchar* +gconfConvertToMetacity (gchar *key) { + int i = 0; + + if (!key) + return NULL; + + printf ("Asked for %s\n", key); + + while (compiz_keymapping[i].compiz != NULL) { + if (strcmp (compiz_keymapping[i].compiz, key) == 0) { + printf ("Returning %s\n", compiz_keymapping[i].metacity); + return compiz_keymapping[i].metacity; + } + i++; + } + + printf ("Found nothing\n"); + + return NULL; +} + +static const gchar* +gconfConvertToCompiz (gchar *key) { + int i = 0; + + if (!key) + return NULL; + + while (compiz_keymapping[i].metacity != NULL) { + if (strcmp (compiz_keymapping[i].metacity, key) == 0) + return compiz_keymapping[i].compiz; + i++; + } + + return NULL; +} + static int strcmpskipifequal (char **ptr, char *s) @@ -204,12 +307,20 @@ gconfSetOption (CompDisplay *d, existingValue = gconf_client_get (gd->client, key, NULL); gvalue = gconf_value_new (gconfTypeFromCompType (o->type)); gconfSetValue (d, &o->value, o->type, gvalue); - if (!existingValue || gconf_value_compare (existingValue, gvalue)) - gconf_client_set (gd->client, key, gvalue, NULL); + + if (!existingValue || gconf_value_compare (existingValue, gvalue)) { + const gchar *tmp = gconfConvertToMetacity(key); + if (tmp) + gconf_client_set (gd->client, tmp, gvalue, NULL); + else + gconf_client_set (gd->client, key, gvalue, NULL); + } + gconf_value_free (gvalue); break; - case CompOptionTypeAction: { - gchar *key1, *key2, *key3, *key4, *key5; + case CompOptionTypeAction: { + gchar *key1, *key2, *key3, *key4, *key5; + const gchar *tmp; GSList *node, *list = NULL; GConfValue *gv; int i; @@ -225,9 +336,19 @@ gconfSetOption (CompDisplay *d, gconfSetActionValue (d, &o->value, o->type, gvalue, CompBindingTypeKey); - existingValue = gconf_client_get (gd->client, key1, NULL); - if (!existingValue || gconf_value_compare (existingValue, gvalue)) - gconf_client_set (gd->client, key1, gvalue, NULL); + tmp = gconfConvertToMetacity (key1); + + if (tmp) + existingValue = gconf_client_get (gd->client, tmp, NULL); + else + existingValue = gconf_client_get (gd->client, key1, NULL); + + if (!existingValue || gconf_value_compare (existingValue, gvalue)) { + if (tmp) + gconf_client_set (gd->client, tmp, gvalue, NULL); + else + gconf_client_set (gd->client, key1, gvalue, NULL); + } if (existingValue) gconf_value_free (existingValue); @@ -393,6 +514,7 @@ gconfGetOptionValue (CompDisplay *d, CompScreen *s = 0; CompOption *o, *option; gchar *ptr; + const gchar *tmp; gchar *pluginPtr = 0; gchar *optionName = 0; gint pluginLen = 0; @@ -402,7 +524,13 @@ gconfGetOptionValue (CompDisplay *d, if (!entry) return FALSE; - ptr = entry->key; + tmp = gconfConvertToCompiz (entry->key); + + if (tmp) + ptr = tmp; + else + ptr = entry->key; + if (strncmp (ptr, APP_NAME, strlen (APP_NAME))) return FALSE; @@ -712,9 +840,16 @@ gconfInitOption (CompDisplay *d, for (i = 0; i < sizeof (tail) / sizeof (tail[0]); i++) { + const gchar *tmp; key1 = g_strdup_printf ("%s_%s", key, tail[i]); + tmp = gconfConvertToMetacity (key1); + + if (tmp) { + entry = gconf_client_get_entry (gd->client, tmp, NULL, TRUE, NULL); + } else { + entry = gconf_client_get_entry (gd->client, key1, NULL, TRUE, NULL); + } - entry = gconf_client_get_entry (gd->client, key1, NULL, TRUE, NULL); if (entry) { gconfGetOptionValue (d, entry); @@ -726,7 +861,13 @@ gconfInitOption (CompDisplay *d, } else { - entry = gconf_client_get_entry (gd->client, key, NULL, TRUE, NULL); + const gchar *tmp = gconfConvertToMetacity (key); + + if (tmp) + entry = gconf_client_get_entry (gd->client, key, NULL, TRUE, NULL); + else + entry = gconf_client_get_entry (gd->client, key, NULL, TRUE, NULL); + if (entry) { gconfGetOptionValue (d, entry); @@ -966,6 +1107,9 @@ gconfInitDisplay (CompPlugin *p, gconf_client_add_dir (gd->client, APP_NAME, GCONF_CLIENT_PRELOAD_NONE, NULL); + gconf_client_add_dir (gd->client, "/apps/metacity", + GCONF_CLIENT_PRELOAD_NONE, NULL); + WRAP (gd, d, initPluginForDisplay, gconfInitPluginForDisplay); WRAP (gd, d, setDisplayOption, gconfSetDisplayOption); WRAP (gd, d, setDisplayOptionForPlugin, gconfSetDisplayOptionForPlugin); @@ -979,6 +1123,9 @@ gconfInitDisplay (CompPlugin *p, gconf_client_notify_add (gd->client, APP_NAME, gconfKeyChanged, d, NULL, NULL); + gconf_client_notify_add (gd->client, "/apps/metacity", gconfKeyChanged, d, + NULL, NULL); + gd->timeoutHandle = compAddTimeout (KEY_CHANGE_TIMEOUT, gconfTimeout, 0); return TRUE; diff --git a/plugins/minimize.c b/plugins/minimize.c diff --git a/plugins/move.c b/plugins/move.c diff --git a/plugins/place.c b/plugins/place.c diff --git a/plugins/plane.c b/plugins/plane.c diff --git a/plugins/resize.c b/plugins/resize.c diff --git a/plugins/rotate.c b/plugins/rotate.c diff --git a/plugins/scale.c b/plugins/scale.c diff --git a/plugins/screenshot.c b/plugins/screenshot.c diff --git a/plugins/switcher.c b/plugins/switcher.c diff --git a/plugins/water.c b/plugins/water.c diff --git a/plugins/wobbly.c b/plugins/wobbly.c diff --git a/plugins/zoom.c b/plugins/zoom.c diff --git a/po/.cvsignore b/po/.cvsignore diff --git a/po/ChangeLog b/po/ChangeLog diff --git a/po/POTFILES.in b/po/POTFILES.in diff --git a/po/cs.po b/po/cs.po diff --git a/po/de.po b/po/de.po diff --git a/po/es.po b/po/es.po diff --git a/po/fi.po b/po/fi.po diff --git a/po/fr.po b/po/fr.po diff --git a/po/hu.po b/po/hu.po diff --git a/po/it.po b/po/it.po diff --git a/po/ja.po b/po/ja.po diff --git a/po/pl.po b/po/pl.po diff --git a/po/pt_BR.po b/po/pt_BR.po diff --git a/po/sv.po b/po/sv.po diff --git a/po/zh_CN.po b/po/zh_CN.po diff --git a/po/zh_TW.po b/po/zh_TW.po diff --git a/src/.cvsignore b/src/.cvsignore diff --git a/src/Makefile.am b/src/Makefile.am diff --git a/src/action.c b/src/action.c diff --git a/src/display.c b/src/display.c diff --git a/src/event.c b/src/event.c diff --git a/src/main.c b/src/main.c diff --git a/src/option.c b/src/option.c diff --git a/src/paint.c b/src/paint.c diff --git a/src/plugin.c b/src/plugin.c diff --git a/src/privates.c b/src/privates.c diff --git a/src/readpng.c b/src/readpng.c diff --git a/src/screen.c b/src/screen.c diff --git a/src/session.c b/src/session.c diff --git a/src/texture.c b/src/texture.c diff --git a/src/window.c b/src/window.c