diff --git a/configure.ac b/configure.ac index b5f232dd2..056f18127 100644 --- a/configure.ac +++ b/configure.ac @@ -478,7 +478,7 @@ AC_E_OPTIONAL_MODULE([conf_startup], true) AC_E_OPTIONAL_MODULE([conf_intl], true) AC_E_OPTIONAL_MODULE([conf_imc], true) AC_E_OPTIONAL_MODULE([conf_profiles], true) -AC_E_OPTIONAL_MODULE([msgbus_lang], true) +AC_E_OPTIONAL_MODULE([msgbus], true) AC_E_OPTIONAL_MODULE([conf_engine], true) AC_E_OPTIONAL_MODULE([conf_applications], true) AC_E_OPTIONAL_MODULE([conf_desks], true) @@ -579,8 +579,8 @@ src/modules/conf_imc/Makefile src/modules/conf_imc/module.desktop src/modules/conf_profiles/Makefile src/modules/conf_profiles/module.desktop -src/modules/msgbus_lang/Makefile -src/modules/msgbus_lang/module.desktop +src/modules/msgbus/Makefile +src/modules/msgbus/module.desktop src/modules/conf_engine/Makefile src/modules/conf_engine/module.desktop src/modules/conf_applications/Makefile diff --git a/data/tools/enlightenment_remote b/data/tools/enlightenment_remote index 102d1307b..c7227d12e 100644 --- a/data/tools/enlightenment_remote +++ b/data/tools/enlightenment_remote @@ -30,6 +30,10 @@ OPTIONS: -default-profile-get Get the default configuration profile -default-profile-set OPT1 Set the default configuration profile to OPT1 + -desks-get Get the number of virtual desktops + -desktop-bg-add OPT1 OPT2 OPT3 OPT4 OPT5 Add a desktop bg definition. OPT1 = container no. OPT2 = zone no. OPT3 = desk_x. OPT4 = desk_y. OPT5 = bg file path + -desktop-bg-del OPT1 OPT2 OPT3 OPT4 Delete a desktop bg definition. OPT1 = container no. OPT2 = zone no. OPT3 = desk_x. OPT4 = desk_y. + -desktop-bg-list List all current desktop bg definitions Note: This is a new implementation of enlightenment_remote, for more information about it see the '--help-new' option. @@ -113,6 +117,66 @@ ERGM(){ unset result value } +#=== FUNCTION ================================================================ +# NAME: ERGMI +# DESCRIPTION: Get a (multiple) values (integer) +# PARAMETERS: interface/method call +# RETURNS: values (integer) +#=============================================================================== +ERGMI(){ + result="$( dbus-send --print-reply=literal --dest=org.enlightenment.wm.service /org/enlightenment/wm/RemoteObject "$1" )" + result="$( echo "$result" | sed 's/int32//g' )" + for value in $result + do + echo -n "$value " + done + echo "" + unset result value +} + +#=== FUNCTION ================================================================ +# NAME: ERGMST +# DESCRIPTION: Get a (multiple) struct value +# PARAMETERS: interface/method call +# RETURNS: struct values +#=============================================================================== +ERGMST(){ + result="$( dbus-send --print-reply=literal --dest=org.enlightenment.wm.service /org/enlightenment/wm/RemoteObject "$1" )" + result="${result##*array \[}" + result="${result%%]*}" + result="$( echo "$result" | sed -e 's/int32//g' -e 's/struct {//g' )" + for value in $result + do + if test "$value" = "}"; then + echo + else + echo -n "$value " + fi + done + echo "" + unset result value +} + +#=== FUNCTION ================================================================ +# NAME: ERCIIIIS +# DESCRIPTION: eremote call with int, int, int, int, string parameter +# PARAMETERS: interface/method call, int, int, int, int, string +# RETURNS: +#=============================================================================== +ERCIIIIS(){ + dbus-send --print-reply=literal --dest=org.enlightenment.wm.service /org/enlightenment/wm/RemoteObject "$1" int32:"$2" int32:"$3" int32:"$4" int32:"$5" string:"$6" +} + +#=== FUNCTION ================================================================ +# NAME: ERCIIIIS +# DESCRIPTION: eremote call with int, int, int, int parameter +# PARAMETERS: interface/method call, int, int, int, int +# RETURNS: +#=============================================================================== +ERCIIII(){ + dbus-send --print-reply=literal --dest=org.enlightenment.wm.service /org/enlightenment/wm/RemoteObject "$1" int32:"$2" int32:"$3" int32:"$4" int32:"$5" +} + #------------------------------------------------------------------------------- @@ -195,6 +259,36 @@ er_default_profile_set(){ } +#------------------------------------------------------------------------------- +# E Virtual desktop get +#------------------------------------------------------------------------------- +er_desktop_get(){ + ERGMI org.enlightenment.wm.Desktop.GetVirtualCount +} + + +#------------------------------------------------------------------------------- +# E Desktop background add +#------------------------------------------------------------------------------- +er_desktop_bg_add(){ + ERCIIIIS org.enlightenment.wm.Desktop.Background.Add "$2" "$3" "$4" "$5" "$6" +} + +#------------------------------------------------------------------------------- +# E Desktop background del +#------------------------------------------------------------------------------- +er_desktop_bg_del(){ + ERCIIII org.enlightenment.wm.Desktop.Background.Del "$2" "$3" "$4" "$5" +} + +#------------------------------------------------------------------------------- +# E Desktop background list +#------------------------------------------------------------------------------- +er_desktop_bg_list(){ + ERGMST org.enlightenment.wm.Desktop.Background.List +} + + @@ -248,6 +342,18 @@ case "$1" in -default-profile-set) er_default_profile_set "$@" ;; + -desks-get) + er_desktop_get + ;; + -desktop-bg-add) + er_desktop_bg_add "$@" + ;; + -desktop-bg-del) + er_desktop_bg_del "$@" + ;; + -desktop-bg-list) + er_desktop_bg_list + ;; # This entry needs to be allways the last option of the list (*) @@ -314,7 +420,6 @@ echo " -border-shade-speed-set OPT1 Set the shading speed (pixels/sec) -border-shade-speed-get Get the shading speed (pixels/sec) -desks-set OPT1 OPT2 Set the number of virtual desktops (X x Y desks OPT1 = X, OPT2 = Y) - -desks-get Get the number of virtual desktops -maximize-policy-set OPT1 Set the maximize policy. OPT1 = FULLSCREEN, SMART, EXPAND or FILL -maximize-policy-get Get maximize policy -maximize-manipulation-set OPT1 Allow manipulation, 1 for enabled 0 for disabled @@ -345,9 +450,6 @@ echo " -window-resist-get Get window resist threshold -gadget-resist-set OPT1 Set gadget resist threshold (0-100) -gadget-resist-get Get gadget resist threshold - -desktop-bg-add OPT1 OPT2 OPT3 OPT4 OPT5 Add a desktop bg definition. OPT1 = container no. OPT2 = zone no. OPT3 = desk_x. OPT4 = desk_y. OPT5 = bg file path - -desktop-bg-del OPT1 OPT2 OPT3 OPT4 Delete a desktop bg definition. OPT1 = container no. OPT2 = zone no. OPT3 = desk_x. OPT4 = desk_y. - -desktop-bg-list List all current desktop bg definitions -winlist-warp-while-selecting-set OPT1 Set winlist (alt+tab) warp while selecting policy -winlist-warp-while-selecting-get Get winlist (alt+tab) warp while selecting policy -winlist-warp-at-end-set OPT1 Set winlist (alt+tab) warp at end policy diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am index 6b84bf983..32c8d6718 100644 --- a/src/modules/Makefile.am +++ b/src/modules/Makefile.am @@ -114,8 +114,8 @@ if USE_MODULE_CONF_PROFILES SUBDIRS += conf_profiles endif -if USE_MODULE_MSGBUS_LANG -SUBDIRS += msgbus_lang +if USE_MODULE_MSGBUS +SUBDIRS += msgbus endif if USE_MODULE_CONF_ENGINE @@ -292,7 +292,7 @@ conf_startup \ conf_intl \ conf_imc \ conf_profiles \ -msgbus_lang \ +msgbus \ conf_engine \ conf_applications \ conf_desks \ diff --git a/src/modules/msgbus_lang/Makefile.am b/src/modules/msgbus/Makefile.am similarity index 80% rename from src/modules/msgbus_lang/Makefile.am rename to src/modules/msgbus/Makefile.am index 0ce61fa09..454729529 100644 --- a/src/modules/msgbus_lang/Makefile.am +++ b/src/modules/msgbus/Makefile.am @@ -1,5 +1,5 @@ MAINTAINERCLEANFILES = Makefile.in -MODULE = msgbus_lang +MODULE = msgbus # data files for the module filesdir = $(libdir)/enlightenment/modules/$(MODULE) @@ -23,7 +23,11 @@ EXTRA_DIST = $(files_DATA) pkg_LTLIBRARIES = module.la module_la_SOURCES = e_mod_main.c \ - e_mod_main.h + e_mod_main.h \ + msgbus_lang.c \ + msgbus_lang.h \ + msgbus_desktop.c \ + msgbus_desktop.h module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LDFLAGS = -module -avoid-version diff --git a/src/modules/msgbus_lang/e-module-msgbus_lang.edj b/src/modules/msgbus/e-module-msgbus.edj similarity index 100% rename from src/modules/msgbus_lang/e-module-msgbus_lang.edj rename to src/modules/msgbus/e-module-msgbus.edj diff --git a/src/modules/msgbus/e_mod_main.c b/src/modules/msgbus/e_mod_main.c new file mode 100644 index 000000000..60df31891 --- /dev/null +++ b/src/modules/msgbus/e_mod_main.c @@ -0,0 +1,50 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#include "e.h" +#include "e_mod_main.h" +#include "msgbus_lang.h" +#include "msgbus_desktop.h" + +/* actual module specifics */ +static Eina_Array* ifaces = NULL; + +/* module setup */ +EAPI E_Module_Api e_modapi = +{ + E_MODULE_API_VERSION, + "IPC Extension" +}; + +EAPI void * +e_modapi_init(E_Module *m) +{ + ifaces = eina_array_new(5); + + msgbus_lang_init(ifaces); + msgbus_desktop_init(ifaces); + + return m; +} + +EAPI int +e_modapi_shutdown(E_Module *m) +{ + E_DBus_Interface* iface; + Eina_Array_Iterator iter; + size_t i; + EINA_ARRAY_ITER_NEXT(ifaces, i, iface, iter) + { + e_msgbus_interface_detach(iface); + e_dbus_interface_unref(iface); + } + eina_array_free(ifaces); + ifaces = NULL; + return 1; +} + +EAPI int +e_modapi_save(E_Module *m) +{ + return 1; +} diff --git a/src/modules/msgbus_lang/e_mod_main.h b/src/modules/msgbus/e_mod_main.h similarity index 100% rename from src/modules/msgbus_lang/e_mod_main.h rename to src/modules/msgbus/e_mod_main.h diff --git a/src/modules/msgbus/module.desktop.in b/src/modules/msgbus/module.desktop.in new file mode 100644 index 000000000..887411a68 --- /dev/null +++ b/src/modules/msgbus/module.desktop.in @@ -0,0 +1,31 @@ +[Desktop Entry] +Type=Link +Name=DBus Extension +Name[cs]=DBus rozšíření +Name[de]= +Name[eo]=DBus kromaĵo +Name[es]=Extensión DBus +Name[fr]=Extension DBus +Name[hu]=DBus kiterjesztés +Name[it]=Estensione DBus +Name[ja]= +Name[pt]= +Name[pt_BR]= +Name[tr]=DBus Uzantısı +Name[zh_CN]= +Name[zh_TW]= +Comment[cs]=DBus rozšíření - Jazyk +Comment[de]= +Comment[eo]=DBus kromaĵo por allokigo +Comment[es]= +Comment[fr]=Module Extension DBus +Comment[hu]=DBus kiterjesztés +Comment[it]=Estensione DBus +Comment[ja]= +Comment[pt]= +Comment[pt_BR]= +Comment[tr]=DBus uzantısı +Comment[zh_CN]= +Comment[zh_TW]= +Icon=e-module-msgbus +X-Enlightenment-ModuleType=system diff --git a/src/modules/msgbus/msgbus_desktop.c b/src/modules/msgbus/msgbus_desktop.c new file mode 100644 index 000000000..810e43f6a --- /dev/null +++ b/src/modules/msgbus/msgbus_desktop.c @@ -0,0 +1,131 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ + +#include "e.h" +#include "msgbus_desktop.h" + +static DBusMessage * +cb_virtual_desktops(E_DBus_Object *obj, DBusMessage *msg) +{ + DBusMessage* reply; + DBusMessageIter iter; + + reply = dbus_message_new_method_return(msg); + dbus_message_iter_init_append(reply, &iter); + dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, + &(e_config->zone_desks_x_count)); + dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, + &(e_config->zone_desks_y_count)); + + return reply; +} + +static DBusMessage* +cb_desktop_bgadd(E_DBus_Object *obj, DBusMessage *msg) +{ + DBusMessageIter iter; + int container, zone, desk_x, desk_y; + char* path; + + dbus_message_iter_init(msg, &iter); + dbus_message_iter_get_basic(&iter, &container); + dbus_message_iter_next(&iter); + dbus_message_iter_get_basic(&iter, &zone); + dbus_message_iter_next(&iter); + dbus_message_iter_get_basic(&iter, &desk_x); + dbus_message_iter_next(&iter); + dbus_message_iter_get_basic(&iter, &desk_y); + dbus_message_iter_next(&iter); + dbus_message_iter_get_basic(&iter, &path); + + e_bg_add(container, zone, desk_x, desk_y, path); + e_bg_update(); + e_config_save_queue(); + + return dbus_message_new_method_return(msg); +} + +static DBusMessage* +cb_desktop_bgdel(E_DBus_Object *obj, DBusMessage *msg) +{ + DBusMessageIter iter; + int container, zone, desk_x, desk_y; + + dbus_message_iter_init(msg, &iter); + dbus_message_iter_get_basic(&iter, &container); + dbus_message_iter_next(&iter); + dbus_message_iter_get_basic(&iter, &zone); + dbus_message_iter_next(&iter); + dbus_message_iter_get_basic(&iter, &desk_x); + dbus_message_iter_next(&iter); + dbus_message_iter_get_basic(&iter, &desk_y); + + e_bg_del(container, zone, desk_x, desk_y); + e_bg_update(); + e_config_save_queue(); + + return dbus_message_new_method_return(msg); +} + +static DBusMessage* +cb_desktop_bglist(E_DBus_Object *obj, DBusMessage *msg) +{ + Eina_List *list; + E_Config_Desktop_Background *bg; + DBusMessage *reply; + DBusMessageIter iter; + DBusMessageIter arr; + + reply = dbus_message_new_method_return(msg); + dbus_message_iter_init_append(reply, &iter); + dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "(iiiis)", &arr); + + EINA_LIST_FOREACH(e_config->desktop_backgrounds, list, bg) + { + DBusMessageIter sub; + + if (bg == NULL || bg->file == NULL) + { + continue; + } + + dbus_message_iter_open_container(&arr, DBUS_TYPE_STRUCT, NULL, &sub); + dbus_message_iter_append_basic(&sub, DBUS_TYPE_INT32, &(bg->container)); + dbus_message_iter_append_basic(&sub, DBUS_TYPE_INT32, &(bg->zone)); + dbus_message_iter_append_basic(&sub, DBUS_TYPE_INT32, &(bg->desk_x)); + dbus_message_iter_append_basic(&sub, DBUS_TYPE_INT32, &(bg->desk_y)); + dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &(bg->file)); + dbus_message_iter_close_container(&arr, &sub); + } + dbus_message_iter_close_container(&iter, &arr); + + return reply; +} + +void msgbus_desktop_init(Eina_Array *ifaces) +{ + E_DBus_Interface *iface; + + iface = e_dbus_interface_new("org.enlightenment.wm.Desktop"); + if (iface) + { + e_dbus_interface_method_add(iface, "GetVirtualCount", "", "ii", + cb_virtual_desktops); + e_msgbus_interface_attach(iface); + eina_array_push(ifaces, iface); + } + + iface = e_dbus_interface_new("org.enlightenment.wm.Desktop.Background"); + if (iface) + { + e_dbus_interface_method_add(iface, "Add", "iiiis", "", + cb_desktop_bgadd); + e_dbus_interface_method_add(iface, "Del", "iiii", "", + cb_desktop_bgadd); + e_dbus_interface_method_add(iface, "List", "", "a(iiiis)", + cb_desktop_bglist); + e_msgbus_interface_attach(iface); + eina_array_push(ifaces, iface); + } +} diff --git a/src/modules/msgbus/msgbus_desktop.h b/src/modules/msgbus/msgbus_desktop.h new file mode 100644 index 000000000..084729c6c --- /dev/null +++ b/src/modules/msgbus/msgbus_desktop.h @@ -0,0 +1,9 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#ifndef MSGBUS_DESKTOP_H +#define MSGBUS_DESKTOP_H + +void msgbus_desktop_init(Eina_Array *ifaces); + +#endif /* MSGBUS_DESKTOP_H */ diff --git a/src/modules/msgbus_lang/e_mod_main.c b/src/modules/msgbus/msgbus_lang.c similarity index 54% rename from src/modules/msgbus_lang/e_mod_main.c rename to src/modules/msgbus/msgbus_lang.c index 30a9d6c76..ea8bb7c41 100644 --- a/src/modules/msgbus_lang/e_mod_main.c +++ b/src/modules/msgbus/msgbus_lang.c @@ -2,12 +2,9 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ #include "e.h" -#include "e_mod_main.h" +#include "msgbus_lang.h" -/* actual module specifics */ -static E_DBus_Interface *iface = NULL; - -DBusMessage * +static DBusMessage * cb_langs(E_DBus_Object *obj, DBusMessage *message) { DBusMessage *reply; @@ -23,48 +20,28 @@ cb_langs(E_DBus_Object *obj, DBusMessage *message) dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &arr); languages = e_intl_language_list(); - for (l = languages; l; l = l->next) { + for (l = languages; l; l = l->next) + { const char *str; str = l->data; dbus_message_iter_append_basic(&arr, DBUS_TYPE_STRING, &str); - } + } dbus_message_iter_close_container(&iter, &arr); return reply; } -/* module setup */ -EAPI E_Module_Api e_modapi = +void msgbus_lang_init(Eina_Array *ifaces) { - E_MODULE_API_VERSION, - "IPC - Language" -}; + E_DBus_Interface* iface; -EAPI void * -e_modapi_init(E_Module *m) -{ iface = e_dbus_interface_new("org.enlightenment.wm.Language"); - if (!iface) return NULL; - - e_dbus_interface_method_add(iface, "List", "", "as", cb_langs); - - e_msgbus_interface_attach(iface); - - return m; -} - -EAPI int -e_modapi_shutdown(E_Module *m) -{ - e_msgbus_interface_detach(iface); - e_dbus_interface_unref(iface); - return 1; -} - -EAPI int -e_modapi_save(E_Module *m) -{ - return 1; + if (iface) + { + e_dbus_interface_method_add(iface, "List", "", "as", cb_langs); + e_msgbus_interface_attach(iface); + eina_array_push(ifaces, iface); + } } diff --git a/src/modules/msgbus/msgbus_lang.h b/src/modules/msgbus/msgbus_lang.h new file mode 100644 index 000000000..6c6c1e128 --- /dev/null +++ b/src/modules/msgbus/msgbus_lang.h @@ -0,0 +1,9 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ +#ifndef MSGBUS_LANG_H +#define MSGBUS_LANG_H + +void msgbus_lang_init(Eina_Array *ifaces); + +#endif /* MSGBUS_LANG_H */ diff --git a/src/modules/msgbus_lang/.cvsignore b/src/modules/msgbus_lang/.cvsignore deleted file mode 100644 index 06d064a84..000000000 --- a/src/modules/msgbus_lang/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -module.la -module.desktop diff --git a/src/modules/msgbus_lang/module.desktop.in b/src/modules/msgbus_lang/module.desktop.in deleted file mode 100644 index ffffb69f5..000000000 --- a/src/modules/msgbus_lang/module.desktop.in +++ /dev/null @@ -1,31 +0,0 @@ -[Desktop Entry] -Type=Link -Name=DBus Extension - Language -Name[cs]=DBus rozšíření - jazyk -Name[de]= -Name[eo]=DBus kromaĵo - Lingvo -Name[es]=Extensión DBus - Idioma -Name[fr]=Extension DBus - Langage de contrôle -Name[hu]=DBus kiterjesztés - Nyelv -Name[it]=Estensione DBus - Linguaggio -Name[ja]= -Name[pt]= -Name[pt_BR]= -Name[tr]=DBus Uzantısı - Dil -Name[zh_CN]= -Name[zh_TW]= -Comment[cs]=DBus rozšíření - Jazyk -Comment[de]= -Comment[eo]=DBus kromaĵo por allokigo -Comment[es]= -Comment[fr]=Module Extension DBus
Module de démonstration pour ajouter des API de contrôle. -Comment[hu]=DBus kiterjesztés - Nyelv -Comment[it]=Estensione DBus
Un modulo dimostrativo che aggiunge API di controllo del linguaggio -Comment[ja]= -Comment[pt]= -Comment[pt_BR]= -Comment[tr]=DBus uzantısı - Dil -Comment[zh_CN]= -Comment[zh_TW]= -Icon=e-module-msgbus_lang -X-Enlightenment-ModuleType=system