/* Right-clicking on the table can pop up a menu. */ gboolean table_handle_menuclick_event(GdkEventButton * event) { int p; for (p = 0; p < ggzcards.num_players; p++) { int seat_num = ggzcards.players[p].ggzseat; GGZSeat seat; int w = get_text_width(); int x, y; if (seat_num < 0) continue; get_text_box_pos(p, &x, &y); x += XWIDTH; y += XWIDTH; if (event->x < x || event->x >= x + w || event->y < y || event->y >= y + w) continue; seat = ggzmod_get_seat(client_get_ggzmod(), seat_num); popup_player_menu(&seat, NULL, event->button); return TRUE; } return FALSE; }
/**************************************************************************** Find the seat for the given player (in the seat parameter), or returns FALSE if no seat is found. ****************************************************************************/ static bool user_get_seat(const char *name, GGZSeat *seat) { int i; int num = ggzmod_get_num_seats(ggzmod); for (i = 0; i < num; i++) { *seat = ggzmod_get_seat(ggzmod, i); if (seat->type == GGZ_SEAT_PLAYER && strcasecmp(seat->name, name) == 0) { return TRUE; } } return FALSE; }