#include "e.h"
+#include "e_info_shared_types.h"
#include <time.h>
#include <dirent.h>
}
}
+#define ROTATION_USAGE \
+ "[COMMAND] [ARG]...\n" \
+ "\tset : Set the orientation of zone (Usage: set [zone-no] [rval(0|90|180|270)]\n" \
+ "\tinfo : Get the information of zone's rotation (Usage: info [zone-no]) (Not Implemented)\n" \
+ "\tenable : Enable the rotation of zone (Usage: enable [zone-no]\n" \
+ "\tdisable : Disable the rotation of zone (Usage: disable [zone-no]\n"
+
+static void
+_cb_rotation_query(const Eldbus_Message *msg)
+{
+ (void)msg;
+ /* TODO: need implementation */
+}
+
+static void
+_e_info_client_proc_rotation(int argc, char **argv)
+{
+ E_Info_Rotation_Message req;
+ int32_t zone_num = -1;
+ int32_t rval = -1;
+ const int off_len = 2, cmd_len = 1;
+ Eina_Bool res = EINA_FALSE;
+
+ if (argc < off_len + cmd_len)
+ goto arg_err;
+
+ if (eina_streq(argv[off_len], "info"))
+ {
+ if (argc > off_len + cmd_len)
+ zone_num = atoi(argv[off_len + 1]);
+
+ res = _e_info_client_eldbus_message_with_args("rotation_query",
+ _cb_rotation_query,
+ "i", zone_num);
+ }
+ else
+ {
+ if (eina_streq(argv[off_len], "set"))
+ {
+ if (argc < off_len + cmd_len + 1)
+ goto arg_err;
+ else if (argc > off_len + cmd_len + 1)
+ {
+ zone_num = atoi(argv[off_len + 1]);
+ rval = atoi(argv[off_len + 2]);
+ }
+ else
+ rval = atoi(argv[off_len + 1]);
+
+ if ((rval < 0) || (rval > 270) || (rval % 90 != 0))
+ goto arg_err;
+
+ req = E_INFO_ROTATION_MESSAGE_SET;
+ }
+ else
+ {
+ if (argc > off_len + cmd_len)
+ zone_num = atoi(argv[off_len + 1]);
+
+ if (eina_streq(argv[off_len], "enable"))
+ req = E_INFO_ROTATION_MESSAGE_ENABLE;
+ else if (eina_streq(argv[off_len], "disable"))
+ req = E_INFO_ROTATION_MESSAGE_DISABLE;
+ else
+ goto arg_err;
+ }
+
+ res = _e_info_client_eldbus_message_with_args("rotation_message",
+ NULL, "iii",
+ req, zone_num, rval);
+ }
+
+ if (!res)
+ printf("_e_info_client_eldbus_message_with_args error");
+
+ return;
+arg_err:
+ printf("Usage: enlightenment_info -rotation %s", ROTATION_USAGE);
+}
+
static struct
{
const char *option;
"print connected clients on Enlightenment",
_e_info_client_proc_connected_clients
},
+ {
+ "rotation",
+ ROTATION_USAGE,
+ "Send a message about rotation",
+ _e_info_client_proc_rotation
+ },
};
static void
#define PATH "/org/enlightenment/wm"
#define IFACE "org.enlightenment.wm.info"
+EAPI int E_EVENT_INFO_ROTATION_MESSAGE = -1;
+
typedef struct _E_Info_Server
{
Eldbus_Connection *conn;
return reply;
}
+static Eldbus_Message *
+_e_info_server_cb_rotation_query(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+ Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+
+ /* TODO: need implementation */
+
+ return reply;
+}
+
+static void
+_e_info_event_rotation_free(void *data EINA_UNUSED, void *event)
+{
+ E_Event_Info_Rotation_Message *ev = event;
+
+ e_object_unref(E_OBJECT(ev->zone));
+ free(ev);
+}
+
+static Eldbus_Message *
+_e_info_server_cb_rotation_message(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+ Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ E_Event_Info_Rotation_Message *ev;
+ E_Info_Rotation_Message rot_msg;
+ E_Zone *z;
+ Eina_List *l;
+ uint32_t zone_num;
+ uint32_t rval;
+
+ if (!eldbus_message_arguments_get(msg, "iii", &rot_msg, &zone_num, &rval))
+ {
+ ERR("Error getting arguments.");
+ return reply;
+ }
+
+ if (rot_msg == E_INFO_ROTATION_MESSAGE_SET)
+ {
+ /* check if rval is valid */
+ if ((rval < 0) || (rval > 270) || (rval % 90 != 0))
+ return reply;
+ }
+
+ ev = E_NEW(E_Event_Info_Rotation_Message, 1);
+ if (EINA_UNLIKELY(!ev))
+ {
+ ERR("Failed to allocate ""E_Event_Info_Rotation_Message""");
+ return reply;
+ }
+
+ if (zone_num == -1)
+ ev->zone = e_zone_current_get(e_comp);
+ else
+ {
+ EINA_LIST_FOREACH(e_comp->zones, l, z)
+ {
+ if (z->num == zone_num)
+ ev->zone = z;
+ }
+ }
+
+ if (!ev->zone)
+ {
+ ERR("Failed to found zone by given num: num %d", zone_num);
+ free(ev);
+ return reply;
+ }
+
+ e_object_ref(E_OBJECT(ev->zone));
+ ev->message = rot_msg;
+ ev->rotation = rval;
+
+ ecore_event_add(E_EVENT_INFO_ROTATION_MESSAGE, ev, _e_info_event_rotation_free, NULL);
+
+ return reply;
+}
+
static const Eldbus_Method methods[] = {
{ "get_window_info", NULL, ELDBUS_ARGS({"a("VALUE_TYPE_FOR_TOPVWINS")", "array of ec"}), _e_info_server_cb_window_info_get, 0 },
{ "dump_topvwins", ELDBUS_ARGS({"s", "directory"}), NULL, _e_info_server_cb_topvwins_dump, 0 },
{ "eina_log_path", ELDBUS_ARGS({"s", "eina log path"}), NULL, _e_info_server_cb_eina_log_path, 0 },
{ "get_window_prop", ELDBUS_ARGS({"us", "query_mode_value"}), ELDBUS_ARGS({"a(ss)", "array_of_ec"}), _e_info_server_cb_window_prop_get, 0},
{ "get_connected_clients", NULL, ELDBUS_ARGS({"a(ss)", "array of ec"}), _e_info_server_cb_connected_clients_get, 0 },
+ { "rotation_query", ELDBUS_ARGS({"i", "query_rotation"}), NULL, _e_info_server_cb_rotation_query, 0},
+ { "rotation_message", ELDBUS_ARGS({"iii", "rotation_message"}), NULL, _e_info_server_cb_rotation_message, 0},
{ NULL, NULL, NULL, NULL, 0 }
};
&iface_desc);
EINA_SAFETY_ON_NULL_GOTO(e_info_server.iface, err);
+ E_EVENT_INFO_ROTATION_MESSAGE = ecore_event_type_new();
+
return 1;
err: