e_comp_screen: update size of e_comp_screen when output is changed 16/271316/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Tue, 8 Feb 2022 04:43:48 +0000 (13:43 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Fri, 18 Feb 2022 02:15:39 +0000 (11:15 +0900)
Change-Id: I7037685accc579011e43a7aa0eac5d47f8005a86

src/bin/e_comp_screen.c

index c57f04b..8b3f86c 100644 (file)
@@ -14,6 +14,7 @@ static Eldbus_Connection_Type edbus_conn_type = ELDBUS_CONNECTION_TYPE_SYSTEM;
 static Eldbus_Service_Interface *e_comp_screen_iface;
 
 static Eina_List *event_handlers = NULL;
+static Eina_List *output_hooks = NULL;
 
 static Eina_Bool dont_set_e_input_keymap = EINA_FALSE;
 static Eina_Bool dont_use_xkb_cache = EINA_FALSE;
@@ -1118,6 +1119,29 @@ e_comp_screen_e_screens_get(E_Comp_Screen *e_comp_screen)
    return e_comp_screen->e_screens;
 }
 
+#undef E_OUTPUT_HOOK_APPEND
+#define E_OUTPUT_HOOK_APPEND(l, t, cb, d) \
+  do                                      \
+    {                                     \
+       E_Output_Hook *_h;                 \
+       _h = e_output_hook_add(t, cb, d);  \
+       assert(_h);                        \
+       l = eina_list_append(l, _h);       \
+    }                                     \
+  while (0)
+
+static void
+_e_comp_screen_cb_output_connect_status_change(void *data, E_Output *output)
+{
+   _e_comp_screen_size_update(e_comp->e_comp_screen);
+}
+
+static void
+_e_comp_screen_cb_output_mode_change(void *data, E_Output *output)
+{
+   _e_comp_screen_size_update(e_comp->e_comp_screen);
+}
+
 EINTERN Eina_Bool
 e_comp_screen_init()
 {
@@ -1251,6 +1275,9 @@ e_comp_screen_init()
    E_LIST_HANDLER_APPEND(event_handlers, ECORE_EVENT_DEVICE_ADD, _e_comp_screen_cb_input_device_add, comp);
    E_LIST_HANDLER_APPEND(event_handlers, ECORE_EVENT_DEVICE_DEL, _e_comp_screen_cb_input_device_del, comp);
 
+   E_OUTPUT_HOOK_APPEND(output_hooks, E_OUTPUT_HOOK_CONNECT_STATUS_CHANGE, _e_comp_screen_cb_output_connect_status_change, comp);
+   E_OUTPUT_HOOK_APPEND(output_hooks, E_OUTPUT_HOOK_MODE_CHANGE, _e_comp_screen_cb_output_mode_change, comp);
+
    _e_comp_screen_input_rotation_set(e_comp->e_comp_screen->rotation);
 
    return EINA_TRUE;
@@ -1288,6 +1315,8 @@ e_comp_screen_shutdown()
 
    _e_comp_screen_deinit_outputs(e_comp->e_comp_screen);
 
+   E_FREE_LIST(output_hooks, e_output_hook_del);
+
    e_client_hook_del(tzsr_client_hook_del);
    tzsr_client_hook_del = NULL;