Add virtual keyboard layout mechanism 37/35037/1
authorMun, Gwan-gyeong <kk.moon@samsung.com>
Fri, 6 Feb 2015 09:38:23 +0000 (18:38 +0900)
committerMun, Gwan-gyeong <kk.moon@samsung.com>
Fri, 6 Feb 2015 09:46:46 +0000 (18:46 +0900)
Change-Id: I3911e5f79c01dac721c2c898eda43ac8515be8bc

src/Makefile.am
src/e_mod_keyboard.c [new file with mode: 0644]
src/e_mod_keyboard.h [new file with mode: 0644]
src/e_mod_main.c
src/e_mod_rotation.c
src/e_mod_rotation.h

index 0c2d1be..a45884d 100644 (file)
@@ -16,7 +16,9 @@ module_la_SOURCES      = e_mod_config.c \
                          e_mod_atoms.h \
                          e_mod_rotation.c \
                          e_mod_rotation.h \
-                         e_mod_utils.h
+                         e_mod_utils.h \
+                         e_mod_keyboard.c \
+                         e_mod_keyboard.h
 module_la_LIBADD       =
 module_la_CFLAGS       = @ENLIGHTENMENT_CFLAGS@
 module_la_LDFLAGS      = -module -avoid-version @ENLIGHTENMENT_LIBS@
diff --git a/src/e_mod_keyboard.c b/src/e_mod_keyboard.c
new file mode 100644 (file)
index 0000000..b3b4ffd
--- /dev/null
@@ -0,0 +1,88 @@
+#include "e_mod_keyboard.h"
+#include "e_mod_rotation.h"
+
+EINTERN Eina_Bool
+e_mod_pol_client_is_keyboard(E_Client *ec)
+{
+   E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
+   E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
+
+   if (ec->vkbd.vkbd) return EINA_TRUE;
+
+   return EINA_FALSE;
+}
+
+EINTERN Eina_Bool
+e_mod_pol_client_is_keyboard_sub(E_Client *ec)
+{
+   E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
+   E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
+
+   if (ec->vkbd.vkbd) return EINA_FALSE;
+
+   if ((ec->icccm.class) &&
+       (!strcmp(ec->icccm.class, "ISF")))
+     return EINA_TRUE;
+
+   return EINA_FALSE;
+}
+
+EINTERN void
+e_mod_pol_keyboard_layout_apply(E_Client *ec)
+{
+   int angle;
+   int angle_id = 0;
+   int kbd_x, kbd_y, kbd_w, kbd_h;
+
+   if (!e_mod_pol_client_is_keyboard(ec)) return;
+
+   angle = e_client_rotation_curr_angle_get(ec);
+
+   switch (angle)
+     {
+      case 0: angle_id = 0; break;
+      case 90: angle_id = 1; break;
+      case 180: angle_id = 2; break;
+      case 270: angle_id = 3; break;
+      default: angle_id = 0; break;
+     }
+
+   kbd_w = ec->e.state.rot.geom[angle_id].w;
+   kbd_h = ec->e.state.rot.geom[angle_id].h;
+
+   switch (angle)
+     {
+      case 0:
+         kbd_x = ec->zone->w - kbd_w;
+         kbd_y = ec->zone->h - kbd_h;
+         break;
+
+      case 90:
+         kbd_x = ec->zone->w - kbd_w;
+         kbd_y = ec->zone->h - kbd_h;
+         break;
+
+      case 180:
+         kbd_x = 0;
+         kbd_y = 0;
+         break;
+
+      case 270:
+         kbd_x = 0;
+         kbd_y = 0;
+         break;
+
+      default:
+         kbd_x = ec->zone->w - kbd_w;
+         kbd_y = ec->zone->h - kbd_h;
+         break;
+     }
+
+   if ((ec->frame) &&
+       ((ec->w != kbd_w) || (ec->h != kbd_h)))
+     evas_object_resize(ec->frame, kbd_w, kbd_h);
+
+   if ((ec->frame) &&
+       ((ec->x != kbd_x) || (ec->y != kbd_y)))
+     evas_object_move(ec->frame, kbd_x, kbd_y);
+}
diff --git a/src/e_mod_keyboard.h b/src/e_mod_keyboard.h
new file mode 100644 (file)
index 0000000..19625f1
--- /dev/null
@@ -0,0 +1,9 @@
+#ifndef E_MOD_KEYBOARD_H
+#define E_MOD_KEYBOARD_H
+#include <e.h>
+
+EINTERN Eina_Bool e_mod_pol_client_is_keyboard(E_Client *ec);
+EINTERN Eina_Bool e_mod_pol_client_is_keyboard_sub(E_Client *ec);
+EINTERN void      e_mod_pol_keyboard_layout_apply(E_Client *ec);
+
+#endif
index 82391c7..ebc213b 100644 (file)
@@ -20,6 +20,7 @@
 #include "e_mod_main.h"
 #include "e_mod_atoms.h"
 #include "e_mod_rotation.h"
+#include "e_mod_keyboard.h"
 
 EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Policy-Mobile" };
 
@@ -209,6 +210,15 @@ _pol_client_normal_check(E_Client *ec)
         return EINA_FALSE;
      }
 
+   if (e_mod_pol_client_is_keyboard(ec) ||
+       e_mod_pol_client_is_keyboard_sub(ec))
+     {
+        Pol_Client *pc;
+        pc = eina_hash_find(hash_pol_clients, &ec);
+        if (pc) _pol_client_del(pc);
+        return EINA_FALSE;
+     }
+
    if ((ec->netwm.type == E_WINDOW_TYPE_NORMAL) ||
        (ec->netwm.type == E_WINDOW_TYPE_UNKNOWN))
      {
@@ -264,9 +274,21 @@ _pol_hook_client_eval_post_fetch(void *d EINA_UNUSED, E_Client *ec)
 
    if (e_object_is_del(E_OBJECT(ec))) return;
 
-   if (!_pol_client_normal_check(ec)) return;
    if (ec->new_client) return;
 
+   if (e_mod_pol_client_is_keyboard(ec) ||
+       e_mod_pol_client_is_keyboard_sub(ec))
+     {
+        Pol_Client *pc;
+        pc = eina_hash_find(hash_pol_clients, &ec);
+        if (pc) _pol_client_del(pc);
+
+        if (e_mod_pol_client_is_keyboard(ec))
+          e_mod_pol_keyboard_layout_apply(ec);
+     }
+
+   if (!_pol_client_normal_check(ec)) return;
+
    pd = eina_hash_find(hash_pol_desks, &ec->desk);
    if (!pd) return;
 
@@ -278,6 +300,7 @@ _pol_hook_client_eval_post_fetch(void *d EINA_UNUSED, E_Client *ec)
      }
 
    _pol_client_add(ec);
+
 }
 
 static void
index 860342a..9902455 100644 (file)
@@ -125,7 +125,6 @@ static void      _e_zone_event_rotation_change_end_free(void *data,
 static Eina_Bool  e_client_rotation_is_progress(const E_Client *ec);
 static Eina_Bool  e_client_rotation_is_available(const E_Client *ec, int ang);
 static Eina_List *e_client_rotation_available_list_get(const E_Client *ec);
-static int        e_client_rotation_curr_angle_get(const E_Client *ec);
 static int        e_client_rotation_next_angle_get(const E_Client *ec);
 static int        e_client_rotation_prev_angle_get(const E_Client *ec);
 static int        e_client_rotation_recommend_angle_get(const E_Client *ec);
@@ -972,7 +971,7 @@ e_client_rotation_available_list_get(const E_Client *ec)
  * @param      ec             e_client
  * @return     int            current angle
  */
-static int
+EINTERN int
 e_client_rotation_curr_angle_get(const E_Client *ec)
 {
    E_OBJECT_CHECK_RETURN(ec, -1);
index 71e461c..effdf2f 100644 (file)
@@ -15,5 +15,6 @@ EINTERN Eina_Bool e_mod_pol_rot_cb_window_configure(Ecore_X_Event_Window_Configu
 EINTERN Eina_Bool e_mod_pol_rot_cb_window_property(Ecore_X_Event_Window_Property *ev);
 EINTERN Eina_Bool e_mod_pol_rot_cb_window_message(Ecore_X_Event_Client_Message *ev);
 EINTERN Eina_Bool e_mod_pol_rot_hook_eval_fetch(E_Client *ec);
+EINTERN int e_client_rotation_curr_angle_get(const E_Client *ec);
 
 #endif