Revert "Use the focused E_Client for floating position" 13/215413/1
authorInHong Han <inhong1.han@samsung.com>
Mon, 7 Oct 2019 07:19:14 +0000 (16:19 +0900)
committerInHong Han <inhong1.han@samsung.com>
Tue, 8 Oct 2019 03:22:42 +0000 (12:22 +0900)
This reverts commit 40a6f99634c0eb57845f4c7f2f4bddad13c018c8.

Change-Id: I9b2933f05a35e8f5272338804419a3475e6c9f17
Signed-off-by: InHong Han <inhong1.han@samsung.com>
src/e_mod_input_panel.c

index d6cb774..2ae3960 100644 (file)
@@ -66,9 +66,9 @@ struct _E_Input_Panel_Floating_Info
    } start_position;
 };
 
-static E_Input_Panel *g_input_panel = NULL;
-static E_Input_Panel_Floating_Info *g_floating_info = NULL;
-static Eina_Bool use_main_ec_for_position_set = EINA_FALSE;
+E_Input_Panel *g_input_panel = NULL;
+E_Input_Panel_Floating_Info *g_floating_info = NULL;
+Eina_List *handlers = NULL;
 static Eina_Bool panel_show_need_rerun = EINA_FALSE;
 static Ecore_Timer *g_timer_wait_update  = NULL;
 
@@ -347,31 +347,6 @@ _e_input_panel_surface_resource_destroy(struct wl_resource *resource)
    free(ips);
 }
 
-static Eina_Bool
-_e_input_panel_allow_position_set(E_Client *ec, E_Client *focused_ec, const char *function)
-{
-   E_Client *f_ec = focused_ec;
-
-   if (!ec) return EINA_FALSE;
-   if (!f_ec)
-   {
-      f_ec = e_client_focused_get();
-      if (!f_ec) return EINA_FALSE;
-   }
-
-   if (ec->e.state.rot.ang.curr != f_ec->e.state.rot.ang.curr)
-   {
-      if (!use_main_ec_for_position_set)
-      {
-         LOGW("%s: focused_ec's angle(%d) is different with %d", function, f_ec->e.state.rot.ang.curr, ec->e.state.rot.ang.curr);
-         return EINA_FALSE;
-      }
-   }
-   use_main_ec_for_position_set = EINA_FALSE;
-
-   return EINA_TRUE;
-}
-
 static void
 _e_input_panel_init_floating_position(E_Client *ec)
 {
@@ -411,7 +386,6 @@ _e_input_panel_stay_within_screen(E_Client *ec, int x, int y, int *new_x, int *n
    int zx, zy, zw, zh;
 
    if (!ec || !g_floating_info) return;
-   if (!_e_input_panel_allow_position_set(ec, NULL, __FUNCTION__)) return;
 
    e_client_base_output_resolution_useful_geometry_get(ec, &zx, &zy, &zw, &zh);
 
@@ -460,7 +434,6 @@ _e_input_panel_convert_floating_position(E_Client *ec, int x, int y, int *new_x,
    int cur_angle;
 
    if (!ec || !g_floating_info) return;
-   if (!_e_input_panel_allow_position_set(ec, NULL, __FUNCTION__)) return;
 
    cur_angle = ec->e.state.rot.ang.curr;
    if ((!g_floating_info->init_portrait_position && (cur_angle == 0 || cur_angle == 180)) ||
@@ -518,17 +491,11 @@ _e_input_panel_convert_floating_position(E_Client *ec, int x, int y, int *new_x,
 static void
 _e_input_panel_position_set(E_Client *ec, int w, int h)
 {
-   E_Client *focused_ec;
    int nx, ny;
    int zx, zy, zw, zh;
    Eina_Bool is_portrait;
 
-   focused_ec = e_client_focused_get();
-
-   if (!ec || !g_floating_info || !focused_ec) return;
-
-   if (!_e_input_panel_allow_position_set(ec, focused_ec, __FUNCTION__))
-      return;
+   if (!ec || !g_floating_info) return;
 
    e_client_base_output_resolution_useful_geometry_get(ec, &zx, &zy, &zw, &zh);
 
@@ -572,8 +539,6 @@ _e_input_panel_position_set(E_Client *ec, int w, int h)
         _e_input_panel_convert_floating_position(ec, sx, sy, &nx, &ny, E_INPUT_PANEL_COORDINATE_TYPE_LOGICAL);
      }
 
-   LOGD("focused_ec's angle=%d, ec's angle=%d, nx=%d, ny=%d", focused_ec->e.state.rot.ang.curr, ec->e.state.rot.ang.curr, nx, ny);
-
    e_client_util_move_without_frame(ec, nx, ny);
 }
 
@@ -749,12 +714,8 @@ _e_input_panel_client_cb_rotation_change_end(void *data, int type, void *event)
    if (ec != ips->ec)
      goto end;
 
-   if (ips->showing) {
-     LOGD("ec->client.w=%d, ec->client.h=%d", ec->client.w, ec->client.h);
-     use_main_ec_for_position_set = EINA_FALSE;
+   if (ips->showing)
      _e_input_panel_position_set(ec, ec->client.w, ec->client.h);
-     use_main_ec_for_position_set = EINA_TRUE;
-   }
 
 end:
    return ECORE_CALLBACK_PASS_ON;
@@ -784,10 +745,7 @@ _e_ips_cb_evas_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *e
 
    evas_object_geometry_get(obj, NULL, NULL, &w, &h);
 
-   LOGD("w=%d, h=%d", w, h);
-   use_main_ec_for_position_set = EINA_FALSE;
    _e_input_panel_position_set(ec, w, h);
-   use_main_ec_for_position_set = EINA_TRUE;
 }
 
 static void
@@ -834,8 +792,6 @@ _e_ips_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *ev
    if (!g_floating_info->moving_req || !g_floating_info->mouse_pressed)
      return;
 
-   if (!_e_input_panel_allow_position_set(ec, NULL, __FUNCTION__)) return;
-
    evas_object_geometry_get(obj, &x, &y, &w, &h);
 
    d_x = x + (ev->cur.canvas.x - g_floating_info->before_canvas_x);
@@ -1374,7 +1330,7 @@ e_input_panel_show_need_rerun_set(Eina_Bool need_rerun)
 void
 e_input_panel_floating_position_set(int x, int y)
 {
-   E_Client *floating_ec = NULL, *focused_ec = NULL;
+   E_Client *floating_ec = NULL;
    E_Input_Panel_Surface *ips;
    Eina_List *l;
    Eina_List *l_next;
@@ -1389,13 +1345,9 @@ e_input_panel_floating_position_set(int x, int y)
           }
      }
 
-   focused_ec = e_client_focused_get();
-
-   if (!floating_ec || !focused_ec || !g_floating_info) return;
-
-   LOGD("x=%d, y=%d", x, y);
+   if (!floating_ec || !g_floating_info) return;
 
-   switch (focused_ec->e.state.rot.ang.curr)
+   switch (floating_ec->e.state.rot.ang.curr)
      {
         case 90:
         case 270: