widget_t* widget_hit_test(widget_t* root, point_t p) { widget_t* w; for (w = root->first_child; w != NULL; w = w->next_sibling) { point_t translated_p = { .x = p.x - root->rect.x, .y = p.y - root->rect.y, }; widget_t* w_hit = widget_hit_test(w, translated_p); if (w_hit != NULL) return w_hit; } if (widget_is_visible(root) && rect_inside(root->rect, p)) return root; return NULL; } point_t widget_rel_pos(widget_t* w, point_t abs_pos) { widget_t* parent; point_t rel_pos = abs_pos; for (parent = w->parent; parent != NULL; parent = parent->parent) { rel_pos.x -= parent->rect.x; rel_pos.y -= parent->rect.y; } return rel_pos; }
static int process_area(int index, struct fb_info *info, struct omap3epfb_area *area, struct omap3epfb_update_area *p) { struct omap3epfb_par *par = info->par; int change = 0; if (!(area->effect_flags & (EFFECT_ONESHOT | EFFECT_ACTIVE | EFFECT_CLEAR))) return change; if (!rect_inside(&area->effect_area, p)) { DEBUG_REGION(DEBUG_LEVEL5, p,"no match 0x%02x region %d = ", area->effect_flags, index); return change; } if (area->effect_flags & EFFECT_ONESHOT) { p->wvfid = area->effect_area.wvfid; p->threshold = area->effect_area.threshold; DEBUG_REGION(DEBUG_LEVEL2, p,"process ONESHOT region %d = ", index); if (area->effect_flags & EFFECT_REGION) { p->x0 = area->effect_area.x0; p->y0 = area->effect_area.y0; p->x1 = area->effect_area.x1; p->y1 = area->effect_area.y1; } par->effect_array[index].effect_flags = 0; change = 1; } else if (area->effect_flags & EFFECT_ACTIVE) { p->wvfid = area->effect_area.wvfid; p->threshold = area->effect_area.threshold; DEBUG_REGION(DEBUG_LEVEL2, p,"process ACTIVE region %d = ", index); change = 1; if (p->wvfid == OMAP3EPFB_WVFID_AUTO) { // Calculate the percentage of the screen that needs an update. int percent = ((rect_width(p) * rect_height(p) * 100)) / ((info->var.xres-1) * (info->var.yres-1)); // Check if we need to do a GC of the whole screen if ((par->refresh_percent > 0) && (percent >= par->refresh_percent)) { DEBUG_REGION(DEBUG_LEVEL1, p,"process ACTIVE %d%% region %d = ", percent, index); p->x0 = p->y0 = 0; p->x1 = info->var.xres-1; p->y1 = info->var.yres-1; p->wvfid = OMAP3EPFB_WVFID_GC; p->threshold = 0; } } else { if (area->effect_flags & EFFECT_REGION) { p->x0 = area->effect_area.x0; p->y0 = area->effect_area.y0; p->x1 = area->effect_area.x1; p->y1 = area->effect_area.y1; } } } else if ((area->effect_flags & EFFECT_CLEAR) && rect_equal(&area->effect_area, p)) { // Turn the next update of the effect area into a full page flushing update, // then clear the effect area. // This is used as a hint that a dialog is closing, then we forcing a full screen GC update. p->wvfid = area->effect_area.wvfid; p->threshold = area->effect_area.threshold; DEBUG_REGION(DEBUG_LEVEL2, p,"process RESET region %d = ", index); p->x0 = p->y0 = 0; p->x1 = info->var.xres-1; p->y1 = info->var.yres-1; p->wvfid = OMAP3EPFB_WVFID_GC; par->effect_array[index].effect_flags = 0; change = 1; } // Update the fast scan flags. update_effect(par, index); return change; }