TRACE_DS_END();
e_comp->e_comp_screen = e_comp_screen;
+ e_comp_screen->rotation_pre = e_config->screen_rotation_pre;
+ e_comp_screen->rotation_setting = e_config->screen_rotation_setting;
e_comp_screen->rotation = screen_rotation;
TRACE_DS_BEGIN(E_COMP_SCREEN:OUTPUTS INIT);
e_comp->e_comp_screen = NULL;
}
-E_API Eina_Bool
-e_comp_screen_rotation_setting_set(E_Comp_Screen *e_comp_screen, int rotation)
+static E_Output *
+_e_comp_screen_output_find_primary(E_Comp_Screen *e_comp_screen)
{
E_Output *output = NULL, *o;
const Eina_List *l;
- int w, h;
- int screen_rotation;
- E_Input_Device *dev;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation % 90, EINA_FALSE);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation < 0, EINA_FALSE);
- EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation > 270, EINA_FALSE);
-
- if (e_config->screen_rotation_setting == rotation) return EINA_TRUE;
EINA_LIST_FOREACH(e_comp_screen->outputs, l, o)
{
if (!output)
{
ERR("couldn't find the primary output");
- return EINA_FALSE;
+ return NULL;
}
- screen_rotation = (e_config->screen_rotation_pre + rotation) % 360;
+ return output;
+}
+
+static Eina_Bool
+_e_comp_screen_rotation_set(E_Comp_Screen *e_comp_screen, int screen_rotation,
+ void (*setter)(E_Comp_Screen *e_comp_screen, int data), int data)
+{
+ E_Output *output = NULL;
+ E_Input_Device *dev;
+ const Eina_List *l;
+ int w, h;
+
+ output = _e_comp_screen_output_find_primary(e_comp_screen);
+ if (!output)
+ return EINA_FALSE;
if (!e_output_rotate(output, screen_rotation))
return EINA_FALSE;
- /* TODO: need to save e_config->screen_rotation_setting to e_config data file */
- e_config->screen_rotation_setting = rotation;
e_comp_screen->rotation = screen_rotation;
+ if (setter)
+ setter(e_comp_screen, data);
ecore_evas_rotation_with_resize_set(e_comp->ee, e_comp_screen->rotation);
ecore_evas_geometry_get(e_comp->ee, NULL, NULL, &w, &h);
return EINA_TRUE;
}
+static void
+_e_comp_screen_rotation_pre_setter(E_Comp_Screen *e_comp_screen, int rotation_pre)
+{
+ e_comp_screen->rotation_pre = rotation_pre;
+ INF("EE RotationPre: %d", rotation_pre);
+}
+
+E_API Eina_Bool
+e_comp_screen_rotation_pre_set(E_Comp_Screen *e_comp_screen, int rotation_pre)
+{
+ int screen_rotation;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation_pre % 90, EINA_FALSE);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation_pre < 0, EINA_FALSE);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation_pre > 270, EINA_FALSE);
+
+ if (e_comp_screen->rotation_pre == rotation_pre) return EINA_TRUE;
+
+ screen_rotation = (rotation_pre + e_comp_screen->rotation_setting) % 360;
+
+ return _e_comp_screen_rotation_set(e_comp_screen, screen_rotation,
+ _e_comp_screen_rotation_pre_setter, rotation_pre);
+}
+
+static void
+_e_comp_screen_rotation_setting_setter(E_Comp_Screen *e_comp_screen, int rotation)
+{
+ e_comp_screen->rotation_setting = rotation;
+ INF("EE RotationSetting: %d", rotation);
+}
+
+E_API Eina_Bool
+e_comp_screen_rotation_setting_set(E_Comp_Screen *e_comp_screen, int rotation)
+{
+ int screen_rotation;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, EINA_FALSE);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation % 90, EINA_FALSE);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation < 0, EINA_FALSE);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(rotation > 270, EINA_FALSE);
+
+ if (e_comp_screen->rotation_setting == rotation) return EINA_TRUE;
+
+ screen_rotation = (e_comp_screen->rotation_pre + rotation) % 360;
+
+ return _e_comp_screen_rotation_set(e_comp_screen, screen_rotation,
+ _e_comp_screen_rotation_setting_setter, rotation);
+}
+
E_API void
e_comp_screen_rotation_ignore_output_transform_send(E_Client *ec, Eina_Bool ignore)
{
"\tenlightenment_info -kill -all\n" \
"\tenlightenment_info -kill -help\n" \
+static void
+_e_info_client_proc_screen_rotation_pre(int argc, char **argv)
+{
+ int rotation_pre;
+
+ if (argc < 3)
+ {
+ printf("Error Check Args: enlightenment_info -screen_rotation [0|90|180|270]\n");
+ return;
+ }
+
+ rotation_pre = atoi(argv[2]);
+ if (rotation_pre < 0 || rotation_pre > 360 || rotation_pre % 90)
+ {
+ printf("Error Check Args: enlightenment_info -screen_rotation_pre [0|90|180|270]\n");
+ return;
+ }
+
+ if (!_e_info_client_eldbus_message_with_args("screen_rotation_pre", NULL, "i", rotation_pre))
+ printf("_e_info_client_eldbus_message_with_args error");
+}
+
static void
_e_info_client_proc_screen_rotation(int argc, char **argv)
{
"Force render according to parameters",
_e_info_client_proc_force_render
},
+ {
+ "screen_rotation_pre",
+ "[0|90|180|270]",
+ "To rotate screen (pre)",
+ _e_info_client_proc_screen_rotation_pre
+ },
{
"screen_rotation",
"[0|90|180|270]",
return reply;
}
+static Eldbus_Message *
+_e_info_server_cb_screen_rotation_pre(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
+{
+ Eldbus_Message *reply = eldbus_message_method_return_new(msg);
+ int rotation_pre;
+
+ if (!eldbus_message_arguments_get(msg, "i", &rotation_pre))
+ {
+ ERR("Error getting arguments.");
+ return reply;
+ }
+
+ if (!e_comp || !e_comp->e_comp_screen)
+ {
+ ERR("Error no screen.");
+ return reply;
+ }
+
+ e_comp_screen_rotation_pre_set(e_comp->e_comp_screen, rotation_pre);
+
+ return reply;
+}
+
static Eldbus_Message *
_e_info_server_cb_screen_rotation(const Eldbus_Service_Interface *iface EINA_UNUSED, const Eldbus_Message *msg)
{
{ "desktop_geometry_set", ELDBUS_ARGS({"iiii", "Geometry"}), NULL, _e_info_server_cb_desktop_geometry_set, 0},
{ "desk_zoom", ELDBUS_ARGS({"ddii", "Zoom"}), NULL, _e_info_server_cb_desk_zoom, 0},
{ "frender", ELDBUS_ARGS({"i", "frender"}), ELDBUS_ARGS({"s", "force_render_result"}), _e_info_server_cb_force_render, 0},
+ { "screen_rotation_pre", ELDBUS_ARGS({"i", "value"}), NULL, _e_info_server_cb_screen_rotation_pre, 0},
{ "screen_rotation", ELDBUS_ARGS({"i", "value"}), NULL, _e_info_server_cb_screen_rotation, 0},
{ "remote_surface", ELDBUS_ARGS({"ii", "remote surface query"}), ELDBUS_ARGS({"as", "remote surfac information"}), _e_info_server_cb_remote_surface, 0},
{ "get_win_under_touch", NULL, ELDBUS_ARGS({"i", "result"}), _e_info_server_cb_get_win_under_touch, 0 },