e_comp_wl_screenshooter: Support set_auto_rotation screenmirror request 12/263012/3 accepted/tizen/unified/20210827.045645 submit/tizen/20210825.052725
authorJunkyeong, Kim <jk0430.kim@samsung.com>
Tue, 24 Aug 2021 11:05:42 +0000 (20:05 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 25 Aug 2021 03:03:40 +0000 (03:03 +0000)
Support screenmirror auto rotation by using e_output_stream_capture_autorotate.

Change-Id: Ic3def014b90986b9ec5eb054c14ddde5baca7d8e
Signed-off-by: Junkyeong, Kim <jk0430.kim@samsung.com>
src/bin/e_comp_wl_screenshooter.c

index 9ad3433..0b29ed9 100644 (file)
@@ -29,6 +29,8 @@ typedef struct _E_Mirror
    struct wl_listener client_destroy_listener;
 
    Eina_Bool oneshot_client_destroy;
+
+   Eina_Bool auto_rotation;
 } E_Mirror;
 
 typedef struct _E_Mirror_Buffer
@@ -639,13 +641,36 @@ _e_tz_screenmirror_cb_stop(struct wl_client *client, struct wl_resource *resourc
    tizen_screenmirror_send_stop(resource);
 }
 
+static void
+_e_tz_screenmirror_cb_set_auto_rotation(struct wl_client *client, struct wl_resource *resource, uint32_t set)
+{
+   E_Mirror *mirror = wl_resource_get_user_data(resource);
+
+   EINA_SAFETY_ON_NULL_RETURN(mirror);
+
+   if (_e_screenmirror_privilege_check(client) == EINA_FALSE)
+     {
+        ERR("_e_tz_screenmirror_cb_stop: priv check failed");
+        return;
+     }
+   DBG("_e_tz_screenmirror_cb_set_auto_rotation: %d", set);
+
+   if (set)
+     mirror->auto_rotation = EINA_TRUE;
+   else
+     mirror->auto_rotation = EINA_FALSE;
+
+   e_output_stream_capture_autorotate(mirror->e_output, mirror->auto_rotation);
+}
+
 static const struct tizen_screenmirror_interface _e_tz_screenmirror_interface = {
      _e_tz_screenmirror_cb_destroy,
      _e_tz_screenmirror_cb_set_stretch,
      _e_tz_screenmirror_cb_queue,
      _e_tz_screenmirror_cb_dequeue,
      _e_tz_screenmirror_cb_start,
-     _e_tz_screenmirror_cb_stop
+     _e_tz_screenmirror_cb_stop,
+     _e_tz_screenmirror_cb_set_auto_rotation
 };
 
 static void
@@ -880,7 +905,7 @@ e_comp_wl_screenshooter_init(void)
      }
 
    /* try to add tizen_screenshooter to wayland globals */
-   if (!wl_global_create(e_comp_wl->wl.disp, &tizen_screenshooter_interface, 1,
+   if (!wl_global_create(e_comp_wl->wl.disp, &tizen_screenshooter_interface, 2,
                          NULL, _e_tz_screenshooter_cb_bind))
      {
         ERR("Could not add tizen_screenshooter to wayland globals");