Exemplo n.º 1
0
/*** RELEASE CURRENT USERSTATE ***/
static void leave_current(void) {

	switch (curr_state) {
	case USERSTATE_DRAG:
		if (curr_release_callback) {
			curr_release_callback(curr_selected, curr_mx - omx, curr_my - omy);
		}
		break;
	case USERSTATE_TOUCH:
		if (curr_release_callback) {
			curr_release_callback(curr_selected, curr_mx - omx, curr_my - omy);
		}
		curr_selected->gen->set_state(curr_selected, 0);
		if (curr_mfocus != curr_selected) {
			curr_selected->gen->set_mfocus(curr_selected,0);
		}
		curr_selected->gen->update(curr_selected);
		break;
	case USERSTATE_GRAB:
		set_pos(omx, omy);
		scrdrv->set_mouse_pos(omx,omy);
		break;
	default:
		break;
	}
}
Exemplo n.º 2
0
/**
 * Release current userstate
 */
static void leave_current(void)
{
	WIDGET *last_selected;

	switch (curr_state) {
	case USERSTATE_DRAG:
		if (curr_release_callback) {
			curr_release_callback(curr_selected, curr_mx - omx, curr_my - omy);
		}
		break;
	case USERSTATE_TOUCH:

		if (!curr_selected)
			return;

		/* forget about selected widget */
		last_selected = curr_selected;
		curr_selected->gen->dec_ref(curr_selected);
		curr_selected = 0;

		/*
		 * We have to reset 'curr_selected' before calling the
		 * release callback to prevent infinte recursions that
		 * would happen if the callback indirectly enters
		 * user-state code.
		 */
		if (curr_release_callback)
			curr_release_callback(last_selected, curr_mx - omx, curr_my - omy);

		/* revert widget state */
		last_selected->gen->set_state(last_selected, 0);
		if (curr_mfocus != last_selected)
			last_selected->gen->set_mfocus(last_selected,0);

		last_selected->gen->update(last_selected);

		break;
	case USERSTATE_GRAB:
		set_pos(omx, omy);
		scrdrv->set_mouse_pos(omx,omy);
		break;
	default:
		break;
	}
}