Common handling for PDC_mouse_in_slk().

This commit is contained in:
William McBrine
2006-11-12 20:38:00 +00:00
parent cdfd9046bf
commit 47a9f29f45
3 changed files with 22 additions and 24 deletions

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.52 2006/11/12 16:18:09 wmcbrine Exp $");
RCSID("$Id: getch.c,v 1.53 2006/11/12 20:38:00 wmcbrine Exp $");
static int c_pindex = 0; /* putter index */
static int c_gindex = 1; /* getter index */
@@ -177,7 +177,25 @@ int wgetch(WINDOW *win)
key = -1;
}
/* Handle timeout() and halfdelay() */
/* translate mouse clicks in the slk area to function
keys */
if (key == KEY_MOUSE)
{
int fn = PDC_mouse_in_slk(pdc_mouse_status.y,
pdc_mouse_status.x);
if (fn)
{
if (pdc_mouse_status.button[0] &
BUTTON_PRESSED)
key = KEY_F(fn);
else
key = -1;
}
}
/* handle timeout() and halfdelay() */
if (key == -1)
{

View File

@@ -13,7 +13,7 @@
#include "pdcwin.h"
RCSID("$Id: pdckbd.c,v 1.74 2006/11/11 20:24:36 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.75 2006/11/12 20:38:00 wmcbrine Exp $");
#define ACTUAL_MOUSE_MOVED (actual_mouse_status.changes & 8)
#define ACTUAL_BUTTON_STATUS(x) (actual_mouse_status.button[(x) - 1])
@@ -647,8 +647,6 @@ int PDC_get_bios_key(void)
if (button_no != 0)
{
int key;
/* We have a button action, rather than a mouse movement
or wheel action */
@@ -657,15 +655,6 @@ int PDC_get_bios_key(void)
temp_mouse_status.y =
save_ip.Event.MouseEvent.dwMousePosition.Y;
/* First thing is to check if the mouse has been clicked
on a slk area. If the return value is > 0 (indicating
the label number), return with the KEY_F(key) value.
Only call this if we have set trap_mouse to TRUE above. */
if (trap_mouse && (key = PDC_mouse_in_slk(temp_mouse_status.y,
temp_mouse_status.x)) != 0)
return KEY_F(key);
temp_mouse_status.changes |= 1 << (button_no - 1);
#define STATUSSET(KEY, BTN) \

View File

@@ -13,7 +13,7 @@
#include "pdcx11.h"
RCSID("$Id: pdckbd.c,v 1.47 2006/11/11 20:24:36 wmcbrine Exp $");
RCSID("$Id: pdckbd.c,v 1.48 2006/11/12 20:38:00 wmcbrine Exp $");
/*man-start**************************************************************
@@ -80,15 +80,6 @@ int PDC_get_bios_key(void)
XCursesExitCursesProcess(2,
"exiting from PDC_get_bios_key");
/* Check if the mouse has been clicked on a slk area. If
the return value is > 0 (indicating the label number),
return with the KEY_F(key) value. */
if ((newkey = PDC_mouse_in_slk(pdc_mouse_status.y,
pdc_mouse_status.x)) &&
(pdc_mouse_status.button[0] & BUTTON_PRESSED))
key = KEY_F(newkey);
MOUSE_LOG(("rawgetch-x: %d y: %d Mouse status: %x\n",
MOUSE_X_POS, MOUSE_Y_POS, Mouse_status.changes));
MOUSE_LOG(("rawgetch-Button1: %x Button2: %x Button3: %x\n",