mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-24 07:45:21 +00:00
Replaced core of flushinp() with platform-specific PDC_flushinp(),
instead of a bunch of ifdefs. It's cleaner this way. To Do: I'm working toward complete separation -- i.e., no platform ifdefs in the pdcurses directory.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: curspriv.h,v 1.69 2006/07/02 19:03:59 wmcbrine Exp $ */
|
||||
/* $Id: curspriv.h,v 1.70 2006/07/06 23:50:10 wmcbrine Exp $ */
|
||||
|
||||
/* CURSPRIV.H
|
||||
|
||||
@@ -214,6 +214,7 @@ int PDC_cursor_off(void);
|
||||
int PDC_cursor_on(void);
|
||||
int PDC_curs_set(int);
|
||||
int PDC_fix_cursor(int);
|
||||
void PDC_flushinp(void);
|
||||
int PDC_get_bios_key(void);
|
||||
int PDC_get_columns(void);
|
||||
bool PDC_get_ctrl_break(void);
|
||||
@@ -265,8 +266,6 @@ int PDC_query_adapter_type(void);
|
||||
#endif
|
||||
|
||||
#ifdef XCURSES
|
||||
int XCurses_rawgetch(void);
|
||||
bool XCurses_kbhit(void);
|
||||
int XCursesInstruct(int);
|
||||
int XCursesInstructAndWait(int);
|
||||
int XCursesInitscr(const char *, int, char **);
|
||||
|
||||
@@ -533,6 +533,7 @@ FUNCTIONS
|
||||
PDC_cursor_on pdcdisp
|
||||
PDC_debug pdcdebug
|
||||
PDC_fix_cursor pdcdisp
|
||||
PDC_flushinp pdckbd
|
||||
PDC_getch getch
|
||||
PDC_get_attribute pdcgetsc
|
||||
PDC_get_bios_key pdckbd
|
||||
|
||||
27
dos/pdckbd.c
27
dos/pdckbd.c
@@ -24,7 +24,7 @@
|
||||
#define CURSES_LIBRARY 1
|
||||
#include <curses.h>
|
||||
|
||||
RCSID("$Id: pdckbd.c,v 1.23 2006/03/29 20:06:40 wmcbrine Exp $");
|
||||
RCSID("$Id: pdckbd.c,v 1.24 2006/07/06 23:50:12 wmcbrine Exp $");
|
||||
|
||||
/************************************************************************
|
||||
* Table for key code translation of function keys in keypad mode *
|
||||
@@ -581,3 +581,28 @@ unsigned long PDC_get_key_modifiers(void)
|
||||
|
||||
return pdc_key_modifiers;
|
||||
}
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_flushinp() - Low-level input flush
|
||||
|
||||
PDCurses Description:
|
||||
This is a private PDCurses routine.
|
||||
|
||||
Discards any pending keyboard and mouse input. Called by
|
||||
flushinp().
|
||||
|
||||
Portability:
|
||||
PDCurses void PDC_flushinp(void);
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
void PDC_flushinp(void)
|
||||
{
|
||||
PDC_LOG(("PDC_flushinp() - called\n"));
|
||||
|
||||
/* Force the BIOS kbd buf head/tail pointers to be the
|
||||
same... Real nasty trick... */
|
||||
|
||||
setdosmemword(0x41a, getdosmemword (0x41c));
|
||||
}
|
||||
|
||||
32
os2/pdckbd.c
32
os2/pdckbd.c
@@ -26,7 +26,11 @@
|
||||
# include <bsedos.h>
|
||||
#endif
|
||||
|
||||
RCSID("$Id: pdckbd.c,v 1.24 2006/03/29 20:06:40 wmcbrine Exp $");
|
||||
#ifdef EMXVIDEO
|
||||
# include <termios.h>
|
||||
#endif
|
||||
|
||||
RCSID("$Id: pdckbd.c,v 1.25 2006/07/06 23:50:12 wmcbrine Exp $");
|
||||
|
||||
/************************************************************************
|
||||
* Table for key code translation of function keys in keypad mode *
|
||||
@@ -687,3 +691,29 @@ unsigned long PDC_get_key_modifiers(void)
|
||||
|
||||
return pdc_key_modifiers;
|
||||
}
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_flushinp() - Low-level input flush
|
||||
|
||||
PDCurses Description:
|
||||
This is a private PDCurses routine.
|
||||
|
||||
Discards any pending keyboard and mouse input. Called by
|
||||
flushinp().
|
||||
|
||||
Portability:
|
||||
PDCurses void PDC_flushinp(void);
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
void PDC_flushinp(void)
|
||||
{
|
||||
PDC_LOG(("PDC_flushinp() - called\n"));
|
||||
|
||||
#ifdef EMXVIDEO
|
||||
tcflush(0, TCIFLUSH);
|
||||
#else
|
||||
KbdFlushBuffer(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -16,13 +16,8 @@
|
||||
************************************************************************/
|
||||
|
||||
#define CURSES_LIBRARY 1
|
||||
#define INCLUDE_WINDOWS_H
|
||||
#include <curses.h>
|
||||
|
||||
#if defined(OS2) && defined(EMXVIDEO)
|
||||
# include <termios.h>
|
||||
#endif
|
||||
|
||||
/* undefine any macros for functions defined in this module */
|
||||
#undef unctrl
|
||||
#undef keyname
|
||||
@@ -32,7 +27,7 @@
|
||||
#undef delay_output
|
||||
#undef flushinp
|
||||
|
||||
RCSID("$Id: util.c,v 1.34 2006/04/23 02:56:38 wmcbrine Exp $");
|
||||
RCSID("$Id: util.c,v 1.35 2006/07/06 23:50:13 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -230,38 +225,14 @@ int delay_output(int ms)
|
||||
|
||||
int flushinp(void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
extern HANDLE hConIn;
|
||||
#endif
|
||||
extern int c_pindex; /* putter index */
|
||||
extern int c_gindex; /* getter index */
|
||||
extern int c_ungind; /* wungetch() push index */
|
||||
|
||||
PDC_LOG(("flushinp() - called\n"));
|
||||
|
||||
#ifdef DOS
|
||||
/* Force the BIOS kbd buf head/tail pointers to be the
|
||||
same... Real nasty trick... */
|
||||
PDC_flushinp();
|
||||
|
||||
setdosmemword(0x41a, getdosmemword (0x41c));
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
# ifdef EMXVIDEO
|
||||
tcflush(0, TCIFLUSH);
|
||||
# else
|
||||
KbdFlushBuffer(0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
FlushConsoleInputBuffer(hConIn);
|
||||
#endif
|
||||
|
||||
#ifdef XCURSES
|
||||
while (XCurses_kbhit())
|
||||
XCurses_rawgetch();
|
||||
#endif
|
||||
c_gindex = 1; /* set indices to kill buffer */
|
||||
c_pindex = 0;
|
||||
c_ungind = 0; /* clear c_ungch array */
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#define INCLUDE_WINDOWS_H
|
||||
#include <curses.h>
|
||||
|
||||
RCSID("$Id: pdckbd.c,v 1.44 2006/07/04 03:51:38 wmcbrine Exp $");
|
||||
RCSID("$Id: pdckbd.c,v 1.45 2006/07/06 23:50:13 wmcbrine Exp $");
|
||||
|
||||
#define KEY_STATE TRUE
|
||||
#define MS_MOUSE_MOVED 1
|
||||
@@ -1385,6 +1385,28 @@ unsigned long PDC_get_key_modifiers(void)
|
||||
return pdc_key_modifiers;
|
||||
}
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_flushinp() - Low-level input flush
|
||||
|
||||
PDCurses Description:
|
||||
This is a private PDCurses routine.
|
||||
|
||||
Discards any pending keyboard and mouse input. Called by
|
||||
flushinp().
|
||||
|
||||
Portability:
|
||||
PDCurses void PDC_flushinp(void);
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
void PDC_flushinp(void)
|
||||
{
|
||||
PDC_LOG(("PDC_flushinp() - called\n"));
|
||||
|
||||
FlushConsoleInputBuffer(hConIn);
|
||||
}
|
||||
|
||||
#ifdef PDC_THREAD_BUILD
|
||||
|
||||
LONG InputThread(LPVOID lpThreadData)
|
||||
|
||||
25
x11/pdckbd.c
25
x11/pdckbd.c
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "pdcx11.h"
|
||||
|
||||
RCSID("$Id: pdckbd.c,v 1.22 2006/07/02 19:03:59 wmcbrine Exp $");
|
||||
RCSID("$Id: pdckbd.c,v 1.23 2006/07/06 23:50:13 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -205,3 +205,26 @@ unsigned long PDC_get_key_modifiers(void)
|
||||
|
||||
return pdc_key_modifier;
|
||||
}
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
PDC_flushinp() - Low-level input flush
|
||||
|
||||
PDCurses Description:
|
||||
This is a private PDCurses routine.
|
||||
|
||||
Discards any pending keyboard and mouse input. Called by
|
||||
flushinp().
|
||||
|
||||
Portability:
|
||||
PDCurses void PDC_flushinp(void);
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
void PDC_flushinp(void)
|
||||
{
|
||||
PDC_LOG(("PDC_flushinp() - called\n"));
|
||||
|
||||
while (XCurses_kbhit())
|
||||
XCurses_rawgetch();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: pdcx11.h,v 1.29 2006/07/02 19:03:59 wmcbrine Exp $ */
|
||||
/* $Id: pdcx11.h,v 1.30 2006/07/06 23:50:13 wmcbrine Exp $ */
|
||||
|
||||
#define CURSES_LIBRARY 1
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -288,6 +288,9 @@ int XCursesDisplayText(const chtype *, int, int, int, bool);
|
||||
void XCursesDisplayScreen(bool);
|
||||
void XCursesDisplayCursor(int, int, int, int);
|
||||
|
||||
int XCurses_rawgetch(void);
|
||||
bool XCurses_kbhit(void);
|
||||
|
||||
int XCurses_display_cursor(int, int, int, int, int);
|
||||
|
||||
void XCursesStructureNotify(Widget, XtPointer, XEvent *, Boolean *);
|
||||
|
||||
Reference in New Issue
Block a user