static int player_callback(struct widget *pWidget) { struct player *pPlayer = pWidget->data.player; switch(Main.event.button.button) { #if 0 case SDL_BUTTON_LEFT: break; case SDL_BUTTON_MIDDLE: break; #endif case SDL_BUTTON_RIGHT: if (can_intel_with_player(pPlayer)) { popdown_players_dialog(); popup_intel_dialog(pPlayer); return -1; } break; default: popdown_players_dialog(); popup_diplomacy_dialog(pPlayer); return -1; break; } return -1; }
static int player_nation_callback(struct widget *pWidget) { struct player *pPlayer = pWidget->data.player; popdown_players_nations_dialog(); switch(Main.event.button.button) { #if 0 case SDL_BUTTON_LEFT: break; case SDL_BUTTON_MIDDLE: break; #endif case SDL_BUTTON_RIGHT: if (can_intel_with_player(pPlayer)) { popup_intel_dialog(pPlayer); } else { flush_dirty(); } break; default: if (pPlayer != client.conn.playing) { popup_diplomacy_dialog(pPlayer); } break; } return -1; }
/************************************************************************** ... **************************************************************************/ void players_intel_callback(Widget w, XtPointer client_data, XtPointer call_data) { XawListReturnStruct *ret = XawListShowCurrent(players_list); if (ret->list_index != XAW_LIST_NONE) { int player_index = list_index_to_player_index[ret->list_index]; struct player *pplayer = player_by_number(player_index); if (can_intel_with_player(pplayer)) { popup_intel_dialog(pplayer); } } }