e_config: add cursor_configured_output_resolution configuration 28/262628/3
authorChangyeon Lee <cyeon.lee@samsung.com>
Thu, 3 Dec 2020 11:53:44 +0000 (20:53 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Wed, 18 Aug 2021 02:45:01 +0000 (02:45 +0000)
if output resolution is 4k but resolution of cursor image is 2k resolution,
cursor image should be scaled to 2 and cursor is scaled by tdm driver when
it is displayed by hwc.
hwc must consider scaling of cursor when position is calculated.
but enlightenment doesn't know whether resolution of cursir image is 2k or 4k.
so cursor_configured_output_resolution is added in e_config.

Change-Id: I825a6b7cbc411725f188e4aaf116d8f3df5799f6

src/bin/e_config.c
src/bin/e_config.h
src/bin/e_hwc_window.c

index 61f51c8..a46670f 100644 (file)
@@ -304,6 +304,9 @@ _e_config_edd_init(Eina_Bool old)
    E_CONFIG_VAL(D, T, configured_output_resolution.use, UCHAR);
    E_CONFIG_VAL(D, T, configured_output_resolution.w, INT);
    E_CONFIG_VAL(D, T, configured_output_resolution.h, INT);
+   E_CONFIG_VAL(D, T, cursor_configured_output_resolution.use, UCHAR);
+   E_CONFIG_VAL(D, T, cursor_configured_output_resolution.w, INT);
+   E_CONFIG_VAL(D, T, cursor_configured_output_resolution.h, INT);
    E_CONFIG_VAL(D, T, global_object_not_provide.launch_effect, UCHAR);
    E_CONFIG_VAL(D, T, use_thread_max_cpu, UCHAR);
    E_CONFIG_VAL(D, T, use_desk_group, UCHAR);
index 9851952..5f1fa46 100644 (file)
@@ -256,6 +256,14 @@ struct _E_Config
       int count;             // value of the configured maximum touch count
    } configured_max_touch;
 
+   // Configured output resolution for Global Cursor Window
+   struct
+   {
+      unsigned char use; // use the configured output resolution for global cursor.
+      int w;             // width of the configured output resolution for global cursor.
+      int h;             // height of the configured output resolution for global cursor.
+   } cursor_configured_output_resolution;
+
    //specific global object( client not to bind )
    struct
    {
index dee42b4..da20a93 100644 (file)
@@ -501,33 +501,47 @@ _e_hwc_window_cursor_image_update(E_Hwc_Window *hwc_window)
 }
 
 static void
-_e_hwc_window_cursor_position_get(E_Pointer *ptr, int width, int height, unsigned int *x, unsigned int *y)
+_e_hwc_window_cursor_position_get(E_Pointer *ptr, E_Output *output, int width, int height, unsigned int *x, unsigned int *y)
 {
-   int rotation;;
+   int rotation;
+   int hot_x, hot_y;
+   int ratio_w, ratio_h;
 
    rotation = ptr->rotation;
 
+   hot_x = ptr->hot.x;
+   hot_y = ptr->hot.y;
+
+   if (e_config->cursor_configured_output_resolution.use)
+     {
+        ratio_w = output->config.geom.w / e_config->cursor_configured_output_resolution.w;
+        hot_x = (int)((float)hot_x * (float)ratio_w);
+
+        ratio_h = output->config.geom.h / e_config->cursor_configured_output_resolution.h;
+        hot_y = (int)((float)hot_y * (float)ratio_h);
+     }
+
    switch (rotation)
      {
       case 0:
-        *x = ptr->x - ptr->hot.x;
-        *y = ptr->y - ptr->hot.y;
+        *x = ptr->x - hot_x;
+        *y = ptr->y - hot_y;
         break;
       case 90:
-        *x = ptr->x - ptr->hot.y;
-        *y = ptr->y + ptr->hot.x - width;
+        *x = ptr->x - hot_y;
+        *y = ptr->y + hot_x - width;
         break;
       case 180:
-        *x = ptr->x + ptr->hot.x - width;
-        *y = ptr->y + ptr->hot.y - height;
+        *x = ptr->x + hot_x - width;
+        *y = ptr->y + hot_y - height;
         break;
       case 270:
-        *x = ptr->x + ptr->hot.y - height;
-        *y = ptr->y - ptr->hot.x;
+        *x = ptr->x + hot_y - height;
+        *y = ptr->y - hot_x;
         break;
       default:
-        *x = ptr->x - ptr->hot.x;
-        *y = ptr->y - ptr->hot.y;
+        *x = ptr->x - hot_x;
+        *y = ptr->y - hot_y;
         break;
      }
 }
@@ -1125,7 +1139,7 @@ _e_hwc_window_cursor_info_get(E_Hwc_Window *hwc_window, tdm_hwc_window_info *hwc
    EINA_SAFETY_ON_TRUE_RETURN_VAL(hwc_win_info->src_config.size.h == 0, EINA_FALSE);
    hwc_win_info->src_config.size.v = hwc_window->cursor.img_h;
 
-   _e_hwc_window_cursor_position_get(pointer,
+   _e_hwc_window_cursor_position_get(pointer, output,
                                      hwc_win_info->src_config.pos.w,
                                      hwc_win_info->src_config.pos.h,
                                      &hwc_win_info->dst_pos.x,