[cbhm] feature merge for clipboard history manager
authorHyoyoung Chang <hyoyoung.chang@samsung.com>
Wed, 15 Sep 2010 06:06:51 +0000 (15:06 +0900)
committerHyoyoung Chang <hyoyoung.chang@samsung.com>
Wed, 15 Sep 2010 06:06:51 +0000 (15:06 +0900)
src/lib/Elementary.h.in
src/lib/elm_cbhm_helper.c
src/lib/elm_entry.c
src/modules/ctxpopup_copypasteUI/copypaste.c

index f7f73b0..292779d 100755 (executable)
@@ -2800,6 +2800,12 @@ extern "C" {
    /* smart callback called:
     * "selectioninfo,timeout" - when time out
     */
+
+   /* do not use except clipboard history module */
+   EAPI Eina_Bool elm_cbhm_helper_init(Evas_Object *self);
+   EAPI void elm_cbhm_send_raw_data(char *cmd);
+
+
    
 #ifdef __cplusplus
 }
index efa56a7..5d9411f 100644 (file)
@@ -205,11 +205,12 @@ elm_cbhm_helper_init(Evas_Object *self)
        cbhm_disp = ecore_x_display_get();
        if (cbhm_disp == NULL)
                return init_flag;
-
-       _get_clipboard_window();
+       if (cbhm_win == None)
+               _get_clipboard_window();
        if (cbhm_win == None)
                _search_clipboard_window(DefaultRootWindow(cbhm_disp));
-       self_win = ecore_evas_software_x11_window_get(ecore_evas_ecore_evas_get(evas_object_evas_get(self)));
+       if (self_win == None)
+               self_win = ecore_evas_software_x11_window_get(ecore_evas_ecore_evas_get(evas_object_evas_get(self)));
    
        if (cbhm_disp && cbhm_win && self_win)
                init_flag = EINA_TRUE;
@@ -300,6 +301,27 @@ elm_cbhm_get_raw_data()
 }
 
 /**
+ * sending raw command to CBHM
+ *
+ * @return void
+ *
+ * @ingroup CBHM_helper
+ */
+EAPI void
+elm_cbhm_send_raw_data(char *cmd)
+{
+       if (init_flag == EINA_FALSE)
+               return;
+
+       if (cmd == NULL)
+               return;
+
+       _send_clipboard_events(cmd);
+
+       return;
+}
+
+/**
  * getting data by history position of CBHM's contents
  * 0 is current content.
  *
index 9859921..ea1af45 100644 (file)
@@ -404,7 +404,14 @@ _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
      {
        evas_object_focus_set(wd->ent, 1);
        edje_object_signal_emit(wd->ent, "elm,action,focus", "elm");
+
        if (top) elm_win_keyboard_mode_set(top, ELM_WIN_KEYBOARD_ON);
+       // start for cbhm
+       if (top) 
+       {
+               ecore_x_selection_secondary_set(elm_win_xwindow_get(obj), "",1);
+       }
+       // end for cbhm
        evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
        _check_enable_returnkey(obj);
      }
@@ -1315,7 +1322,7 @@ _event_selection_notify(void *data, int type __UNUSED__, void *event)
 }
 
 static Eina_Bool
-_event_selection_clear(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
+_event_selection_clear(void *data, int type __UNUSED__, void *event)
 {
 /*
    Widget_Data *wd = elm_widget_data_get(data);
@@ -1328,6 +1335,20 @@ _event_selection_clear(void *data __UNUSED__, int type __UNUSED__, void *event _
        elm_entry_select_none(data);
      }
    return 1;*/
+       // start for cbhm
+   Evas_Object *top = elm_widget_top_get(data);
+   Ecore_X_Event_Selection_Clear *ev = event;
+
+   if (!top)
+          return ECORE_CALLBACK_PASS_ON;
+
+       if (ev->selection != ECORE_X_SELECTION_SECONDARY){
+                          ECORE_X_SELECTION_SECONDARY);
+               return ECORE_CALLBACK_PASS_ON;
+       }
+
+       elm_selection_get(1/*ELM_SEL_SECONDARY*/,0x1/*Markup*/,data);
+       // end for cbhm
    return ECORE_CALLBACK_PASS_ON;
 }
 #endif
index 68189e0..4bdfff3 100644 (file)
@@ -71,6 +71,13 @@ _item_clicked(void *data, Evas_Object *obj, void *event_info)
    Evas_Object *obj2 = it->obj;
 
        if (it->func) it->func(it->data, obj2, NULL);
+       // start for cbhm
+       if (!strcmp(it->label, "Menu"))
+       {
+               elm_cbhm_helper_init(obj);
+               elm_cbhm_send_raw_data("show");
+       }
+       // end for cbhm
        evas_object_hide(obj);
 }