libeek: add eek_keyboard_find_key_by_position().

This commit is contained in:
Daiki Ueno
2010-08-05 12:31:43 +09:00
parent 94219bd31e
commit 039ea44520
10 changed files with 162 additions and 78 deletions

View File

@ -438,3 +438,26 @@ eek_section_find_key_by_keycode (EekSection *section,
return EEK_SECTION_GET_CLASS(section)->find_key_by_keycode (section,
keycode);
}
EekKey *
eek_section_find_key_by_position (EekSection *section,
gdouble x,
gdouble y)
{
gint angle;
EekBounds bounds;
EekPoint point;
EekElement *key;
eek_element_get_bounds (EEK_ELEMENT(section), &bounds);
point.x = x - bounds.x;
point.y = y - bounds.y;
angle = eek_section_get_angle (section);
eek_point_rotate (&point, -angle);
key = eek_container_find_by_position (EEK_CONTAINER(section),
point.x + bounds.x,
point.y + bounds.y);
if (!key)
return NULL;
return EEK_KEY(key);
}