Functional implementations of PDC_save_key_modifiers() and

PDC_return_key_modifers(); added PDC_modifiers_set(), similar to
PDC_mouse_set().
This commit is contained in:
William McBrine
2006-11-15 16:26:45 +00:00
parent 95b9789564
commit bd4104d17a
7 changed files with 57 additions and 15 deletions

View File

@@ -11,7 +11,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: curses.h,v 1.244 2006/11/09 08:52:36 wmcbrine Exp $ */
/* $Id: curses.h,v 1.245 2006/11/15 16:26:44 wmcbrine Exp $ */
/*----------------------------------------------------------------------*
* PDCurses *
@@ -1477,6 +1477,9 @@ int PDC_setclipboard(const char *, long);
unsigned long PDC_get_input_fd(void);
unsigned long PDC_get_key_modifiers(void);
int PDC_save_key_modifiers(bool);
int PDC_return_key_modifiers(bool);
/*** Functions defined as macros ***/
@@ -1520,8 +1523,6 @@ unsigned long PDC_get_key_modifiers(void);
#define addrawch(c) waddrawch(stdscr, c)
#define insrawch(c) winsrawch(stdscr, c)
#define mvwaddrawch(w,y,x,c) (wmove(w, y, x)==ERR?ERR:waddrawch(w, c))
#define PDC_save_key_modifiers(flag) (SP->save_key_modifiers = flag)
#define PDC_return_key_modifiers(flag) (SP->return_key_modifiers = flag)
/* return codes from PDC_getclipboard() and PDC_setclipboard() calls */

View File

@@ -11,7 +11,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: curspriv.h,v 1.139 2006/11/11 20:24:36 wmcbrine Exp $ */
/* $Id: curspriv.h,v 1.140 2006/11/15 16:26:44 wmcbrine Exp $ */
/* CURSPRIV.H
@@ -80,6 +80,7 @@ int PDC_get_rows(void);
void PDC_gotoyx(int, int);
void PDC_init_atrtab(void);
int PDC_init_color(short, short, short, short);
int PDC_modifiers_set(void);
int PDC_mouse_set(void);
void PDC_napms(int);
void PDC_reset_prog_mode(void);

View File

@@ -19,7 +19,7 @@
#include "pdcdos.h"
RCSID("$Id: pdckbd.c,v 1.50 2006/11/13 00:07:24 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.51 2006/11/15 16:26:45 wmcbrine Exp $");
/************************************************************************
* Table for key code translation of function keys in keypad mode *
@@ -395,3 +395,8 @@ int PDC_mouse_set(void)
SP->_trap_mbe = 0;
return old_mbe ? ERR : OK;
}
int PDC_modifiers_set(void)
{
return SP->return_key_modifers ? ERR : OK;
}

View File

@@ -32,7 +32,7 @@ static HMOU mouse_handle = 0;
static MOUSE_STATUS old_mouse_status;
#endif
RCSID("$Id: pdckbd.c,v 1.54 2006/11/15 01:09:31 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.55 2006/11/15 16:26:45 wmcbrine Exp $");
/************************************************************************
* Table for key code translation of function keys in keypad mode *
@@ -622,3 +622,8 @@ int PDC_mouse_set(void)
#endif
return OK;
}
int PDC_modifiers_set(void)
{
return SP->return_key_modifers ? ERR : OK;
}

View File

@@ -16,7 +16,7 @@
#define _INBUFSIZ 512 /* size of terminal input buffer */
#define NUNGETCH 256 /* max # chars to ungetch() */
RCSID("$Id: getch.c,v 1.56 2006/11/14 14:51:57 wmcbrine Exp $");
RCSID("$Id: getch.c,v 1.57 2006/11/15 16:26:45 wmcbrine Exp $");
static int c_pindex = 0; /* putter index */
static int c_gindex = 1; /* getter index */
@@ -41,7 +41,9 @@ static int c_ungch[NUNGETCH]; /* array of ungotten chars */
int mvwget_wch(WINDOW *win, int y, int x, wint_t *wch);
int unget_wch(const wchar_t wch);
int PDC_get_key_modifiers(void);
unsigned long PDC_get_key_modifiers(void);
int PDC_save_key_modifiers(bool flag);
int PDC_return_key_modifiers(bool flag);
X/Open Description:
With the getch(), wgetch(), mvgetch(), and mvwgetch() functions,
@@ -85,11 +87,13 @@ static int c_ungch[NUNGETCH]; /* array of ungotten chars */
Also, note that the getch() definition will conflict with
many DOS compiler's runtime libraries.
PDC_get_key_modifiers() returns the keyboard modifiers effective
at the time of the last getch() call, only if
PDC_save_key_modifiers(TRUE) has been called before the getch().
Use the macros; PDC_KEY_MODIFIER_* to determine which
modifier(s) were set.
PDC_get_key_modifiers() returns the keyboard modifiers (shift,
control, alt, numlock) effective at the time of the last getch()
call, if PDC_save_key_modifiers(TRUE) has been called before the
getch(). Use the macros PDC_KEY_MODIFIER_* to determine which
modifier(s) were set. PDC_return_key_modifiers() tells getch()
to return modifier keys pressed alone as keystrokes (KEY_ALT_L,
etc.). These may not work on all platforms.
X/Open Return Value:
These functions return ERR or the value of the character, meta
@@ -388,6 +392,22 @@ unsigned long PDC_get_key_modifiers(void)
return pdc_key_modifiers;
}
int PDC_save_key_modifiers(bool flag)
{
PDC_LOG(("PDC_save_key_modifiers() - called\n"));
SP->save_key_modifiers = flag;
return OK;
}
int PDC_return_key_modifiers(bool flag)
{
PDC_LOG(("PDC_return_key_modifiers() - called\n"));
SP->return_key_modifiers = flag;
return PDC_modifiers_set();
}
#ifdef PDC_WIDE
int wget_wch(WINDOW *win, wint_t *wch)
{

View File

@@ -13,7 +13,7 @@
#include "pdcwin.h"
RCSID("$Id: pdckbd.c,v 1.79 2006/11/14 14:51:57 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.80 2006/11/15 16:26:45 wmcbrine Exp $");
#define ACTUAL_MOUSE_MOVED (actual_mouse_status.changes & 8)
#define ACTUAL_BUTTON_STATUS(x) (actual_mouse_status.button[(x) - 1])
@@ -999,3 +999,8 @@ int PDC_mouse_set(void)
return OK;
}
int PDC_modifiers_set(void)
{
return OK;
}

View File

@@ -13,7 +13,7 @@
#include "pdcx11.h"
RCSID("$Id: pdckbd.c,v 1.49 2006/11/13 17:50:08 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.50 2006/11/15 16:26:45 wmcbrine Exp $");
/*man-start**************************************************************
@@ -196,3 +196,8 @@ int PDC_mouse_set(void)
{
return OK;
}
int PDC_modifiers_set(void)
{
return OK;
}