forked from enlightenment/enlightenment
Show and ShowByName dbus calls for org.enlightenment.wm.Desktop
SVN revision: 47168
This commit is contained in:
parent
02dfcdd264
commit
ddc7ec3bfe
|
@ -30,7 +30,9 @@ 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
|
||||
-desktops-get Get the number of virtual desktops
|
||||
-desktop-show OPT1 OPT2 Show the desk at position OPT1 (x) and OPT2 (y), see -desktops-get for current count.
|
||||
-desktop-show-by-name OPT1 Show the desk named OPT1
|
||||
-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
|
||||
|
@ -168,7 +170,7 @@ ERCIIIIS(){
|
|||
}
|
||||
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: ERCIIIIS
|
||||
# NAME: ERCIIII
|
||||
# DESCRIPTION: eremote call with int, int, int, int parameter
|
||||
# PARAMETERS: interface/method call, int, int, int, int
|
||||
# RETURNS:
|
||||
|
@ -177,6 +179,16 @@ ERCIIII(){
|
|||
dbus-send --print-reply=literal --dest=org.enlightenment.wm.service /org/enlightenment/wm/RemoteObject "$1" int32:"$2" int32:"$3" int32:"$4" int32:"$5"
|
||||
}
|
||||
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: ERCII
|
||||
# DESCRIPTION: eremote call with int, int parameter
|
||||
# PARAMETERS: interface/method call, int, int
|
||||
# RETURNS:
|
||||
#===============================================================================
|
||||
ERCII(){
|
||||
dbus-send --print-reply=literal --dest=org.enlightenment.wm.service /org/enlightenment/wm/RemoteObject "$1" int32:"$2" int32:"$3"
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -266,6 +278,19 @@ er_desktop_get(){
|
|||
ERGMI org.enlightenment.wm.Desktop.GetVirtualCount
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# E Virtual show
|
||||
#-------------------------------------------------------------------------------
|
||||
er_desktop_show(){
|
||||
ERCII org.enlightenment.wm.Desktop.Show "$2" "$3"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# E Virtual show by name
|
||||
#-------------------------------------------------------------------------------
|
||||
er_desktop_show_by_name(){
|
||||
ERCS org.enlightenment.wm.Desktop.ShowByName "$2"
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# E Desktop background add
|
||||
|
@ -291,8 +316,6 @@ er_desktop_bg_list(){
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
#=== FUNCTION ================================================================
|
||||
# NAME: Main
|
||||
# DESCRIPTION: We start there and go to the desired option
|
||||
|
@ -342,9 +365,15 @@ case "$1" in
|
|||
-default-profile-set)
|
||||
er_default_profile_set "$@"
|
||||
;;
|
||||
-desks-get)
|
||||
-desks-get|-desktops-get)
|
||||
er_desktop_get
|
||||
;;
|
||||
-desktop-show)
|
||||
er_desktop_show "$@"
|
||||
;;
|
||||
-desktop-show-by-name)
|
||||
er_desktop_show_by_name "$@"
|
||||
;;
|
||||
-desktop-bg-add)
|
||||
er_desktop_bg_add "$@"
|
||||
;;
|
||||
|
|
|
@ -5,6 +5,12 @@
|
|||
#include "e.h"
|
||||
#include "msgbus_desktop.h"
|
||||
|
||||
static int _log_dom = -1;
|
||||
#define DBG(...) EINA_LOG_DOM_DBG(_log_dom, __VA_ARGS__)
|
||||
#define WARN(...) EINA_LOG_DOM_WARN(_log_dom, __VA_ARGS__)
|
||||
#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__)
|
||||
#define ERR(...) EINA_LOG_DOM_ERR(_log_dom, __VA_ARGS__)
|
||||
|
||||
static DBusMessage *
|
||||
cb_virtual_desktops(E_DBus_Object *obj, DBusMessage *msg)
|
||||
{
|
||||
|
@ -21,6 +27,69 @@ cb_virtual_desktops(E_DBus_Object *obj, DBusMessage *msg)
|
|||
return reply;
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
cb_desktop_show(E_DBus_Object *obj, DBusMessage *msg)
|
||||
{
|
||||
DBusError err;
|
||||
int x, y;
|
||||
|
||||
dbus_error_init(&err);
|
||||
if (!dbus_message_get_args(msg, &err,
|
||||
DBUS_TYPE_INT32, &x,
|
||||
DBUS_TYPE_INT32, &y,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
ERR("could not get Show arguments: %s: %s", err.name, err.message);
|
||||
dbus_error_free(&err);
|
||||
}
|
||||
else
|
||||
{
|
||||
E_Zone *zone = e_util_zone_current_get(e_manager_current_get());
|
||||
fprintf(stderr, "show desktop %d,%d from zone %p.\n", x, y, zone);
|
||||
DBG("show desktop %d,%d from zone %p.", x, y, zone);
|
||||
e_zone_desk_flip_to(zone, x, y);
|
||||
}
|
||||
|
||||
return dbus_message_new_method_return(msg);
|
||||
}
|
||||
|
||||
static DBusMessage *
|
||||
cb_desktop_show_by_name(E_DBus_Object *obj, DBusMessage *msg)
|
||||
{
|
||||
DBusError err;
|
||||
const char *name;
|
||||
|
||||
dbus_error_init(&err);
|
||||
if (!dbus_message_get_args(msg, &err,
|
||||
DBUS_TYPE_STRING, &name,
|
||||
DBUS_TYPE_INVALID))
|
||||
{
|
||||
ERR("could not get Show arguments: %s: %s", err.name, err.message);
|
||||
dbus_error_free(&err);
|
||||
}
|
||||
else if (name)
|
||||
{
|
||||
E_Zone *zone = e_util_zone_current_get(e_manager_current_get());
|
||||
unsigned int i, count;
|
||||
|
||||
DBG("show desktop %s from zone %p.", name, zone);
|
||||
count = zone->desk_x_count * zone->desk_y_count;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
E_Desk *desk = zone->desks[i];
|
||||
if ((desk->name) && (strcmp(desk->name, name) == 0))
|
||||
{
|
||||
DBG("show desktop %s (%d,%d) from zone %p.",
|
||||
name, desk->x, desk->y, zone);
|
||||
e_zone_desk_flip_to(zone, desk->x, desk->y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dbus_message_new_method_return(msg);
|
||||
}
|
||||
|
||||
static DBusMessage*
|
||||
cb_desktop_bgadd(E_DBus_Object *obj, DBusMessage *msg)
|
||||
{
|
||||
|
@ -107,11 +176,22 @@ void msgbus_desktop_init(Eina_Array *ifaces)
|
|||
{
|
||||
E_DBus_Interface *iface;
|
||||
|
||||
if (_log_dom == -1)
|
||||
{
|
||||
_log_dom = eina_log_domain_register("msgbus_desktop", EINA_COLOR_BLUE);
|
||||
if (_log_dom < 0)
|
||||
EINA_LOG_ERR("could not register msgbus_desktop log domain!");
|
||||
}
|
||||
|
||||
iface = e_dbus_interface_new("org.enlightenment.wm.Desktop");
|
||||
if (iface)
|
||||
{
|
||||
e_dbus_interface_method_add(iface, "GetVirtualCount", "", "ii",
|
||||
cb_virtual_desktops);
|
||||
e_dbus_interface_method_add(iface, "Show", "ii", "",
|
||||
cb_desktop_show);
|
||||
e_dbus_interface_method_add(iface, "ShowByName", "s", "",
|
||||
cb_desktop_show_by_name);
|
||||
e_msgbus_interface_attach(iface);
|
||||
eina_array_push(ifaces, iface);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue