AtomData atomList[ATOM_MAX];
ClipData clipList[CLIP_TYPE_MAX];
+static Eina_Bool cbhmPropertyChangeCallback(void* data, int type, void* event);
static Eina_Bool clientMessageCallback(void* data, int type, void* event);
#endif
, m_selectionClearHandler(0)
, m_selectionNotifyHandler(0)
, m_clientMessageHandler(0)
+ , m_cbhmPropertyChangeHandler(0)
+ , m_clipboardWindowOpened(false)
#endif
{
#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
}
#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
+Eina_Bool cbhmPropertyChangeCallback(void* data, int type, void* event)
+{
+ ClipboardHelper *clipboardHelper = static_cast<ClipboardHelper*>(data);
+ Ecore_X_Event_Window_Property *ev = (Ecore_X_Event_Window_Property*) event;
+
+ if (ev->atom != ECORE_X_ATOM_E_ILLUME_CLIPBOARD_STATE)
+ return ECORE_CALLBACK_PASS_ON;
+
+ clipboardHelper->updateClipboardWindowState(ev);
+
+ return ECORE_CALLBACK_PASS_ON;
+}
+
Eina_Bool clientMessageCallback(void* data, int type, void* event)
{
//This callback function is support for open CBHM window from IME clipboard button
for (int i = 0; i < ATOM_MAX; i++)
atomList[i].atom = ecore_x_atom_get(atomList[i].pName);
+ m_cbhmPropertyChangeHandler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, cbhmPropertyChangeCallback, this);
m_selectionClearHandler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, clearClip, this);
m_selectionNotifyHandler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, notifyClip, this);
}
#endif
}
-bool ClipboardHelper::isClipboardWindowOpened()
+void ClipboardHelper::closeClipboardWindow()
{
- char* windowTitle = ecore_x_icccm_title_get(ecore_x_window_focus_get());
-
- if (!windowTitle)
- return false;
-
- if (!(strcmp("Clipboard History Manager", windowTitle)))
- return true;
+ sendCbhmMessage(String::fromUTF8(static_cast<const char*>("cbhm_hide")));
+}
- return false;
+bool ClipboardHelper::isClipboardWindowOpened()
+{
+ return m_clipboardWindowOpened;
}
void ClipboardHelper::connectClipboardWindow()
ecore_event_handler_del(m_selectionNotifyHandler);
m_selectionNotifyHandler = 0;
}
+ if (m_cbhmPropertyChangeHandler) {
+ ecore_event_handler_del(m_cbhmPropertyChangeHandler);
+ m_cbhmPropertyChangeHandler = 0;
+ }
+ m_clipboardWindowOpened = false;
}
bool ClipboardHelper::getSelectedCbhmItem(Ecore_X_Atom* pDataType)
break;
}
}
+
+void ClipboardHelper::updateClipboardWindowState(Ecore_X_Event_Window_Property* ev)
+{
+ Ecore_X_Window zone = ecore_x_e_illume_zone_get(ev->win);
+ Ecore_X_Illume_Clipboard_State state = ecore_x_e_illume_clipboard_state_get(ev->win);
+
+ if (state == ECORE_X_ILLUME_CLIPBOARD_STATE_UNKNOWN)
+ state = ecore_x_e_illume_clipboard_state_get(ev->win);
+
+ if (state == ECORE_X_ILLUME_CLIPBOARD_STATE_OFF)
+ clearClipboardSelectionHandler();
+ else if (state == ECORE_X_ILLUME_CLIPBOARD_STATE_ON)
+ m_clipboardWindowOpened = true;
+}
+
#endif // TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD
}// namespace WebKit
#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
void openClipboardWindow(bool isContentRichlyEditable);
+ void closeClipboardWindow();
bool isClipboardWindowOpened();
void connectClipboardWindow();
void clearClipboardSelectionHandler();
Evas_Object* ewkView() { return m_viewImpl->view(); }
WebPageProxy* page() { return m_viewImpl->page(); }
bool getSelectedCbhmItem(Ecore_X_Atom* pDataType);
+ void updateClipboardWindowState(Ecore_X_Event_Window_Property* ev);
#endif
private:
Mutex m_callbackQueueLock;
#if ENABLE(TIZEN_WEBKIT2_CONTEXT_MENU_CLIPBOARD)
+ bool m_clipboardWindowOpened;
+
+ Ecore_Event_Handler* m_cbhmPropertyChangeHandler;
Ecore_Event_Handler* m_selectionClearHandler;
Ecore_Event_Handler* m_selectionNotifyHandler;
Ecore_Event_Handler* m_clientMessageHandler;