MCPcopy Create free account
hub / github.com/NetHack/NetHack / gnome_nh_poskey

Function gnome_nh_poskey

outdated/win/gnome/gnbind.c:938–977  ·  view source on GitHub ↗

int nh_poskey(int *x, int *y, int *mod) -- Returns a single character input from the user or a a positioning event (perhaps from a mouse). If the return value is non-zero, a character was typed, else, a position in the MAP window is returned in x, y and mod. mod may be one of CLICK

Source from the content-addressed store, hash-verified

936 routine always returns a non-zero character.
937*/
938int
939gnome_nh_poskey(int *x, int *y, int *mod)
940{
941 gtk_signal_emit(GTK_OBJECT(gnome_windowlist[WIN_STATUS].win),
942 ghack_signals[GHSIG_FADE_HIGHLIGHT]);
943
944 g_askingQuestion = 0;
945 /* Process events until a key or map-click arrives. */
946 while (g_numKeys == 0 && g_numClicks == 0) {
947 if (program_state.done_hup)
948 return '\033';
949 gtk_main_iteration();
950 }
951
952 if (g_numKeys > 0) {
953 int key;
954 GList *theFirst;
955
956 theFirst = g_list_first(g_keyBuffer);
957 g_keyBuffer = g_list_remove_link(g_keyBuffer, theFirst);
958 key = GPOINTER_TO_INT(theFirst->data);
959 g_list_free_1(theFirst);
960 g_numKeys--;
961 return (key);
962 } else {
963 GHClick *click;
964 GList *theFirst;
965
966 theFirst = g_list_first(g_clickBuffer);
967 g_clickBuffer = g_list_remove_link(g_clickBuffer, theFirst);
968 click = (GHClick *) theFirst->data;
969 *x = click->x;
970 *y = click->y;
971 *mod = click->mod;
972 g_free(click);
973 g_list_free_1(theFirst);
974 g_numClicks--;
975 return (0);
976 }
977}
978
979/*
980nhbell() -- Beep at user. [This will exist at least until sounds are

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected