MCPcopy Create free account
hub / github.com/Kitware/CMake / wgetch

Function wgetch

Utilities/cmpdcurses/pdcurses/getch.c:323–467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323int wgetch(WINDOW *win)
324{
325 int key, waitcount;
326
327 PDC_LOG(("wgetch() - called\n"));
328
329 if (!win || !SP)
330 return ERR;
331
332 waitcount = 0;
333
334 /* set the number of 1/20th second napms() calls */
335
336 if (SP->delaytenths)
337 waitcount = 2 * SP->delaytenths;
338 else
339 if (win->_delayms)
340 {
341 /* Can't really do millisecond intervals, so delay in
342 1/20ths of a second (50ms) */
343
344 waitcount = win->_delayms / 50;
345 if (!waitcount)
346 waitcount = 1;
347 }
348
349 /* refresh window when wgetch is called if there have been changes
350 to it and it is not a pad */
351
352 if (!(win->_flags & _PAD) && ((!win->_leaveit &&
353 (win->_begx + win->_curx != SP->curscol ||
354 win->_begy + win->_cury != SP->cursrow)) || is_wintouched(win)))
355 wrefresh(win);
356
357 /* if ungotten char exists, remove and return it */
358
359 if (SP->c_ungind)
360 return SP->c_ungch[--(SP->c_ungind)];
361
362 /* if normal and data in buffer */
363
364 if ((!SP->raw_inp && !SP->cbreak) && (SP->c_gindex < SP->c_pindex))
365 return SP->c_buffer[SP->c_gindex++];
366
367 /* prepare to buffer data */
368
369 SP->c_pindex = 0;
370 SP->c_gindex = 0;
371
372 /* to get here, no keys are buffered. go and get one. */
373
374 for (;;) /* loop for any buffering */
375 {
376 /* is there a keystroke ready? */
377
378 if (!PDC_check_key())
379 {
380 /* if not, handle timeout() and halfdelay() */

Callers 5

mvgetchFunction · 0.85
mvwgetchFunction · 0.85
wget_wchFunction · 0.85
wgetnstrFunction · 0.85
wgetn_wstrFunction · 0.85

Calls 10

is_wintouchedFunction · 0.85
wrefreshFunction · 0.85
PDC_check_keyFunction · 0.85
napmsFunction · 0.85
PDC_get_keyFunction · 0.85
_copyFunction · 0.85
_pasteFunction · 0.85
_mouse_keyFunction · 0.85
_highlightFunction · 0.85
waddchFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…