ecore_wl: add api to set data only mode for using clipboard 97/122797/1
authorMinJeong Kim <minjjj.kim@samsung.com>
Mon, 27 Feb 2017 12:52:21 +0000 (21:52 +0900)
committerMinJeong Kim <minjjj.kim@samsung.com>
Mon, 3 Apr 2017 11:19:28 +0000 (20:19 +0900)
Change-Id: I9a560954ede7408da28ea53969a43d9a957280f4
Signed-off-by: MinJeong Kim <minjjj.kim@samsung.com>
src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl.c
src/lib/ecore_wayland/ecore_wl_private.h

index fc43670..723919c 100644 (file)
@@ -1440,6 +1440,7 @@ EAPI void ecore_wl_window_clipboard_state_set(Ecore_Wl_Window *win, Ecore_Wl_Cli
 EAPI Ecore_Wl_Clipboard_State ecore_wl_window_clipboard_state_get(Ecore_Wl_Window *win);
 EAPI void ecore_wl_clipboard_show(Ecore_Wl_Window *win);
 EAPI void ecore_wl_clipboard_hide(Ecore_Wl_Window *win);
+EAPI Eina_Bool ecore_wl_clipboard_data_only_set(Eina_Bool data_only);
 
 EAPI void ecore_wl_window_keyboard_geometry_set(Ecore_Wl_Window *win, int x, int y, int w, int h);
 EAPI Eina_Bool ecore_wl_window_keyboard_geometry_get(Ecore_Wl_Window *win, int *x, int *y, int *w, int *h);
index 9b12f51..537395e 100644 (file)
@@ -67,6 +67,7 @@ static void _ecore_wl_cb_effect_start(void *data EINA_UNUSED, struct tizen_effec
 static void _ecore_wl_cb_effect_end(void *data EINA_UNUSED, struct tizen_effect *tizen_effect EINA_UNUSED, struct wl_surface *surface_resource, unsigned int type);
 static void _ecore_wl_cb_indicator_flick(void *data EINA_UNUSED, struct tizen_indicator *tizen_indicator EINA_UNUSED, struct wl_surface *surface_resource, int type);
 static void _ecore_wl_cb_clipboard_data_selected(void *data EINA_UNUSED, struct tizen_clipboard *clipboard EINA_UNUSED, struct wl_surface *surface);
+static void _ecore_wl_cb_clipboard_data_only_allowed(void *data EINA_UNUSED, struct tizen_clipboard *clipboard EINA_UNUSED, uint32_t allowed);
 static void _ecore_wl_log_cb_print(const char *format, va_list args);
 /* local variables */
 static int _ecore_wl_init_count = 0;
@@ -146,6 +147,7 @@ static const struct tizen_indicator_listener _ecore_tizen_indicator_listener =
 static const struct tizen_clipboard_listener _ecore_tizen_clipboard_listener =
 {
    _ecore_wl_cb_clipboard_data_selected,
+   _ecore_wl_cb_clipboard_data_only_allowed,
 };
 
 static void
@@ -1050,8 +1052,13 @@ _ecore_wl_cb_handle_global(void *data, struct wl_registry *registry, unsigned in
      }
    else if (!strcmp(interface, "tizen_clipboard"))
      {
+        if (version >= 2)
+          client_version = 2;
+        else
+          client_version = version;
+
         ewd->wl.tz_clipboard =
-           wl_registry_bind(registry, id, &tizen_clipboard_interface, 1);
+           wl_registry_bind(registry, id, &tizen_clipboard_interface, client_version);
         if (ewd->wl.tz_clipboard)
           tizen_clipboard_add_listener(ewd->wl.tz_clipboard, &_ecore_tizen_clipboard_listener, ewd->wl.display);
      }
@@ -2137,6 +2144,21 @@ _ecore_wl_cb_indicator_flick(void *data EINA_UNUSED, struct tizen_indicator *tiz
    ecore_event_add(ECORE_WL_EVENT_INDICATOR_FLICK, ev, NULL, NULL);
 }
 
+EAPI Eina_Bool
+ecore_wl_clipboard_data_only_set(Eina_Bool data_only)
+{
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   if (!_ecore_wl_disp) return EINA_FALSE;
+   if (!_ecore_wl_disp->wl.tz_clipboard) return EINA_FALSE;
+   if (!_ecore_wl_disp->input) return EINA_FALSE;
+
+   tizen_clipboard_set_data_only(_ecore_wl_disp->wl.tz_clipboard, data_only);
+
+   ecore_wl_sync();
+
+   return _ecore_wl_disp->input->is_data_only;
+}
+
 static void
 _ecore_wl_cb_clipboard_data_selected(void *data EINA_UNUSED, struct tizen_clipboard *tizen_clipboard EINA_UNUSED, struct wl_surface *surface)
 {
@@ -2154,6 +2176,18 @@ _ecore_wl_cb_clipboard_data_selected(void *data EINA_UNUSED, struct tizen_clipbo
 }
 
 static void
+_ecore_wl_cb_clipboard_data_only_allowed(void *data EINA_UNUSED, struct tizen_clipboard *tizen_clipboard EINA_UNUSED, uint32_t allowed)
+{
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   if (!_ecore_wl_disp->input) return;
+
+   if (allowed)
+     _ecore_wl_disp->input->is_data_only = EINA_TRUE;
+   else
+     _ecore_wl_disp->input->is_data_only = EINA_FALSE;
+}
+
+static void
 _ecore_wl_log_cb_print(const char *format, va_list args)
 {
    char buffer[1024];
index 1cebd81..f059b23 100644 (file)
@@ -318,6 +318,7 @@ struct _Ecore_Wl_Input
 
    Ecore_Wl_Dnd_Source *drag_source;
    Ecore_Wl_Dnd_Source *selection_source;
+   Eina_Bool is_data_only;
 
    struct
      {