add some basic window manipulation methods to enlightenment_remote + e
ticket #201 SVN revision: 74242
This commit is contained in:
parent
1b8ebb097a
commit
b1a1902995
|
@ -39,7 +39,16 @@ OPTIONS:
|
||||||
-desktop-bg-list List all current desktop bg definitions
|
-desktop-bg-list List all current desktop bg definitions
|
||||||
-desktop-lock Lock the desktop
|
-desktop-lock Lock the desktop
|
||||||
|
|
||||||
-efm-open-dir OPT1 Open dir in OPT1 in EFileManager. Opens /home/$USER if no path is given or it doesn't exist
|
-efm-open-dir OPT1 Open dir in OPT1 in EFileManager. Opens /home/$USER if no path is given or it doesn't exist
|
||||||
|
|
||||||
|
-window-list List all window names and ids
|
||||||
|
-window-close OPT1 Request the close of window with xwin id OPT1
|
||||||
|
-window-kill OPT1 Request the kill of window with xwin id OPT1
|
||||||
|
-window-focus OPT1 Request the focus of window with xwin id OPT1
|
||||||
|
-window-iconify OPT1 Request iconify of window with xwin id OPT1
|
||||||
|
-window-uniconify OPT1 Request uniconify of window with xwin id OPT1
|
||||||
|
-window-maximize OPT1 Request maximize of window with xwin id OPT1
|
||||||
|
-window-unmaximize OPT1 Request unmaximize of window with xwin id OPT1
|
||||||
|
|
||||||
Note: This is a new implementation of enlightenment_remote,
|
Note: This is a new implementation of enlightenment_remote,
|
||||||
for more information about it see the '--help-new' option.
|
for more information about it see the '--help-new' option.
|
||||||
|
@ -193,6 +202,16 @@ ERCII(){
|
||||||
dbus-send --print-reply=literal --dest=org.enlightenment.wm.service /org/enlightenment/wm/RemoteObject "$1" int32:"$2" int32:"$3"
|
dbus-send --print-reply=literal --dest=org.enlightenment.wm.service /org/enlightenment/wm/RemoteObject "$1" int32:"$2" int32:"$3"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#=== FUNCTION ================================================================
|
||||||
|
# NAME: ERCI
|
||||||
|
# DESCRIPTION: eremote call with int parameter
|
||||||
|
# PARAMETERS: interface/method call, int
|
||||||
|
# RETURNS:
|
||||||
|
#===============================================================================
|
||||||
|
ERCI(){
|
||||||
|
dbus-send --print-reply=literal --dest=org.enlightenment.wm.service /org/enlightenment/wm/RemoteObject "$1" int32:"$2"
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# E Lock
|
# E Lock
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
@ -343,7 +362,62 @@ er_efm_open_dir(){
|
||||||
dbus-send --session --type=method_call --print-reply=literal --dest=org.enlightenment.FileManager /org/enlightenment/FileManager org.enlightenment.FileManager.OpenDirectory "string:$EFM_DIR"
|
dbus-send --session --type=method_call --print-reply=literal --dest=org.enlightenment.FileManager /org/enlightenment/FileManager org.enlightenment.FileManager.OpenDirectory "string:$EFM_DIR"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# E Window list
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
er_window_list(){
|
||||||
|
echo 'Window -- ID'
|
||||||
|
ERGMST org.enlightenment.wm.Window.List
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# E Window close
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
er_window_close(){
|
||||||
|
ERCI org.enlightenment.wm.Window.Close "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# E Window kill
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
er_window_kill(){
|
||||||
|
ERCI org.enlightenment.wm.Window.Kill "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# E Window focus
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
er_window_focus(){
|
||||||
|
ERCI org.enlightenment.wm.Window.Focus "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# E Window iconify
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
er_window_iconify(){
|
||||||
|
ERCI org.enlightenment.wm.Window.Iconify "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# E Window uniconify
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
er_window_uniconify(){
|
||||||
|
ERCI org.enlightenment.wm.Window.Uniconify "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# E Window maximize
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
er_window_maximize(){
|
||||||
|
ERCI org.enlightenment.wm.Window.Maximize "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
# E Window unmaximize
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
er_window_unmaximize(){
|
||||||
|
ERCI org.enlightenment.wm.Window.Unmaximize "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#=== FUNCTION ================================================================
|
#=== FUNCTION ================================================================
|
||||||
|
@ -422,6 +496,30 @@ case "$1" in
|
||||||
-efm-open-dir)
|
-efm-open-dir)
|
||||||
er_efm_open_dir "$@"
|
er_efm_open_dir "$@"
|
||||||
;;
|
;;
|
||||||
|
-window-list)
|
||||||
|
er_window_list
|
||||||
|
;;
|
||||||
|
-window-close)
|
||||||
|
er_window_close "$@"
|
||||||
|
;;
|
||||||
|
-window-kill)
|
||||||
|
er_window_kill "$@"
|
||||||
|
;;
|
||||||
|
-window-focus)
|
||||||
|
er_window_focus "$@"
|
||||||
|
;;
|
||||||
|
-window-iconify)
|
||||||
|
er_window_iconify "$@"
|
||||||
|
;;
|
||||||
|
-window-uniconify)
|
||||||
|
er_window_uniconify "$@"
|
||||||
|
;;
|
||||||
|
-window-maximize)
|
||||||
|
er_window_maximize "$@"
|
||||||
|
;;
|
||||||
|
-window-unmaximize)
|
||||||
|
er_window_unmaximize "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
# This entry needs to be always the last option of the list (*)
|
# This entry needs to be always the last option of the list (*)
|
||||||
-h|-help|--help|--h|*)
|
-h|-help|--help|--h|*)
|
||||||
|
|
|
@ -32,6 +32,18 @@ static DBusMessage *_e_msgbus_profile_add_cb(E_DBus_Object *obj,
|
||||||
static DBusMessage *_e_msgbus_profile_delete_cb(E_DBus_Object *obj,
|
static DBusMessage *_e_msgbus_profile_delete_cb(E_DBus_Object *obj,
|
||||||
DBusMessage *msg);
|
DBusMessage *msg);
|
||||||
|
|
||||||
|
#define E_MSGBUS_WIN_ACTION_CB_PROTO(NAME) \
|
||||||
|
static DBusMessage *_e_msgbus_window_##NAME##_cb(E_DBus_Object *obj __UNUSED__, DBusMessage *msg)
|
||||||
|
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_PROTO(list);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_PROTO(close);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_PROTO(kill);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_PROTO(focus);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_PROTO(iconify);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_PROTO(uniconify);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_PROTO(maximize);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_PROTO(unmaximize);
|
||||||
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static E_Msgbus_Data *_e_msgbus_data = NULL;
|
static E_Msgbus_Data *_e_msgbus_data = NULL;
|
||||||
|
|
||||||
|
@ -102,6 +114,25 @@ e_msgbus_init(void)
|
||||||
e_dbus_interface_method_add(iface, "Add", "s", "", _e_msgbus_profile_add_cb);
|
e_dbus_interface_method_add(iface, "Add", "s", "", _e_msgbus_profile_add_cb);
|
||||||
e_dbus_interface_method_add(iface, "Delete", "s", "", _e_msgbus_profile_delete_cb);
|
e_dbus_interface_method_add(iface, "Delete", "s", "", _e_msgbus_profile_delete_cb);
|
||||||
|
|
||||||
|
iface = e_dbus_interface_new("org.enlightenment.wm.Window");
|
||||||
|
if (!iface)
|
||||||
|
{
|
||||||
|
WRN("Cannot add org.enlightenment.wm.Window interface");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
e_dbus_object_interface_attach(_e_msgbus_data->obj, iface);
|
||||||
|
e_dbus_interface_unref(iface);
|
||||||
|
|
||||||
|
/* Profile methods */
|
||||||
|
e_dbus_interface_method_add(iface, "List", "", "a(si)", _e_msgbus_window_list_cb);
|
||||||
|
e_dbus_interface_method_add(iface, "Close", "i", "", _e_msgbus_window_close_cb);
|
||||||
|
e_dbus_interface_method_add(iface, "Kill", "i", "", _e_msgbus_window_kill_cb);
|
||||||
|
e_dbus_interface_method_add(iface, "Focus", "i", "", _e_msgbus_window_focus_cb);
|
||||||
|
e_dbus_interface_method_add(iface, "Iconify", "i", "", _e_msgbus_window_iconify_cb);
|
||||||
|
e_dbus_interface_method_add(iface, "Uniconify", "i", "", _e_msgbus_window_uniconify_cb);
|
||||||
|
e_dbus_interface_method_add(iface, "Maximize", "i", "", _e_msgbus_window_maximize_cb);
|
||||||
|
e_dbus_interface_method_add(iface, "Unmaximize", "i", "", _e_msgbus_window_unmaximize_cb);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,3 +405,78 @@ _e_msgbus_profile_delete_cb(E_DBus_Object *obj __UNUSED__,
|
||||||
|
|
||||||
return dbus_message_new_method_return(msg);
|
return dbus_message_new_method_return(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Window handlers */
|
||||||
|
static DBusMessage *
|
||||||
|
_e_msgbus_window_list_cb(E_DBus_Object *obj __UNUSED__, DBusMessage *msg)
|
||||||
|
{
|
||||||
|
Eina_List *l;
|
||||||
|
E_Border *bd;
|
||||||
|
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, "(si)", &arr);
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(e_border_client_list(), l, bd)
|
||||||
|
{
|
||||||
|
DBusMessageIter sub;
|
||||||
|
dbus_message_iter_open_container(&arr, DBUS_TYPE_STRUCT, NULL, &sub);
|
||||||
|
dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &bd->client.icccm.name);
|
||||||
|
dbus_message_iter_append_basic(&sub, DBUS_TYPE_INT32, &bd->client.win);
|
||||||
|
dbus_message_iter_close_container(&arr, &sub);
|
||||||
|
}
|
||||||
|
dbus_message_iter_close_container(&iter, &arr);
|
||||||
|
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define E_MSGBUS_WIN_ACTION_CB_BEGIN(NAME) \
|
||||||
|
static DBusMessage * \
|
||||||
|
_e_msgbus_window_##NAME##_cb(E_DBus_Object *obj __UNUSED__, DBusMessage *msg) \
|
||||||
|
{ \
|
||||||
|
E_Border *bd; \
|
||||||
|
int xwin;\
|
||||||
|
DBusMessageIter iter;\
|
||||||
|
\
|
||||||
|
dbus_message_iter_init(msg, &iter);\
|
||||||
|
dbus_message_iter_get_basic(&iter, &xwin);\
|
||||||
|
bd = e_border_find_by_client_window(xwin);\
|
||||||
|
if (bd)\
|
||||||
|
{
|
||||||
|
|
||||||
|
#define E_MSGBUS_WIN_ACTION_CB_END \
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
return dbus_message_new_method_return(msg);\
|
||||||
|
}
|
||||||
|
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_BEGIN(close)
|
||||||
|
e_border_act_close_begin(bd);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_END
|
||||||
|
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_BEGIN(kill)
|
||||||
|
e_border_act_kill_begin(bd);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_END
|
||||||
|
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_BEGIN(focus)
|
||||||
|
e_border_focus_set(bd, 1, 1);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_END
|
||||||
|
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_BEGIN(iconify)
|
||||||
|
e_border_iconify(bd);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_END
|
||||||
|
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_BEGIN(uniconify)
|
||||||
|
e_border_uniconify(bd);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_END
|
||||||
|
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_BEGIN(maximize)
|
||||||
|
e_border_maximize(bd, e_config->maximize_policy);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_END
|
||||||
|
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_BEGIN(unmaximize)
|
||||||
|
e_border_unmaximize(bd, E_MAXIMIZE_BOTH);
|
||||||
|
E_MSGBUS_WIN_ACTION_CB_END
|
||||||
|
|
Loading…
Reference in New Issue