From a67e97190313d19025925d8b9fd0aa9da3d0dc6a Mon Sep 17 00:00:00 2001 From: "deasung.kim" Date: Tue, 14 Feb 2012 12:25:16 +0900 Subject: [PATCH] [CBHM]add feature, item send using "X property change" for OSP Change-Id: Ifa2308e0807ae578dc43c61396dfa380f1618ff6 --- src/xhandler.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/xhandler.h | 1 + 2 files changed, 46 insertions(+) diff --git a/src/xhandler.c b/src/xhandler.c index 3c758ad..c2cb125 100644 --- a/src/xhandler.c +++ b/src/xhandler.c @@ -461,6 +461,50 @@ static Eina_Bool _xclient_msg_cb(void *data, int type, void *event) countbuf, strlen(countbuf)); } + /* for OSP */ + else if (strncmp("GET_ITEM", ev->data.b, 8) == 0) + { + int itempos = 0; + int index = 8; + xd->atomCBHM_ITEM = ecore_x_atom_get("CBHM_ITEM"); + + while ('0' <= ev->data.b[index] && ev->data.b[index] <= '9') + { + itempos = (itempos * 10) + (ev->data.b[index] - '0'); + index++; + } + + CNP_ITEM *item = item_get_by_index(ad, itempos); + if (!item) + { + Ecore_X_Atom itemtype = ecore_x_atom_get("CBHM_ERROR"); + + char error_buf[] = "OUT OF BOUND"; + int bufsize = sizeof(error_buf); + ecore_x_window_prop_property_set( + ev->win, + xd->atomCBHM_ITEM, + itemtype, + 8, + error_buf, + bufsize); + DMSG("GET ITEM ERROR msg: %s, index: %d, item count: %d\n", + ev->data.b, itempos, item_count_get(ad)); + } + else + { + ecore_x_window_prop_property_set( + ev->win, + xd->atomCBHM_ITEM, + ad->targetAtoms[item->type_index].atom[0], + 8, + item->data, + item->len); + DMSG("GET ITEM index: %d, item type: %d, item data: %s, item->len: %d\n", + itempos, ad->targetAtoms[item->type_index].atom[0], + item->data, item->len); + } + } /* else if (strncmp("get #", ev->data.b, 5) == 0) { // FIXME : handle greater than 9 @@ -587,6 +631,7 @@ XHandlerData *init_xhandler(AppData *ad) xd->atomInc = ecore_x_atom_get("INCR"); xd->atomWindowRotate = ecore_x_atom_get("_E_ILLUME_ROTATE_WINDOW_ANGLE"); xd->atomCBHM_MSG = ecore_x_atom_get("CBHM_MSG"); + xd->atomCBHM_ITEM = ecore_x_atom_get("CBHM_ITEM"); xd->atomXKey_MSG = ecore_x_atom_get("_XKEY_COMPOSITION"); xd->atomCBHMCount = ecore_x_atom_get("CBHM_cCOUNT"); xd->atomUTF8String = ecore_x_atom_get("UTF8_STRING"); diff --git a/src/xhandler.h b/src/xhandler.h index 18a446a..c112cfd 100644 --- a/src/xhandler.h +++ b/src/xhandler.h @@ -34,6 +34,7 @@ struct _XHandlerData { Ecore_X_Atom atomWindowRotate; Ecore_X_Atom atomCBHM_MSG; + Ecore_X_Atom atomCBHM_ITEM; Ecore_X_Atom atomXKey_MSG; Ecore_X_Atom atomUTF8String; -- 2.7.4