e_test_event: Add method to get screen size 04/314604/1
authorJunseok Kim <juns.kim@samsung.com>
Tue, 16 Jul 2024 05:45:29 +0000 (14:45 +0900)
committerJunseok Kim <juns.kim@samsung.com>
Tue, 16 Jul 2024 05:45:29 +0000 (14:45 +0900)
Change-Id: I711984a0e915a200a1885ce8a91fd65c53ab4518

src/e_test_event.cpp
src/e_test_event.h
src/e_test_util.h

index d1977a8197190bc7c3e8c7466060652eaa353339..dc6db097aefee7eb39a4a9b0cb37c5f4adb4f37a 100644 (file)
@@ -108,6 +108,7 @@ static void _cb_method_set_tc_timeout(void *data, const Eldbus_Message *msg, Eld
 static void _cb_method_transient_for_below(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
 static void _cb_method_aux_hint_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
 static void _cb_method_configured_output_resolution(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
+static void _cb_method_screen_size_get(void *data, const Eldbus_Message *msg, Eldbus_Pending *p);
 
 /* callbacks - signal */
 static void _cb_signal_vis_changed(void *data, const Eldbus_Message *msg);
@@ -502,6 +503,36 @@ etRunner::unsetBaseOutputResolution(pid_t pid)
    return !!coutres_set;
 }
 
+Eina_Bool
+etRunner::getScreenSize(int *width, int *height)
+{
+   Eldbus_Pending *p = NULL;
+   E_TC_Rectangle geom = {0,};
+   Eina_Bool res = EINA_FALSE;
+
+   if (width) *width = 0;
+   if (height) *height = 0;
+
+   p = eldbus_proxy_call(dbus.ds_proxy,
+                         "GetScreenSize",
+                         _cb_method_screen_size_get,
+                         &geom,
+                         -1,
+                         "");
+   EINA_SAFETY_ON_NULL_RETURN_VAL(p, EINA_FALSE);
+
+   work();
+
+   if (geom.w > 0 && geom.h > 0)
+     {
+        if (width) *width = geom.w;
+        if (height) *height = geom.h;
+        res = EINA_TRUE;
+     }
+
+   return res;
+}
+
 Eina_Bool
 etRunner::setWinIconic(etWin *tw,
                       Eina_Bool set)
@@ -2215,6 +2246,32 @@ finish:
    etRunner::get().finishWork();
 }
 
+static void
+_cb_method_screen_size_get(void *data,
+                           const Eldbus_Message *msg,
+                           Eldbus_Pending *p)
+{
+   const char *name = NULL, *text = NULL;
+   Eina_Bool res = EINA_FALSE;
+   E_TC_Rectangle *geom = (E_TC_Rectangle *)data;
+
+   geom->w = 0;
+   geom->h = 0;
+
+   res = eldbus_message_error_get(msg, &name, &text);
+   EINA_SAFETY_ON_TRUE_GOTO(res, finish);
+
+   res = eldbus_message_arguments_get(msg, "ii", &geom->w, &geom->h);
+
+finish:
+   if ((name) || (text))
+     {
+        ERR("errname: %s errmsg: %s\n", name, text);
+     }
+
+   etRunner::get().finishWork();
+}
+
 /* callbacks - signal */
 static void
 _cb_signal_vis_changed(void *data,
index 9771410d7ef1f6b0a696ad48798c00aea9e1a959..fa504db63ab45dacaa2efe5074acc9759f9d23a4 100644 (file)
@@ -334,6 +334,7 @@ public:
    Eina_Bool     unsetConfiguredOutputResolution();
    Eina_Bool     setBaseOutputResolution(pid_t pid, int width, int height);
    Eina_Bool     unsetBaseOutputResolution(pid_t pid);
+   Eina_Bool     getScreenSize(int *width, int *height);
 
    void          flushEventQueue();
    Eina_Bool     insertEventQueue(std::shared_ptr<eventItem> item);
index ad62e09853b9a3177ea612e629c20110c309e4c4..0fa0d594d3ce7ce3bc8f21233db59a5c7f5c599c 100644 (file)
@@ -190,6 +190,11 @@ typedef struct _Window_Info_List
    Eina_Bool  retry;
 } Window_Info_List;
 
+typedef struct _E_TC_Rectangle
+{
+   int x, y, w, h;
+} E_TC_Rectangle;
+
 #define EFL_UTIL_RETURN_TO_STRING(type)                                                 \
        ((type == EFL_UTIL_ERROR_NONE)?"None":                                           \
         (type == EFL_UTIL_ERROR_INVALID_PARAMETER)?"Invalid parameter":                 \