"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dos/pdckbd.c" between
PDCurses-3.8.tar.gz and PDCurses-3.9.tar.gz

About: PDCurses is a multiple platforms curses library implementing most of the functions available in X/Open and System V R4 curses.

pdckbd.c  (PDCurses-3.8):pdckbd.c  (PDCurses-3.9)
skipping to change at line 16 skipping to change at line 16
pdckbd pdckbd
------ ------
### Synopsis ### Synopsis
unsigned long PDC_get_input_fd(void); unsigned long PDC_get_input_fd(void);
### Description ### Description
PDC_get_input_fd() returns the file descriptor that PDCurses PDC_get_input_fd() returns the file descriptor that PDCurses reads
reads its input from. It can be used for select(). its input from. It can be used for select().
### Portability ### Portability
X/Open BSD SYS V X/Open ncurses NetBSD
PDC_get_input_fd - - - PDC_get_input_fd - - -
**man-end****************************************************************/ **man-end****************************************************************/
#ifdef __DJGPP__ #ifdef __DJGPP__
# include <fcntl.h> # include <fcntl.h>
# include <io.h> # include <io.h>
# include <signal.h> # include <signal.h>
#endif #endif
skipping to change at line 82 skipping to change at line 82
KEY_F(24), KEY_F(35), KEY_F(36), KEY_F(47), KEY_F(24), KEY_F(35), KEY_F(36), KEY_F(47),
KEY_F(48), CTL_UP, CTL_PADMINUS, CTL_PADCENTER, KEY_F(48), CTL_UP, CTL_PADMINUS, CTL_PADCENTER,
CTL_PADPLUS, CTL_DOWN, CTL_INS, CTL_DEL, CTL_PADPLUS, CTL_DOWN, CTL_INS, CTL_DEL,
CTL_TAB, CTL_PADSLASH, CTL_PADSTAR, ALT_HOME, CTL_TAB, CTL_PADSLASH, CTL_PADSTAR, ALT_HOME,
ALT_UP, ALT_PGUP, -1, ALT_LEFT, ALT_UP, ALT_PGUP, -1, ALT_LEFT,
-1, ALT_RIGHT, -1, ALT_END, -1, ALT_RIGHT, -1, ALT_END,
ALT_DOWN, ALT_PGDN, ALT_INS, ALT_DEL, ALT_DOWN, ALT_PGDN, ALT_INS, ALT_DEL,
ALT_PADSLASH, ALT_TAB, ALT_PADENTER, -1 ALT_PADSLASH, ALT_TAB, ALT_PADENTER, -1
}; };
unsigned long pdc_key_modifiers = 0L;
static struct {unsigned short pressed, released;} button[3]; static struct {unsigned short pressed, released;} button[3];
static bool mouse_avail = FALSE, mouse_vis = FALSE, mouse_moved = FALSE, static bool mouse_avail = FALSE, mouse_vis = FALSE, mouse_moved = FALSE,
mouse_button = FALSE, key_pressed = FALSE; mouse_button = FALSE, key_pressed = FALSE;
static unsigned char mouse_scroll = 0; static unsigned char mouse_scroll = 0;
static PDCREGS ms_regs, old_ms; static PDCREGS ms_regs, old_ms;
static unsigned short shift_status, old_shift = 0; static unsigned short shift_status, old_shift = 0;
static unsigned char keyboard_function = 0xff, shift_function = 0xff, static unsigned char keyboard_function = 0xff, shift_function = 0xff,
check_function = 0xff; check_function = 0xff;
skipping to change at line 220 skipping to change at line 218
PDCINT(0x16, regs); PDCINT(0x16, regs);
return !(regs.W.flags & 64); return !(regs.W.flags & 64);
} }
static int _process_mouse_events(void) static int _process_mouse_events(void)
{ {
int i; int i;
short shift_flags = 0; short shift_flags = 0;
memset(&pdc_mouse_status, 0, sizeof(pdc_mouse_status)); memset(&SP->mouse_status, 0, sizeof(SP->mouse_status));
key_pressed = TRUE; key_pressed = TRUE;
old_shift = shift_status; old_shift = shift_status;
SP->key_code = TRUE; SP->key_code = TRUE;
/* Set shift modifiers */ /* Set shift modifiers */
if (shift_status & 3) if (shift_status & 3)
shift_flags |= BUTTON_SHIFT; shift_flags |= BUTTON_SHIFT;
if (shift_status & 4) if (shift_status & 4)
shift_flags |= BUTTON_CONTROL; shift_flags |= BUTTON_CONTROL;
if (shift_status & 8) if (shift_status & 8)
shift_flags |= BUTTON_ALT; shift_flags |= BUTTON_ALT;
/* Scroll wheel support for CuteMouse */ /* Scroll wheel support for CuteMouse */
if (mouse_scroll) if (mouse_scroll)
{ {
pdc_mouse_status.changes = mouse_scroll & 0x80 ? SP->mouse_status.changes = mouse_scroll & 0x80 ?
PDC_MOUSE_WHEEL_UP : PDC_MOUSE_WHEEL_DOWN; PDC_MOUSE_WHEEL_UP : PDC_MOUSE_WHEEL_DOWN;
pdc_mouse_status.x = -1; SP->mouse_status.x = -1;
pdc_mouse_status.y = -1; SP->mouse_status.y = -1;
return KEY_MOUSE; return KEY_MOUSE;
} }
if (mouse_moved) if (mouse_moved)
{ {
pdc_mouse_status.changes = PDC_MOUSE_MOVED; SP->mouse_status.changes = PDC_MOUSE_MOVED;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
if (ms_regs.h.bl & (1 << button_map[i])) if (ms_regs.h.bl & (1 << button_map[i]))
{ {
pdc_mouse_status.button[i] = BUTTON_MOVED | shift_flags; SP->mouse_status.button[i] = BUTTON_MOVED | shift_flags;
pdc_mouse_status.changes |= (1 << i); SP->mouse_status.changes |= (1 << i);
} }
} }
} }
else /* button event */ else /* button event */
{ {
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
if (button[i].pressed) if (button[i].pressed)
{ {
/* Check for a click -- a PRESS followed /* Check for a click -- a PRESS followed
skipping to change at line 284 skipping to change at line 282
if (SP->mouse_wait) if (SP->mouse_wait)
{ {
PDCREGS regs; PDCREGS regs;
napms(SP->mouse_wait); napms(SP->mouse_wait);
regs.W.ax = 6; regs.W.ax = 6;
regs.W.bx = button_map[i]; regs.W.bx = button_map[i];
PDCINT(0x33, regs); PDCINT(0x33, regs);
pdc_mouse_status.button[i] = regs.W.bx ? SP->mouse_status.button[i] = regs.W.bx ?
BUTTON_CLICKED : BUTTON_PRESSED; BUTTON_CLICKED : BUTTON_PRESSED;
} }
else else
pdc_mouse_status.button[i] = BUTTON_PRESSED; SP->mouse_status.button[i] = BUTTON_PRESSED;
} }
else else
pdc_mouse_status.button[i] = BUTTON_CLICKED; SP->mouse_status.button[i] = BUTTON_CLICKED;
} }
if (button[i].pressed || button[i].released) if (button[i].pressed || button[i].released)
{ {
pdc_mouse_status.button[i] |= shift_flags; SP->mouse_status.button[i] |= shift_flags;
pdc_mouse_status.changes |= (1 << i); SP->mouse_status.changes |= (1 << i);
} }
} }
} }
pdc_mouse_status.x = ms_regs.W.cx >> 3; SP->mouse_status.x = ms_regs.W.cx >> 3;
pdc_mouse_status.y = ms_regs.W.dx >> 3; SP->mouse_status.y = ms_regs.W.dx >> 3;
old_ms = ms_regs; old_ms = ms_regs;
return KEY_MOUSE; return KEY_MOUSE;
} }
/* return the next available key or mouse event */ /* return the next available key or mouse event */
int PDC_get_key(void) int PDC_get_key(void)
{ {
PDCREGS regs; PDCREGS regs;
int key, scan; int key, scan;
pdc_key_modifiers = 0; SP->key_modifiers = 0;
if (mouse_vis && (mouse_scroll || mouse_button || mouse_moved)) if (mouse_vis && (mouse_scroll || mouse_button || mouse_moved))
return _process_mouse_events(); return _process_mouse_events();
/* Return modifiers as keys? */ /* Return modifiers as keys? */
if (old_shift && !shift_status) if (old_shift && !shift_status)
{ {
key = -1; key = -1;
skipping to change at line 369 skipping to change at line 367
SP->key_code = TRUE; SP->key_code = TRUE;
return key; return key;
} }
regs.h.ah = keyboard_function; regs.h.ah = keyboard_function;
PDCINT(0x16, regs); PDCINT(0x16, regs);
key = regs.h.al; key = regs.h.al;
scan = regs.h.ah; scan = regs.h.ah;
if (SP->save_key_modifiers) if (shift_status & 3)
{ SP->key_modifiers |= PDC_KEY_MODIFIER_SHIFT;
if (shift_status & 3)
pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT;
if (shift_status & 4) if (shift_status & 4)
pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL; SP->key_modifiers |= PDC_KEY_MODIFIER_CONTROL;
if (shift_status & 8) if (shift_status & 8)
pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT; SP->key_modifiers |= PDC_KEY_MODIFIER_ALT;
if (shift_status & 0x20) if (shift_status & 0x20)
pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK; SP->key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK;
}
if (scan == 0x1c && key == 0x0a) /* ^Enter */ if (scan == 0x1c && key == 0x0a) /* ^Enter */
key = CTL_ENTER; key = CTL_ENTER;
else if (scan == 0xe0 && key == 0x0d) /* PadEnter */ else if (scan == 0xe0 && key == 0x0d) /* PadEnter */
key = PADENTER; key = PADENTER;
else if (scan == 0xe0 && key == 0x0a) /* ^PadEnter */ else if (scan == 0xe0 && key == 0x0a) /* ^PadEnter */
key = CTL_PADENTER; key = CTL_PADENTER;
else if (scan == 0x37 && key == 0x2a) /* Star */ else if (scan == 0x37 && key == 0x2a) /* Star */
key = PADSTAR; key = PADSTAR;
else if (scan == 0x4a && key == 0x2d) /* Minus */ else if (scan == 0x4a && key == 0x2d) /* Minus */
skipping to change at line 456 skipping to change at line 451
void PDC_flushinp(void) void PDC_flushinp(void)
{ {
PDC_LOG(("PDC_flushinp() - called\n")); PDC_LOG(("PDC_flushinp() - called\n"));
/* Force the BIOS keyboard buffer head and tail pointers to be /* Force the BIOS keyboard buffer head and tail pointers to be
the same... Real nasty trick... */ the same... Real nasty trick... */
setdosmemword(0x41a, getdosmemword(0x41c)); setdosmemword(0x41a, getdosmemword(0x41c));
} }
int PDC_mouse_set(void) bool PDC_has_mouse(void)
{ {
PDCREGS regs; PDCREGS regs;
unsigned long mbe = SP->_trap_mbe;
if (mbe && !mouse_avail) if (!mouse_avail)
{ {
regs.W.ax = 0; regs.W.ax = 0;
PDCINT(0x33, regs); PDCINT(0x33, regs);
mouse_avail = !!(regs.W.ax); mouse_avail = !!(regs.W.ax);
} }
return mouse_avail;
}
int PDC_mouse_set(void)
{
PDCREGS regs;
unsigned long mbe = SP->_trap_mbe;
if (mbe && !mouse_avail)
mouse_avail = PDC_has_mouse();
if (mbe) if (mbe)
{ {
if (mouse_avail && !mouse_vis) if (mouse_avail && !mouse_vis)
{ {
memset(&old_ms, 0, sizeof(old_ms)); memset(&old_ms, 0, sizeof(old_ms));
regs.W.ax = 1; regs.W.ax = 1;
PDCINT(0x33, regs); PDCINT(0x33, regs);
mouse_vis = TRUE; mouse_vis = TRUE;
 End of changes. 22 change blocks. 
34 lines changed or deleted 39 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)