Separated floating IME functions from wl_input_method_context_interface 29/269429/1
authorInHong Han <inhong1.han@samsung.com>
Fri, 14 Jan 2022 04:13:49 +0000 (13:13 +0900)
committerInHong Han <inhong1.han@samsung.com>
Fri, 14 Jan 2022 06:30:45 +0000 (15:30 +0900)
Change-Id: I61e6eaed90ecfc04ef4862191f45f686ce55da5a

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

index a1dd9ec7856581ab6f6f5afbbee89c6b747d61b2..6098d30f75bfa58a43720c72f346020c37d509e7 100644 (file)
@@ -9,6 +9,7 @@ pkg_LTLIBRARIES        = module.la
 module_la_SOURCES      = e_mod_main.c \
                          e_mod_input_panel.c \
                          e_mod_input_method_manager.c \
+                         e_mod_input_panel_type.c \
                          wti_log.c
 module_la_LIBADD       =
 module_la_CFLAGS       = @WAYLAND_CFLAGS@ @ENLIGHTENMENT_CFLAGS@ @EEZE_CFLAGS@ @ECORE_CFLAGS@ @EINA_CFLAGS@ @VCONF_CFLAGS@ @CAPI_SYSTEM_INFO_CFLAGS@ @XKBCOMMON_CFLAGS@ -DHAVE_WAYLAND_ONLY -DHAVE_WAYLAND
diff --git a/src/e_mod_input_panel_type.c b/src/e_mod_input_panel_type.c
new file mode 100644 (file)
index 0000000..6ac6c4e
--- /dev/null
@@ -0,0 +1,79 @@
+#define E_COMP_WL
+#include "e.h"
+#include "e_mod_main.h"
+#include "e_mod_input_panel_type.h"
+#include <Ecore.h>
+#include <input-method-server-protocol.h>
+
+typedef struct _E_Input_Panel_Type E_Input_Panel_Type;
+
+struct _E_Input_Panel_Type
+{
+   struct wl_global *global;
+   struct wl_resource *resource;
+};
+
+static void
+_e_input_panel_type_cb_floating_panel_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t state)
+{
+   e_input_panel_floating_panel_set(state ? EINA_TRUE : EINA_FALSE);
+}
+
+static void
+_e_input_panel_type_cb_floating_drag_enabled_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t enabled)
+{
+   e_input_panel_floating_drag_enabled(enabled ? EINA_TRUE : EINA_FALSE);
+}
+
+static const struct wl_input_panel_type_interface _e_input_panel_type_interface =
+{
+   _e_input_panel_type_cb_floating_panel_set,
+   _e_input_panel_type_cb_floating_drag_enabled_set,
+};
+
+static void
+_e_input_panel_type_cb_unbind(struct wl_resource *resource)
+{
+   LOGD("");
+}
+
+static void
+_e_input_panel_type_cb_bind(struct wl_client *client, void *data, uint32_t version EINA_UNUSED, uint32_t id)
+{
+   LOGD("");
+   E_Input_Panel_Type *input_panel_type = data;
+
+   input_panel_type->resource =
+      wl_resource_create(client,
+                         &wl_input_panel_type_interface, 1, id);
+
+   if (input_panel_type->resource)
+     wl_resource_set_implementation(input_panel_type->resource,
+                                    &_e_input_panel_type_interface,
+                                    input_panel_type, _e_input_panel_type_cb_unbind);
+}
+
+Eina_Bool
+e_input_panel_type_create(void)
+{
+   E_Input_Panel_Type *input_panel_type;
+
+   if (!(input_panel_type = E_NEW(E_Input_Panel_Type, 1)))
+     {
+        ERR("Could not allocate space for Input_Panel_Type");
+        return EINA_FALSE;
+     }
+
+   input_panel_type->global =
+      wl_global_create(e_comp_wl->wl.disp,
+                       &wl_input_panel_type_interface, 1,
+                       input_panel_type, _e_input_panel_type_cb_bind);
+
+   if (!input_panel_type->global)
+     {
+        free(input_panel_type);
+        return EINA_FALSE;
+     }
+
+   return EINA_TRUE;
+}
\ No newline at end of file
diff --git a/src/e_mod_input_panel_type.h b/src/e_mod_input_panel_type.h
new file mode 100644 (file)
index 0000000..a51a95f
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef _E_MOD_INPUT_PANEL_TYPE_H
+#define _E_MOD_INPUT_PANEL_TYPE_H
+
+#include <stdio.h>
+
+Eina_Bool e_input_panel_type_create(void);
+
+#endif /* _E_MOD_INPUT_PANEL_TYPE_H */
\ No newline at end of file
index d2ac3a1afd83e06040ef1f21921ebb85b783f4b4..4f225b0ff4b456bc5f9d41b19182de3c1b060b2a 100644 (file)
@@ -2,6 +2,7 @@
 #include "e.h"
 #include "e_mod_main.h"
 #include "e_mod_input_method_manager.h"
+#include "e_mod_input_panel_type.h"
 #include <text-server-protocol.h>
 #include <input-method-server-protocol.h>
 #include <vconf.h>
@@ -1105,18 +1106,6 @@ _e_text_input_method_context_cb_reshow_input_panel(struct wl_client *client EINA
     e_input_panel_wait_update_set(EINA_TRUE);
 }
 
-static void
-_e_text_input_moethod_context_cb_set_floating_panel(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t state)
-{
-    e_input_panel_floating_panel_set(state ? EINA_TRUE : EINA_FALSE);
-}
-
-static void
-_e_text_input_moethod_context_cb_set_floating_drag_enabled(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t enabled)
-{
-    e_input_panel_floating_drag_enabled(enabled ? EINA_TRUE : EINA_FALSE);
-}
-
 static const struct wl_input_method_context_interface _e_text_input_method_context_implementation = {
      _e_text_input_method_context_cb_destroy,
      _e_text_input_method_context_cb_string_commit,
@@ -1145,8 +1134,6 @@ static const struct wl_input_method_context_interface _e_text_input_method_conte
      _e_text_input_method_context_cb_commit_content,
      _e_text_input_method_context_cb_update_candidate_state,
      _e_text_input_method_context_cb_reshow_input_panel,
-     _e_text_input_moethod_context_cb_set_floating_panel,
-     _e_text_input_moethod_context_cb_set_floating_drag_enabled,
 };
 
 static void
@@ -2613,6 +2600,9 @@ e_modapi_init(E_Module *m)
    if (!e_input_method_manager_create())
      goto err;
 
+   if (!e_input_panel_type_create())
+     goto err;
+
    E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_RESIZE, _e_text_input_method_context_cb_client_resize, NULL);
 
    if (vconf_notify_key_changed(VCONFKEY_ISF_HW_KEYBOARD_INPUT_DETECTED, _keyboard_mode_changed_cb, NULL) != 0)