ObMenuFrame* menu_frame_under(gint x, gint y) { ObMenuFrame *ret = NULL; GList *it; for (it = menu_frame_visible; it; it = g_list_next(it)) { ObMenuFrame *f = it->data; if (RECT_CONTAINS(f->area, x, y)) { ret = f; break; } } return ret; }
static void do_edge_warp(gint x, gint y) { guint i; ObDirection dir; if (!config_mouse_screenedgetime) return; dir = -1; for (i = 0; i < screen_num_monitors; ++i) { const Rect *a = screen_physical_area_monitor(i); if (!RECT_CONTAINS(*a, x, y)) continue; if (x == RECT_LEFT(*a)) dir = OB_DIRECTION_WEST; if (x == RECT_RIGHT(*a)) dir = OB_DIRECTION_EAST; if (y == RECT_TOP(*a)) dir = OB_DIRECTION_NORTH; if (y == RECT_BOTTOM(*a)) dir = OB_DIRECTION_SOUTH; /* try check for xinerama boundaries */ if ((x + 1 == RECT_LEFT(*a) || x - 1 == RECT_RIGHT(*a)) && (dir == OB_DIRECTION_WEST || dir == OB_DIRECTION_EAST)) { dir = -1; } if ((y + 1 == RECT_TOP(*a) || y - 1 == RECT_BOTTOM(*a)) && (dir == OB_DIRECTION_NORTH || dir == OB_DIRECTION_SOUTH)) { dir = -1; } } if (dir != edge_warp_dir) { cancel_edge_warp(); if (dir != (ObDirection)-1) { edge_warp_odd = TRUE; /* switch on the first timeout */ edge_warp_timer = g_timeout_add(config_mouse_screenedgetime, edge_warp_delay_func, NULL); } edge_warp_dir = dir; } }
ObMenuEntryFrame* menu_entry_frame_under(gint x, gint y) { ObMenuFrame *frame; ObMenuEntryFrame *ret = NULL; GList *it; if ((frame = menu_frame_under(x, y))) { x -= ob_rr_theme->mbwidth + frame->area.x; y -= ob_rr_theme->mbwidth + frame->area.y; for (it = frame->entries; it; it = g_list_next(it)) { ObMenuEntryFrame *e = it->data; if (RECT_CONTAINS(e->area, x, y)) { ret = e; break; } } } return ret; }