static gboolean rotate(gpointer user_data)
{
	GtkWidget *drawing_area = GTK_WIDGET(user_data);

	if (rotate_func)
	        rotate_func();

	gdk_window_invalidate_rect(drawing_area->window, &drawing_area->allocation, FALSE);
	gdk_window_process_updates(drawing_area->window, FALSE);
	return TRUE;
}
/**
 * @brief       This API reset created the system popup's properties
 *
 *		This API reset created the system popup's properties based on
 *		system popup information DB after extracting popup name from 
 *		given bundle system popup properties to be reset : timeout, 
 *		default action type, ....
 *
 * @param[in]   b		bundle received by app_reset handler
 *				(included system popup name)
 * @return      0 if success, negative value(<0) if fail
 * @retval      0	        - success
 * @retval      -1	        - generic error
 */
int X_syspopup_reset(bundle *b)
{
	const char *popup_name;
	syspopup_info_t *info;
	syspopup *sp = NULL;
	int (*rotate_func) (Display *, Window, syspopup *);

	popup_name = _syspopup_get_name_from_bundle(b);
	if (popup_name == NULL)
		return -1;

	sp = _syspopup_find(popup_name);
	if (!sp)
		return -1;
	else {
		Display *d;
		Window win;

		info = _syspopup_info_get(popup_name);
		if (info == NULL)
			return -1;
		_syspopup_reset_timeout(sp, info);

		if (sp->dupped_bundle)
			free(sp->dupped_bundle);
		sp->dupped_bundle = bundle_dup(b);

		d = XOpenDisplay(NULL);
		win = (Window) sp->internal_data;
		utilx_set_system_notification_level(d, win, info->prio);

		if (info->focus == 1) {
			__X_syspopup_disable_focus (d, win);
		}
		rotate_func = sp->rotate_cb;
		rotate_func(d, win, sp);

		XMapWindow(d, win);
		/*XMapRaised(d,win);*/
		XCloseDisplay(d);

		_syspopup_info_free(info);
	}
	return 0;
}
int X_make_syspopup(bundle *b, Display *dpy, Window xwin, void *win,
		    int (*rotate_func) (Display*, Window, syspopup*),
		    syspopup_handler *handler, void *user_data)
{
	syspopup *sp = NULL;
	syspopup_info_t *info;
	const char *popup_name = _syspopup_get_name_from_bundle(b);
	XWindowAttributes attr;
	int is_unviewable = 0;

	if (popup_name == NULL || handler == NULL)
		return -1;

	info = _syspopup_info_get(popup_name);
	if (info == NULL)
		return -1;

	if (_syspopup_init(__X_syspopup_term_handler,
			   __X_syspopup_timeout_handler) < 0){
		_syspopup_info_free(info);
		return -1;
	}

	XGetWindowAttributes(dpy, xwin, &attr);

	if (attr.map_state == IsViewable) {
		XUnmapWindow(dpy, xwin);
		is_unviewable = 1;
	}

	sp = (syspopup *) malloc(sizeof(syspopup));
	if (sp == NULL) {
		_syspopup_info_free(info);
		return -1;
	}
	
	sp->name = strdup(info->name);
	sp->def_term_fn = handler->def_term_fn;
	sp->def_timeout_fn = handler->def_timeout_fn;
	sp->user_data = user_data;
	sp->internal_data = (void *)xwin;
	sp->win = (void *)win;
	sp->rotate_cb = rotate_func;
	sp->timeout_id = 0;
	sp->dupped_bundle = bundle_dup(b);
	_syspopup_add_new(sp);

	_syspopup_set_term_type(sp, info);
	_syspopup_set_endkey_type(sp, info);

	_syspopup_reset_timeout(sp, info);

	__X_syspopup_change_xwin_type(dpy, xwin);
	utilx_set_system_notification_level(dpy, xwin, info->prio);

	utilx_grab_key(dpy, xwin, KEY_END, TOP_POSITION_GRAB);

	if (info->focus == 1) {
		__X_syspopup_disable_focus (dpy, xwin);
	}

	rotate_func(dpy, xwin, sp);

	if (is_unviewable == 1) {
		XMapWindow(dpy, xwin);
	}

	_syspopup_info_free(info);

	return sp->id;
}