summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9edffa2)
+ modify wgetch() to use the screen which corresponds to its window
parameter rather than relying on SP; some dependent functions still
use SP internally.
+ factor out most use of SP in lib_mouse.c, using parameter.
+ add internal _nc_keyname(), replacing keyname() to associate with a
particular SCREEN rather than the global SP.
+ add internal _nc_unctrl(), replacing unctrl() to associate with a
particular SCREEN rather than the global SP.
+ add internal _nc_tracemouse(), replacing _tracemouse() to eliminate
its associated global buffer _nc_globals.tracemse_buf now in SCREEN.
+ add internal _nc_tracechar(), replacing _tracechar() to use SCREEN in
preference to the global _nc_globals.tracechr_buf buffer.
18 files changed:
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1237 2008/05/24 22:23:07 tom Exp $
+-- $Id: NEWS,v 1.1241 2008/05/31 21:52:48 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20080531
+ + modify wgetch() to use the screen which corresponds to its window
+ parameter rather than relying on SP; some dependent functions still
+ use SP internally.
+ + factor out most use of SP in lib_mouse.c, using parameter.
+ + add internal _nc_keyname(), replacing keyname() to associate with a
+ particular SCREEN rather than the global SP.
+ + add internal _nc_unctrl(), replacing unctrl() to associate with a
+ particular SCREEN rather than the global SP.
+ + add internal _nc_tracemouse(), replacing _tracemouse() to eliminate
+ its associated global buffer _nc_globals.tracemse_buf now in SCREEN.
+ + add internal _nc_tracechar(), replacing _tracechar() to use SCREEN in
+ preference to the global _nc_globals.tracechr_buf buffer.
+
20080524
+ modify _nc_keypad() to make it switch temporarily as needed to the
screen which must be updated.
20080524
+ modify _nc_keypad() to make it switch temporarily as needed to the
screen which must be updated.
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.643 2008/05/24 12:05:32 tom Exp $
+# $Id: dist.mk,v 1.644 2008/05/31 14:47:34 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 6
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 6
-NCURSES_PATCH = 20080524
+NCURSES_PATCH = 20080531
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
-# $Id: MKkeyname.awk,v 1.38 2007/08/18 18:41:18 tom Exp $
+# $Id: MKkeyname.awk,v 1.39 2008/05/31 19:54:58 tom Exp $
##############################################################################
##############################################################################
-# Copyright (c) 1999-2006,2007 Free Software Foundation, Inc. #
+# Copyright (c) 1999-2007,2008 Free Software Foundation, Inc. #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
# #
# Permission is hereby granted, free of charge, to any person obtaining a #
# copy of this software and associated documentation files (the "Software"), #
print "#define SIZEOF_TABLE 256"
print "#define MyTable _nc_globals.keyname_table"
print ""
print "#define SIZEOF_TABLE 256"
print "#define MyTable _nc_globals.keyname_table"
print ""
- print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)"
+ print "NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *sp, int c)"
print "{"
print " int i;"
print " char name[20];"
print "{"
print " int i;"
print " char name[20];"
print " if (MyTable[c] == 0) {"
print " int cc = c;"
print " p = name;"
print " if (MyTable[c] == 0) {"
print " int cc = c;"
print " p = name;"
- print " if (cc >= 128 && (SP == 0 || SP->_use_meta)) {"
+ print " if (cc >= 128 && (sp == 0 || sp->_use_meta)) {"
print " strcpy(p, \"M-\");"
print " p += 2;"
print " cc -= 128;"
print " strcpy(p, \"M-\");"
print " p += 2;"
print " cc -= 128;"
print " return result;"
print "}"
print ""
print " return result;"
print "}"
print ""
+ print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)"
+ print "{"
+ print "\treturn _nc_keyname(SP, c);"
+ print "}"
+ print ""
print "#if NO_LEAKS"
print "void _nc_keyname_leaks(void)"
print "{"
print "#if NO_LEAKS"
print "void _nc_keyname_leaks(void)"
print "{"
-# $Id: MKunctrl.awk,v 1.21 2008/02/03 20:24:30 tom Exp $
+# $Id: MKunctrl.awk,v 1.22 2008/05/31 19:36:11 tom Exp $
##############################################################################
# Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. #
# #
##############################################################################
# Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. #
# #
- print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (register chtype ch)"
+ print "NCURSES_EXPORT(NCURSES_CONST char *) _nc_unctrl (SCREEN *sp, chtype ch)"
print ""
print "\tif (check >= 0 && check < (int)SIZEOF(unctrl_table)) {"
print "#if NCURSES_EXT_FUNCS"
print ""
print "\tif (check >= 0 && check < (int)SIZEOF(unctrl_table)) {"
print "#if NCURSES_EXT_FUNCS"
- print "\t\tif ((SP != 0)"
- print "\t\t && (SP->_legacy_coding > 1)"
+ print "\t\tif ((sp != 0)"
+ print "\t\t && (sp->_legacy_coding > 1)"
print "\t\t && (check >= 128)"
print "\t\t && (check < 160))"
printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
print "\t\t && (check >= 128)"
print "\t\t && (check < 160))"
printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
print "#if USE_WIDEC_SUPPORT"
print "\t\tif ((check >= 160)"
print "\t\t && (check < 256)"
print "#if USE_WIDEC_SUPPORT"
print "\t\tif ((check >= 160)"
print "\t\t && (check < 256)"
- print "\t\t && ((SP != 0)"
- print "\t\t && ((SP->_legacy_coding > 0)"
- print "\t\t || (SP->_legacy_coding == 0"
+ print "\t\t && ((sp != 0)"
+ print "\t\t && ((sp->_legacy_coding > 0)"
+ print "\t\t || (sp->_legacy_coding == 0"
print "\t\t && (isprint(check) || iswprint(check))))))"
printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
print "\t\telse"
print "#else"
print "\t\tif ((check >= 160)"
print "\t\t && (check < 256)"
print "\t\t && (isprint(check) || iswprint(check))))))"
printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
print "\t\telse"
print "#else"
print "\t\tif ((check >= 160)"
print "\t\t && (check < 256)"
- print "\t\t && ((SP != 0)"
- print "\t\t && ((SP->_legacy_coding > 0)"
- print "\t\t || (SP->_legacy_coding == 0"
+ print "\t\t && ((sp != 0)"
+ print "\t\t && ((sp->_legacy_coding > 0)"
+ print "\t\t || (sp->_legacy_coding == 0"
print "\t\t && isprint(check)))))"
printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
print "\t\telse"
print "\t\t && isprint(check)))))"
printf "\t\t\tresult = %s_c1[check - 128];\n", stringname;
print "\t\telse"
print "\t}"
print "\treturn (NCURSES_CONST char *)result;"
print "}"
print "\t}"
print "\treturn (NCURSES_CONST char *)result;"
print "}"
+ print ""
+ print "NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype ch)"
+ print "{"
+ print "\treturn _nc_unctrl(SP, ch);"
+ print "}"
-MODULE_ID("$Id: lib_getch.c,v 1.87 2008/05/03 22:42:10 tom Exp $")
+MODULE_ID("$Id: lib_getch.c,v 1.91 2008/05/31 21:47:48 tom Exp $")
{
int ch;
ch = sp->_fifo[head];
{
int ch;
ch = sp->_fifo[head];
- TR(TRACE_IEVENT, ("pulling %s from %d", _tracechar(ch), head));
+ TR(TRACE_IEVENT, ("pulling %s from %d", _nc_tracechar(sp, ch), head));
if (peek == head) {
h_inc();
if (peek == head) {
h_inc();
if (head == -1)
head = peek = tail;
t_inc();
if (head == -1)
head = peek = tail;
t_inc();
- TR(TRACE_IEVENT, ("pushed %s at %d", _tracechar(ch), tail));
+ TR(TRACE_IEVENT, ("pushed %s at %d", _nc_tracechar(sp, ch), tail));
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump(sp);
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump(sp);
static int kgetch(SCREEN *EVENTLIST_2nd(_nc_eventlist * evl));
static int kgetch(SCREEN *EVENTLIST_2nd(_nc_eventlist * evl));
-#define wgetch_should_refresh(win) (\
- (is_wintouched(win) || (win->_flags & _HASMOVED)) \
- && !(win->_flags & _ISPAD))
+static void
+refresh_if_needed(WINDOW *win)
+{
+ if ((is_wintouched(win) || (win->_flags & _HASMOVED))
+ && !(win->_flags & _ISPAD)) {
+ wrefresh(win);
+ }
+}
NCURSES_EXPORT(int)
_nc_wgetch(WINDOW *win,
NCURSES_EXPORT(int)
_nc_wgetch(WINDOW *win,
int use_meta
EVENTLIST_2nd(_nc_eventlist * evl))
{
int use_meta
EVENTLIST_2nd(_nc_eventlist * evl))
{
+ SCREEN *sp = _nc_screen_of(win);
int ch;
#ifdef NCURSES_WGETCH_EVENTS
long event_delay = -1;
int ch;
#ifdef NCURSES_WGETCH_EVENTS
long event_delay = -1;
}
if (cooked_key_in_fifo()) {
}
if (cooked_key_in_fifo()) {
- if (wgetch_should_refresh(win))
- wrefresh(win);
-
+ refresh_if_needed(win);
*result = fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
*result = fifo_pull(sp);
returnCode(*result >= KEY_MIN ? KEY_CODE_YES : OK);
}
if (win->_use_keypad != sp->_keypad_on)
_nc_keypad(sp, win->_use_keypad);
if (win->_use_keypad != sp->_keypad_on)
_nc_keypad(sp, win->_use_keypad);
- if (wgetch_should_refresh(win))
- wrefresh(win);
+ refresh_if_needed(win);
if (!win->_notimeout && (win->_delay >= 0 || sp->_cbreak > 1)) {
if (head == -1) { /* fifo is empty */
if (!win->_notimeout && (win->_delay >= 0 || sp->_cbreak > 1)) {
if (head == -1) { /* fifo is empty */
&& (((rc = check_mouse_activity(sp, sp->_maxclick
EVENTLIST_2nd(evl))) != 0
&& !(rc & 4))
&& (((rc = check_mouse_activity(sp, sp->_maxclick
EVENTLIST_2nd(evl))) != 0
&& !(rc & 4))
- || !sp->_mouse_parse(runcount)));
+ || !sp->_mouse_parse(sp, runcount)));
#ifdef NCURSES_WGETCH_EVENTS
if ((rc & 4) && !ch == KEY_EVENT) {
_nc_ungetch(sp, ch);
#ifdef NCURSES_WGETCH_EVENTS
if ((rc & 4) && !ch == KEY_EVENT) {
_nc_ungetch(sp, ch);
if ((ch < KEY_MIN) && (ch & 0x80))
ch &= 0x7f;
if ((ch < KEY_MIN) && (ch & 0x80))
ch &= 0x7f;
- T(("wgetch returning : %s", _tracechar(ch)));
+ T(("wgetch returning : %s", _nc_tracechar(sp, ch)));
*result = ch;
returnCode(ch >= KEY_MIN ? KEY_CODE_YES : OK);
*result = ch;
returnCode(ch >= KEY_MIN ? KEY_CODE_YES : OK);
NCURSES_EXPORT(int)
wgetch_events(WINDOW *win, _nc_eventlist * evl)
{
NCURSES_EXPORT(int)
wgetch_events(WINDOW *win, _nc_eventlist * evl)
{
+ SCREEN *sp = _nc_screen_of(win);
int code;
unsigned long value;
int code;
unsigned long value;
NCURSES_EXPORT(int)
wgetch(WINDOW *win)
{
NCURSES_EXPORT(int)
wgetch(WINDOW *win)
{
+ SCREEN *sp = _nc_screen_of(win);
int code;
unsigned long value;
int code;
unsigned long value;
- TR(TRACE_IEVENT, ("ch: %s", _tracechar((unsigned char) ch)));
+ TR(TRACE_IEVENT, ("ch: %s", _nc_tracechar(sp, (unsigned char) ch)));
while ((ptr != NULL) && (ptr->ch != (unsigned char) ch))
ptr = ptr->sibling;
while ((ptr != NULL) && (ptr->ch != (unsigned char) ch))
ptr = ptr->sibling;
/****************************************************************************
/****************************************************************************
- * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2006,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <curses.priv.h>
#include <term.h>
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: lib_getstr.c,v 1.25 2006/01/12 00:33:52 tom Exp $")
+MODULE_ID("$Id: lib_getstr.c,v 1.26 2008/05/31 22:05:15 tom Exp $")
/*
* This wipes out the last character, no matter whether it was a tab, control
/*
* This wipes out the last character, no matter whether it was a tab, control
int maxlen,
EVENTLIST_1st(_nc_eventlist * evl))
{
int maxlen,
EVENTLIST_1st(_nc_eventlist * evl))
{
+ SCREEN *sp = _nc_screen_of(win);
TTY buf;
bool oldnl, oldecho, oldraw, oldcbreak;
char erasec;
TTY buf;
bool oldnl, oldecho, oldraw, oldcbreak;
char erasec;
- oldnl = SP->_nl;
- oldecho = SP->_echo;
- oldraw = SP->_raw;
- oldcbreak = SP->_cbreak;
+ oldnl = sp->_nl;
+ oldecho = sp->_echo;
+ oldraw = sp->_raw;
+ oldcbreak = sp->_cbreak;
/* Restore with a single I/O call, to fix minor asymmetry between
* raw/noraw, etc.
*/
/* Restore with a single I/O call, to fix minor asymmetry between
* raw/noraw, etc.
*/
- SP->_nl = oldnl;
- SP->_echo = oldecho;
- SP->_raw = oldraw;
- SP->_cbreak = oldcbreak;
+ sp->_nl = oldnl;
+ sp->_echo = oldecho;
+ sp->_raw = oldraw;
+ sp->_cbreak = oldcbreak;
/****************************************************************************
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
-MODULE_ID("$Id: lib_mouse.c,v 1.88 2007/09/29 21:50:04 tom Exp $")
+MODULE_ID("$Id: lib_mouse.c,v 1.94 2008/05/31 20:30:10 tom Exp $")
#include <term.h>
#include <tic.h>
#include <term.h>
#include <tic.h>
#endif /* USE_GPM_SUPPORT */
#endif /* USE_GPM_SUPPORT */
-static bool _nc_mouse_parse(int);
+static bool _nc_mouse_parse(SCREEN *, int);
static void _nc_mouse_resume(SCREEN *);
static void _nc_mouse_wrap(SCREEN *);
/* maintain a circular list of mouse events */
#undef NEXT
static void _nc_mouse_resume(SCREEN *);
static void _nc_mouse_wrap(SCREEN *);
/* maintain a circular list of mouse events */
#undef NEXT
-#define NEXT(ep) ((ep == SP->_mouse_events + EV_MAX - 1) \
- ? SP->_mouse_events \
+#define NEXT(ep) ((ep == sp->_mouse_events + EV_MAX - 1) \
+ ? sp->_mouse_events \
-#define PREV(ep) ((ep == SP->_mouse_events) \
- ? SP->_mouse_events + EV_MAX - 1 \
+#define PREV(ep) ((ep == sp->_mouse_events) \
+ ? sp->_mouse_events + EV_MAX - 1 \
: ep - 1)
#ifdef TRACE
static void
: ep - 1)
#ifdef TRACE
static void
-_trace_slot(const char *tag)
+_trace_slot(SCREEN *sp, const char *tag)
{
MEVENT *ep;
_tracef(tag);
{
MEVENT *ep;
_tracef(tag);
- for (ep = SP->_mouse_events; ep < SP->_mouse_events + EV_MAX; ep++)
+ for (ep = sp->_mouse_events; ep < sp->_mouse_events + EV_MAX; ep++)
_tracef("mouse event queue slot %ld = %s",
_tracef("mouse event queue slot %ld = %s",
- (long) (ep - SP->_mouse_events),
- _tracemouse(ep));
+ (long) (ep - sp->_mouse_events),
+ _nc_tracemouse(sp, ep));
# define M_FD(sp) sp->_mouse_fd
static void
# define M_FD(sp) sp->_mouse_fd
static void
-write_event(int down, int button, int x, int y)
+write_event(SCREEN *sp, int down, int button, int x, int y)
{
char buf[6];
unsigned long ignore;
{
char buf[6];
unsigned long ignore;
buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40);
buf[4] = ' ' + x - LEFT_COL + 1;
buf[5] = ' ' + y - TOP_ROW + 1;
buf[3] = ' ' + (button - 1) + (down ? 0 : 0x40);
buf[4] = ' ' + x - LEFT_COL + 1;
buf[5] = ' ' + y - TOP_ROW + 1;
- DosWrite(SP->_emxmouse_wfd, buf, 6, &ignore);
+ DosWrite(sp->_emxmouse_wfd, buf, 6, &ignore);
-mouse_server(unsigned long ignored GCC_UNUSED)
+mouse_server(unsigned long param)
+ SCREEN *sp = (SCREEN *) param;
unsigned short fWait = MOU_WAIT;
/* NOPTRRECT mourt = { 0,0,24,79 }; */
MOUEVENTINFO mouev;
unsigned short fWait = MOU_WAIT;
/* NOPTRRECT mourt = { 0,0,24,79 }; */
MOUEVENTINFO mouev;
sprintf(err, "Error reading mouse queue, rc=%lu.\r\n", rc);
break;
}
sprintf(err, "Error reading mouse queue, rc=%lu.\r\n", rc);
break;
}
- if (!SP->_emxmouse_activated)
+ if (!sp->_emxmouse_activated)
*/
if ((mouev.fs ^ oldstate) & MOUSE_BN1_DOWN)
write_event(mouev.fs & MOUSE_BN1_DOWN,
*/
if ((mouev.fs ^ oldstate) & MOUSE_BN1_DOWN)
write_event(mouev.fs & MOUSE_BN1_DOWN,
- SP->_emxmouse_buttons[1], mouev.col, mouev.row);
+ sp->_emxmouse_buttons[1], mouev.col, mouev.row);
if ((mouev.fs ^ oldstate) & MOUSE_BN2_DOWN)
write_event(mouev.fs & MOUSE_BN2_DOWN,
if ((mouev.fs ^ oldstate) & MOUSE_BN2_DOWN)
write_event(mouev.fs & MOUSE_BN2_DOWN,
- SP->_emxmouse_buttons[3], mouev.col, mouev.row);
+ sp->_emxmouse_buttons[3], mouev.col, mouev.row);
if ((mouev.fs ^ oldstate) & MOUSE_BN3_DOWN)
write_event(mouev.fs & MOUSE_BN3_DOWN,
if ((mouev.fs ^ oldstate) & MOUSE_BN3_DOWN)
write_event(mouev.fs & MOUSE_BN3_DOWN,
- SP->_emxmouse_buttons[2], mouev.col, mouev.row);
+ sp->_emxmouse_buttons[2], mouev.col, mouev.row);
finish:
oldstate = mouev.fs;
finish:
oldstate = mouev.fs;
#if USE_SYSMOUSE
static void
#if USE_SYSMOUSE
static void
-handle_sysmouse(int sig GCC_UNUSED)
+sysmouse_server(SCREEN *sp)
{
struct mouse_info the_mouse;
MEVENT *work;
the_mouse.operation = MOUSE_GETINFO;
{
struct mouse_info the_mouse;
MEVENT *work;
the_mouse.operation = MOUSE_GETINFO;
- if (SP != 0
- && SP->_mouse_fd >= 0
- && SP->_sysmouse_tail < FIFO_SIZE
- && ioctl(SP->_mouse_fd, CONS_MOUSECTL, &the_mouse) != -1) {
-
- if (SP->_sysmouse_head > SP->_sysmouse_tail) {
- SP->_sysmouse_tail = 0;
- SP->_sysmouse_head = 0;
+ if (sp != 0
+ && sp->_mouse_fd >= 0
+ && sp->_sysmouse_tail < FIFO_SIZE
+ && ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse) != -1) {
+
+ if (sp->_sysmouse_head > sp->_sysmouse_tail) {
+ sp->_sysmouse_tail = 0;
+ sp->_sysmouse_head = 0;
- work = &(SP->_sysmouse_fifo[SP->_sysmouse_tail]);
+ work = &(sp->_sysmouse_fifo[sp->_sysmouse_tail]);
memset(work, 0, sizeof(*work));
work->id = NORMAL_EVENT; /* there's only one mouse... */
memset(work, 0, sizeof(*work));
work->id = NORMAL_EVENT; /* there's only one mouse... */
- SP->_sysmouse_old_buttons = SP->_sysmouse_new_buttons;
- SP->_sysmouse_new_buttons = the_mouse.u.data.buttons & 0x7;
+ sp->_sysmouse_old_buttons = sp->_sysmouse_new_buttons;
+ sp->_sysmouse_new_buttons = the_mouse.u.data.buttons & 0x7;
- if (SP->_sysmouse_new_buttons) {
- if (SP->_sysmouse_new_buttons & 1)
+ if (sp->_sysmouse_new_buttons) {
+ if (sp->_sysmouse_new_buttons & 1)
work->bstate |= BUTTON1_PRESSED;
work->bstate |= BUTTON1_PRESSED;
- if (SP->_sysmouse_new_buttons & 2)
+ if (sp->_sysmouse_new_buttons & 2)
work->bstate |= BUTTON2_PRESSED;
work->bstate |= BUTTON2_PRESSED;
- if (SP->_sysmouse_new_buttons & 4)
+ if (sp->_sysmouse_new_buttons & 4)
work->bstate |= BUTTON3_PRESSED;
} else {
work->bstate |= BUTTON3_PRESSED;
} else {
- if (SP->_sysmouse_old_buttons & 1)
+ if (sp->_sysmouse_old_buttons & 1)
work->bstate |= BUTTON1_RELEASED;
work->bstate |= BUTTON1_RELEASED;
- if (SP->_sysmouse_old_buttons & 2)
+ if (sp->_sysmouse_old_buttons & 2)
work->bstate |= BUTTON2_RELEASED;
work->bstate |= BUTTON2_RELEASED;
- if (SP->_sysmouse_old_buttons & 4)
+ if (sp->_sysmouse_old_buttons & 4)
work->bstate |= BUTTON3_RELEASED;
}
/* for cosmetic bug in syscons.c on FreeBSD 3.[34] */
the_mouse.operation = MOUSE_HIDE;
work->bstate |= BUTTON3_RELEASED;
}
/* for cosmetic bug in syscons.c on FreeBSD 3.[34] */
the_mouse.operation = MOUSE_HIDE;
- ioctl(SP->_mouse_fd, CONS_MOUSECTL, &the_mouse);
+ ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse);
the_mouse.operation = MOUSE_SHOW;
the_mouse.operation = MOUSE_SHOW;
- ioctl(SP->_mouse_fd, CONS_MOUSECTL, &the_mouse);
+ ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse);
/*
* We're only interested if the button is pressed or released.
* FIXME: implement continuous event-tracking.
*/
/*
* We're only interested if the button is pressed or released.
* FIXME: implement continuous event-tracking.
*/
- if (SP->_sysmouse_new_buttons != SP->_sysmouse_old_buttons) {
- SP->_sysmouse_tail += 1;
+ if (sp->_sysmouse_new_buttons != sp->_sysmouse_old_buttons) {
+ sp->_sysmouse_tail += 1;
- work->x = the_mouse.u.data.x / SP->_sysmouse_char_width;
- work->y = the_mouse.u.data.y / SP->_sysmouse_char_height;
+ work->x = the_mouse.u.data.x / sp->_sysmouse_char_width;
+ work->y = the_mouse.u.data.y / sp->_sysmouse_char_height;
+
+static void
+handle_sysmouse(int sig GCC_UNUSED)
+{
+ sysmouse_server(SP);
+}
#endif /* USE_SYSMOUSE */
static void
#endif /* USE_SYSMOUSE */
static void
+init_xterm_mouse(SCREEN *sp)
- SP->_mouse_type = M_XTERM;
- SP->_mouse_xtermcap = tigetstr("XM");
- if (!VALID_STRING(SP->_mouse_xtermcap))
- SP->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;";
+ sp->_mouse_type = M_XTERM;
+ sp->_mouse_xtermcap = tigetstr("XM");
+ if (!VALID_STRING(sp->_mouse_xtermcap))
+ sp->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;";
-enable_xterm_mouse(int enable)
+enable_xterm_mouse(SCREEN *sp, int enable)
- SP->_emxmouse_activated = enable;
+ sp->_emxmouse_activated = enable;
- putp(TPARM_1(SP->_mouse_xtermcap, enable));
+ putp(TPARM_1(sp->_mouse_xtermcap, enable));
- SP->_mouse_active = enable;
+ sp->_mouse_active = enable;
-enable_gpm_mouse(int enable)
+enable_gpm_mouse(SCREEN *sp, int enable)
{
bool result;
T((T_CALLED("enable_gpm_mouse(%d)"), enable));
{
bool result;
T((T_CALLED("enable_gpm_mouse(%d)"), enable));
- if (enable && !SP->_mouse_active) {
+ if (enable && !sp->_mouse_active) {
/* GPM: initialize connection to gpm server */
/* GPM: initialize connection to gpm server */
- SP->_mouse_gpm_connect.eventMask = GPM_DOWN | GPM_UP;
- SP->_mouse_gpm_connect.defaultMask =
- ~(SP->_mouse_gpm_connect.eventMask | GPM_HARD);
- SP->_mouse_gpm_connect.minMod = 0;
- SP->_mouse_gpm_connect.maxMod =
+ sp->_mouse_gpm_connect.eventMask = GPM_DOWN | GPM_UP;
+ sp->_mouse_gpm_connect.defaultMask =
+ ~(sp->_mouse_gpm_connect.eventMask | GPM_HARD);
+ sp->_mouse_gpm_connect.minMod = 0;
+ sp->_mouse_gpm_connect.maxMod =
(unsigned short) (~((1 << KG_SHIFT) |
(1 << KG_SHIFTL) |
(1 << KG_SHIFTR)));
(unsigned short) (~((1 << KG_SHIFT) |
(1 << KG_SHIFTL) |
(1 << KG_SHIFTR)));
* The former is recognized by wscons (SunOS), and the latter by
* xterm. Those will not show up in ncurses' traces.
*/
* The former is recognized by wscons (SunOS), and the latter by
* xterm. Those will not show up in ncurses' traces.
*/
- result = (my_Gpm_Open(&SP->_mouse_gpm_connect, 0) >= 0);
- SP->_mouse_active = result;
+ result = (my_Gpm_Open(&sp->_mouse_gpm_connect, 0) >= 0);
+ sp->_mouse_active = result;
T(("GPM open %s", result ? "succeeded" : "failed"));
} else {
T(("GPM open %s", result ? "succeeded" : "failed"));
} else {
- if (!enable && SP->_mouse_active) {
+ if (!enable && sp->_mouse_active) {
/* GPM: close connection to gpm server */
my_Gpm_Close();
/* GPM: close connection to gpm server */
my_Gpm_Close();
- SP->_mouse_active = FALSE;
+ sp->_mouse_active = FALSE;
T(("GPM closed"));
}
result = FALSE;
T(("GPM closed"));
}
result = FALSE;
#define xterm_kmous "\033[M"
static void
#define xterm_kmous "\033[M"
static void
-initialize_mousetype(void)
+initialize_mousetype(SCREEN *sp)
{
T((T_CALLED("initialize_mousetype()")));
/* Try gpm first, because gpm may be configured to run in xterm */
#if USE_GPM_SUPPORT
if (allow_gpm_mouse()) {
{
T((T_CALLED("initialize_mousetype()")));
/* Try gpm first, because gpm may be configured to run in xterm */
#if USE_GPM_SUPPORT
if (allow_gpm_mouse()) {
- if (!SP->_mouse_gpm_loaded) {
+ if (!sp->_mouse_gpm_loaded) {
#ifdef HAVE_LIBDL
void *obj;
#ifdef HAVE_LIBDL
void *obj;
T(("GPM initialization failed: %s", dlerror()));
dlclose(obj);
} else {
T(("GPM initialization failed: %s", dlerror()));
dlclose(obj);
} else {
- SP->_mouse_gpm_found = TRUE;
+ sp->_mouse_gpm_found = TRUE;
}
}
#else /* !HAVE_LIBDL */
}
}
#else /* !HAVE_LIBDL */
- SP->_mouse_gpm_found = TRUE;
+ sp->_mouse_gpm_found = TRUE;
- SP->_mouse_gpm_loaded = TRUE;
+ sp->_mouse_gpm_loaded = TRUE;
* maintain our notion of whether the mouse connection is active
* without testing the file-descriptor.
*/
* maintain our notion of whether the mouse connection is active
* without testing the file-descriptor.
*/
- if (SP->_mouse_gpm_found && enable_gpm_mouse(TRUE)) {
- SP->_mouse_type = M_GPM;
- SP->_mouse_fd = *(my_gpm_fd);
- T(("GPM mouse_fd %d", SP->_mouse_fd));
+ if (sp->_mouse_gpm_found && enable_gpm_mouse(sp, TRUE)) {
+ sp->_mouse_type = M_GPM;
+ sp->_mouse_fd = *(my_gpm_fd);
+ T(("GPM mouse_fd %d", sp->_mouse_fd));
/* OS/2 VIO */
#if USE_EMX_MOUSE
/* OS/2 VIO */
#if USE_EMX_MOUSE
- if (!SP->_emxmouse_thread
+ if (!sp->_emxmouse_thread
&& strstr(cur_term->type.term_names, "xterm") == 0
&& key_mouse) {
int handles[2];
&& strstr(cur_term->type.term_names, "xterm") == 0
&& key_mouse) {
int handles[2];
- if (!SP->_emxmouse_buttons[0]) {
+ if (!sp->_emxmouse_buttons[0]) {
char *s = getenv("MOUSE_BUTTONS_123");
char *s = getenv("MOUSE_BUTTONS_123");
- SP->_emxmouse_buttons[0] = 1;
+ sp->_emxmouse_buttons[0] = 1;
if (s && strlen(s) >= 3) {
if (s && strlen(s) >= 3) {
- SP->_emxmouse_buttons[1] = s[0] - '0';
- SP->_emxmouse_buttons[2] = s[1] - '0';
- SP->_emxmouse_buttons[3] = s[2] - '0';
+ sp->_emxmouse_buttons[1] = s[0] - '0';
+ sp->_emxmouse_buttons[2] = s[1] - '0';
+ sp->_emxmouse_buttons[3] = s[2] - '0';
- SP->_emxmouse_buttons[1] = 1;
- SP->_emxmouse_buttons[2] = 3;
- SP->_emxmouse_buttons[3] = 2;
+ sp->_emxmouse_buttons[1] = 1;
+ sp->_emxmouse_buttons[2] = 3;
+ sp->_emxmouse_buttons[3] = 2;
- SP->_emxmouse_wfd = handles[1];
- M_FD(SP) = handles[0];
+ sp->_emxmouse_wfd = handles[1];
+ M_FD(sp) = handles[0];
/* Needed? */
setmode(handles[0], O_BINARY);
setmode(handles[1], O_BINARY);
/* Do not use CRT functions, we may single-threaded. */
/* Needed? */
setmode(handles[0], O_BINARY);
setmode(handles[1], O_BINARY);
/* Do not use CRT functions, we may single-threaded. */
- rc = DosCreateThread((unsigned long *) &SP->_emxmouse_thread,
- mouse_server, 0, 0, 8192);
+ rc = DosCreateThread((unsigned long *) &sp->_emxmouse_thread,
+ mouse_server, sp, 0, 8192);
if (rc) {
printf("mouse thread error %d=%#x", rc, rc);
} else {
if (rc) {
printf("mouse thread error %d=%#x", rc, rc);
} else {
- SP->_mouse_type = M_XTERM;
+ sp->_mouse_type = M_XTERM;
struct mouse_info the_mouse;
char *the_device = 0;
struct mouse_info the_mouse;
char *the_device = 0;
- if (isatty(SP->_ifd))
- the_device = ttyname(SP->_ifd);
+ if (isatty(sp->_ifd))
+ the_device = ttyname(sp->_ifd);
if (the_device == 0)
the_device = "/dev/tty";
if (the_device == 0)
the_device = "/dev/tty";
- SP->_mouse_fd = open(the_device, O_RDWR);
+ sp->_mouse_fd = open(the_device, O_RDWR);
- if (SP->_mouse_fd >= 0) {
+ if (sp->_mouse_fd >= 0) {
/*
* sysmouse does not have a usable user interface for obtaining
* mouse events. The logical way to proceed (reading data on a
/*
* sysmouse does not have a usable user interface for obtaining
* mouse events. The logical way to proceed (reading data on a
the_mouse.operation = MOUSE_MODE;
the_mouse.u.mode.mode = 0;
the_mouse.u.mode.signal = SIGUSR2;
the_mouse.operation = MOUSE_MODE;
the_mouse.u.mode.mode = 0;
the_mouse.u.mode.signal = SIGUSR2;
- if (ioctl(SP->_mouse_fd, CONS_MOUSECTL, &the_mouse) != -1) {
+ if (ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse) != -1) {
signal(SIGUSR2, handle_sysmouse);
the_mouse.operation = MOUSE_SHOW;
signal(SIGUSR2, handle_sysmouse);
the_mouse.operation = MOUSE_SHOW;
- ioctl(SP->_mouse_fd, CONS_MOUSECTL, &the_mouse);
+ ioctl(sp->_mouse_fd, CONS_MOUSECTL, &the_mouse);
#if defined(FBIO_MODEINFO) || defined(CONS_MODEINFO) /* FreeBSD > 2.x */
{
#if defined(FBIO_MODEINFO) || defined(CONS_MODEINFO) /* FreeBSD > 2.x */
{
#endif /* FBIO_GETMODE */
video_info_t the_video;
#endif /* FBIO_GETMODE */
video_info_t the_video;
- if (ioctl(SP->_mouse_fd,
+ if (ioctl(sp->_mouse_fd,
FBIO_GETMODE,
&the_video.vi_mode) != -1
FBIO_GETMODE,
&the_video.vi_mode) != -1
- && ioctl(SP->_mouse_fd,
+ && ioctl(sp->_mouse_fd,
FBIO_MODEINFO,
&the_video) != -1) {
FBIO_MODEINFO,
&the_video) != -1) {
- SP->_sysmouse_char_width = the_video.vi_cwidth;
- SP->_sysmouse_char_height = the_video.vi_cheight;
+ sp->_sysmouse_char_width = the_video.vi_cwidth;
+ sp->_sysmouse_char_height = the_video.vi_cheight;
}
}
#endif /* defined(FBIO_MODEINFO) || defined(CONS_MODEINFO) */
}
}
#endif /* defined(FBIO_MODEINFO) || defined(CONS_MODEINFO) */
- if (SP->_sysmouse_char_width <= 0)
- SP->_sysmouse_char_width = 8;
- if (SP->_sysmouse_char_height <= 0)
- SP->_sysmouse_char_height = 16;
- SP->_mouse_type = M_SYSMOUSE;
+ if (sp->_sysmouse_char_width <= 0)
+ sp->_sysmouse_char_width = 8;
+ if (sp->_sysmouse_char_height <= 0)
+ sp->_sysmouse_char_height = 16;
+ sp->_mouse_type = M_SYSMOUSE;
if (key_mouse != 0) {
if (!strcmp(key_mouse, xterm_kmous)
|| strstr(cur_term->type.term_names, "xterm") != 0) {
if (key_mouse != 0) {
if (!strcmp(key_mouse, xterm_kmous)
|| strstr(cur_term->type.term_names, "xterm") != 0) {
}
} else if (strstr(cur_term->type.term_names, "xterm") != 0) {
}
} else if (strstr(cur_term->type.term_names, "xterm") != 0) {
- if (_nc_add_to_try(&(SP->_keytry), xterm_kmous, KEY_MOUSE) == OK)
- init_xterm_mouse();
+ if (_nc_add_to_try(&(sp->_keytry), xterm_kmous, KEY_MOUSE) == OK)
+ init_xterm_mouse(sp);
}
returnVoid;
}
static bool
}
returnVoid;
}
static bool
+_nc_mouse_init(SCREEN *sp)
/* initialize the mouse */
{
bool result = FALSE;
int i;
/* initialize the mouse */
{
bool result = FALSE;
int i;
- if (SP != 0) {
- if (!SP->_mouse_initialized) {
- SP->_mouse_initialized = TRUE;
+ if (sp != 0) {
+ if (!sp->_mouse_initialized) {
+ sp->_mouse_initialized = TRUE;
TR(MY_TRACE, ("_nc_mouse_init() called"));
TR(MY_TRACE, ("_nc_mouse_init() called"));
- SP->_mouse_eventp = SP->_mouse_events;
+ sp->_mouse_eventp = sp->_mouse_events;
for (i = 0; i < EV_MAX; i++)
for (i = 0; i < EV_MAX; i++)
- SP->_mouse_events[i].id = INVALID_EVENT;
+ sp->_mouse_events[i].id = INVALID_EVENT;
- initialize_mousetype();
+ initialize_mousetype(sp);
- T(("_nc_mouse_init() set mousetype to %d", SP->_mouse_type));
+ T(("_nc_mouse_init() set mousetype to %d", sp->_mouse_type));
- result = SP->_mouse_initialized;
+ result = sp->_mouse_initialized;
static bool
_nc_mouse_event(SCREEN *sp GCC_UNUSED)
{
static bool
_nc_mouse_event(SCREEN *sp GCC_UNUSED)
{
- MEVENT *eventp = SP->_mouse_eventp;
+ MEVENT *eventp = sp->_mouse_eventp;
bool result = FALSE;
(void) eventp;
bool result = FALSE;
(void) eventp;
- switch (SP->_mouse_type) {
+ switch (sp->_mouse_type) {
case M_XTERM:
/* xterm: never have to query, mouse events are in the keyboard stream */
#if USE_EMX_MOUSE
case M_XTERM:
/* xterm: never have to query, mouse events are in the keyboard stream */
#if USE_EMX_MOUSE
eventp->z = 0;
/* bump the next-free pointer into the circular list */
eventp->z = 0;
/* bump the next-free pointer into the circular list */
- SP->_mouse_eventp = eventp = NEXT(eventp);
+ sp->_mouse_eventp = eventp = NEXT(eventp);
#if USE_SYSMOUSE
case M_SYSMOUSE:
#if USE_SYSMOUSE
case M_SYSMOUSE:
- if (SP->_sysmouse_head < SP->_sysmouse_tail) {
- *eventp = SP->_sysmouse_fifo[SP->_sysmouse_head];
+ if (sp->_sysmouse_head < sp->_sysmouse_tail) {
+ *eventp = sp->_sysmouse_fifo[sp->_sysmouse_head];
/*
* Point the fifo-head to the next possible location. If there
* are none, reset the indices. This may be interrupted by the
* signal handler, doing essentially the same reset.
*/
/*
* Point the fifo-head to the next possible location. If there
* are none, reset the indices. This may be interrupted by the
* signal handler, doing essentially the same reset.
*/
- SP->_sysmouse_head += 1;
- if (SP->_sysmouse_head == SP->_sysmouse_tail) {
- SP->_sysmouse_tail = 0;
- SP->_sysmouse_head = 0;
+ sp->_sysmouse_head += 1;
+ if (sp->_sysmouse_head == sp->_sysmouse_tail) {
+ sp->_sysmouse_tail = 0;
+ sp->_sysmouse_head = 0;
}
/* bump the next-free pointer into the circular list */
}
/* bump the next-free pointer into the circular list */
- SP->_mouse_eventp = eventp = NEXT(eventp);
+ sp->_mouse_eventp = eventp = NEXT(eventp);
{
int b;
bool result = FALSE;
{
int b;
bool result = FALSE;
- MEVENT *eventp = SP->_mouse_eventp;
+ MEVENT *eventp = sp->_mouse_eventp;
TR(MY_TRACE, ("_nc_mouse_inline() called"));
TR(MY_TRACE, ("_nc_mouse_inline() called"));
- if (SP->_mouse_type == M_XTERM) {
+ if (sp->_mouse_type == M_XTERM) {
unsigned char kbuf[4];
mmask_t prev;
size_t grabbed;
unsigned char kbuf[4];
mmask_t prev;
size_t grabbed;
eventp->y = (kbuf[2] - ' ') - 1;
TR(MY_TRACE,
("_nc_mouse_inline: primitive mouse-event %s has slot %ld",
eventp->y = (kbuf[2] - ' ') - 1;
TR(MY_TRACE,
("_nc_mouse_inline: primitive mouse-event %s has slot %ld",
- _tracemouse(eventp),
- (long) (eventp - SP->_mouse_events)));
+ _nc_tracemouse(sp, eventp),
+ (long) (eventp - sp->_mouse_events)));
/* bump the next-free pointer into the circular list */
/* bump the next-free pointer into the circular list */
- SP->_mouse_eventp = NEXT(eventp);
+ sp->_mouse_eventp = NEXT(eventp);
#if 0 /* this return would be needed for QNX's mods to lib_getch.c */
return (TRUE);
#endif
#if 0 /* this return would be needed for QNX's mods to lib_getch.c */
return (TRUE);
#endif
+mouse_activate(SCREEN *sp, bool on)
- if (!on && !SP->_mouse_initialized)
+ if (!on && !sp->_mouse_initialized)
+ if (!_nc_mouse_init(sp))
- switch (SP->_mouse_type) {
+ switch (sp->_mouse_type) {
case M_XTERM:
#if NCURSES_EXT_FUNCS
keyok(KEY_MOUSE, on);
#endif
TPUTS_TRACE("xterm mouse initialization");
case M_XTERM:
#if NCURSES_EXT_FUNCS
keyok(KEY_MOUSE, on);
#endif
TPUTS_TRACE("xterm mouse initialization");
+ enable_xterm_mouse(sp, 1);
break;
#if USE_GPM_SUPPORT
case M_GPM:
break;
#if USE_GPM_SUPPORT
case M_GPM:
- if (enable_gpm_mouse(1)) {
- SP->_mouse_fd = *(my_gpm_fd);
- T(("GPM mouse_fd %d", SP->_mouse_fd));
+ if (enable_gpm_mouse(sp, 1)) {
+ sp->_mouse_fd = *(my_gpm_fd);
+ T(("GPM mouse_fd %d", sp->_mouse_fd));
}
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
signal(SIGUSR2, handle_sysmouse);
}
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
signal(SIGUSR2, handle_sysmouse);
- SP->_mouse_active = TRUE;
+ sp->_mouse_active = TRUE;
break;
#endif
case M_NONE:
break;
#endif
case M_NONE:
/* Make runtime binding to cut down on object size of applications that
* do not use the mouse (e.g., 'clear').
*/
/* Make runtime binding to cut down on object size of applications that
* do not use the mouse (e.g., 'clear').
*/
- SP->_mouse_event = _nc_mouse_event;
- SP->_mouse_inline = _nc_mouse_inline;
- SP->_mouse_parse = _nc_mouse_parse;
- SP->_mouse_resume = _nc_mouse_resume;
- SP->_mouse_wrap = _nc_mouse_wrap;
+ sp->_mouse_event = _nc_mouse_event;
+ sp->_mouse_inline = _nc_mouse_inline;
+ sp->_mouse_parse = _nc_mouse_parse;
+ sp->_mouse_resume = _nc_mouse_resume;
+ sp->_mouse_wrap = _nc_mouse_wrap;
- switch (SP->_mouse_type) {
+ switch (sp->_mouse_type) {
case M_XTERM:
TPUTS_TRACE("xterm mouse deinitialization");
case M_XTERM:
TPUTS_TRACE("xterm mouse deinitialization");
+ enable_xterm_mouse(sp, 0);
break;
#if USE_GPM_SUPPORT
case M_GPM:
break;
#if USE_GPM_SUPPORT
case M_GPM:
+ enable_gpm_mouse(sp, 0);
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
signal(SIGUSR2, SIG_IGN);
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
signal(SIGUSR2, SIG_IGN);
- SP->_mouse_active = FALSE;
+ sp->_mouse_active = FALSE;
break;
#endif
case M_NONE:
break;
#endif
case M_NONE:
**************************************************************************/
static bool
**************************************************************************/
static bool
-_nc_mouse_parse(int runcount)
+_nc_mouse_parse(SCREEN *sp, int runcount)
/* parse a run of atomic mouse events into a gesture */
{
/* parse a run of atomic mouse events into a gesture */
{
- MEVENT *eventp = SP->_mouse_eventp;
+ MEVENT *eventp = sp->_mouse_eventp;
MEVENT *ep, *runp, *next, *prev = PREV(eventp);
int n;
int b;
MEVENT *ep, *runp, *next, *prev = PREV(eventp);
int n;
int b;
if (runcount == 1) {
TR(MY_TRACE,
("_nc_mouse_parse: returning simple mouse event %s at slot %ld",
if (runcount == 1) {
TR(MY_TRACE,
("_nc_mouse_parse: returning simple mouse event %s at slot %ld",
- _tracemouse(prev),
- (long) (prev - SP->_mouse_events)));
+ _nc_tracemouse(sp, prev),
+ (long) (prev - sp->_mouse_events)));
return (prev->id >= NORMAL_EVENT)
return (prev->id >= NORMAL_EVENT)
- ? ((prev->bstate & SP->_mouse_mask) ? TRUE : FALSE)
+ ? ((prev->bstate & sp->_mouse_mask) ? TRUE : FALSE)
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
- _trace_slot("before mouse press/release merge:");
+ _trace_slot(sp, "before mouse press/release merge:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
- (long) (runp - SP->_mouse_events),
- (long) ((eventp - SP->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
+ (long) (runp - sp->_mouse_events),
+ (long) ((eventp - sp->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
runcount);
_nc_unlock_global(tracef);
}
runcount);
_nc_unlock_global(tracef);
}
#endif
) {
for (b = 1; b <= MAX_BUTTONS; ++b) {
#endif
) {
for (b = 1; b <= MAX_BUTTONS; ++b) {
- if ((SP->_mouse_mask & MASK_CLICK(b))
+ if ((sp->_mouse_mask & MASK_CLICK(b))
&& (ep->bstate & MASK_PRESS(b))) {
ep->bstate &= ~MASK_PRESS(b);
ep->bstate |= MASK_CLICK(b);
&& (ep->bstate & MASK_PRESS(b))) {
ep->bstate &= ~MASK_PRESS(b);
ep->bstate |= MASK_CLICK(b);
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
- _trace_slot("before mouse click merge:");
+ _trace_slot(sp, "before mouse click merge:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
- (long) (runp - SP->_mouse_events),
- (long) ((eventp - SP->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
+ (long) (runp - sp->_mouse_events),
+ (long) ((eventp - sp->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
runcount);
_nc_unlock_global(tracef);
}
runcount);
_nc_unlock_global(tracef);
}
if ((ep->bstate & BUTTON_CLICKED)
&& (follower->bstate & BUTTON_CLICKED)) {
for (b = 1; b <= MAX_BUTTONS; ++b) {
if ((ep->bstate & BUTTON_CLICKED)
&& (follower->bstate & BUTTON_CLICKED)) {
for (b = 1; b <= MAX_BUTTONS; ++b) {
- if ((SP->_mouse_mask & MASK_DOUBLE_CLICK(b))
+ if ((sp->_mouse_mask & MASK_DOUBLE_CLICK(b))
&& (follower->bstate & MASK_CLICK(b))) {
follower->bstate &= ~MASK_CLICK(b);
follower->bstate |= MASK_DOUBLE_CLICK(b);
&& (follower->bstate & MASK_CLICK(b))) {
follower->bstate &= ~MASK_CLICK(b);
follower->bstate |= MASK_DOUBLE_CLICK(b);
if ((ep->bstate & BUTTON_DOUBLE_CLICKED)
&& (follower->bstate & BUTTON_CLICKED)) {
for (b = 1; b <= MAX_BUTTONS; ++b) {
if ((ep->bstate & BUTTON_DOUBLE_CLICKED)
&& (follower->bstate & BUTTON_CLICKED)) {
for (b = 1; b <= MAX_BUTTONS; ++b) {
- if ((SP->_mouse_mask & MASK_TRIPLE_CLICK(b))
+ if ((sp->_mouse_mask & MASK_TRIPLE_CLICK(b))
&& (follower->bstate & MASK_CLICK(b))) {
follower->bstate &= ~MASK_CLICK(b);
follower->bstate |= MASK_TRIPLE_CLICK(b);
&& (follower->bstate & MASK_CLICK(b))) {
follower->bstate &= ~MASK_CLICK(b);
follower->bstate |= MASK_TRIPLE_CLICK(b);
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
- _trace_slot("before mouse event queue compaction:");
+ _trace_slot(sp, "before mouse event queue compaction:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
- (long) (runp - SP->_mouse_events),
- (long) ((eventp - SP->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
+ (long) (runp - sp->_mouse_events),
+ (long) ((eventp - sp->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
runcount);
_nc_unlock_global(tracef);
}
runcount);
_nc_unlock_global(tracef);
}
* don't match the current event mask.
*/
for (; runcount; prev = PREV(eventp), runcount--)
* don't match the current event mask.
*/
for (; runcount; prev = PREV(eventp), runcount--)
- if (prev->id == INVALID_EVENT || !(prev->bstate & SP->_mouse_mask)) {
- SP->_mouse_eventp = eventp = prev;
+ if (prev->id == INVALID_EVENT || !(prev->bstate & sp->_mouse_mask)) {
+ sp->_mouse_eventp = eventp = prev;
}
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
}
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
- _trace_slot("after mouse event queue compaction:");
+ _trace_slot(sp, "after mouse event queue compaction:");
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
_tracef("_nc_mouse_parse: run starts at %ld, ends at %ld, count %d",
- (long) (runp - SP->_mouse_events),
- (long) ((eventp - SP->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
+ (long) (runp - sp->_mouse_events),
+ (long) ((eventp - sp->_mouse_events) + (EV_MAX - 1)) % EV_MAX,
runcount);
_nc_unlock_global(tracef);
}
runcount);
_nc_unlock_global(tracef);
}
if (ep->id != INVALID_EVENT)
TR(MY_TRACE,
("_nc_mouse_parse: returning composite mouse event %s at slot %ld",
if (ep->id != INVALID_EVENT)
TR(MY_TRACE,
("_nc_mouse_parse: returning composite mouse event %s at slot %ld",
- _tracemouse(ep),
- (long) (ep - SP->_mouse_events)));
+ _nc_tracemouse(sp, ep),
+ (long) (ep - sp->_mouse_events)));
#endif /* TRACE */
/* after all this, do we have a valid event? */
#endif /* TRACE */
/* after all this, do we have a valid event? */
-_nc_mouse_wrap(SCREEN *sp GCC_UNUSED)
+_nc_mouse_wrap(SCREEN *sp)
/* release mouse -- called by endwin() before shellout/exit */
{
TR(MY_TRACE, ("_nc_mouse_wrap() called"));
/* release mouse -- called by endwin() before shellout/exit */
{
TR(MY_TRACE, ("_nc_mouse_wrap() called"));
- switch (SP->_mouse_type) {
+ switch (sp->_mouse_type) {
- if (SP->_mouse_mask)
- mouse_activate(FALSE);
+ if (sp->_mouse_mask)
+ mouse_activate(sp, FALSE);
break;
#if USE_GPM_SUPPORT
/* GPM: pass all mouse events to next client */
case M_GPM:
break;
#if USE_GPM_SUPPORT
/* GPM: pass all mouse events to next client */
case M_GPM:
- if (SP->_mouse_mask)
- mouse_activate(FALSE);
+ if (sp->_mouse_mask)
+ mouse_activate(sp, FALSE);
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
+ mouse_activate(sp, FALSE);
break;
#endif
case M_NONE:
break;
#endif
case M_NONE:
-_nc_mouse_resume(SCREEN *sp GCC_UNUSED)
+_nc_mouse_resume(SCREEN *sp)
/* re-connect to mouse -- called by doupdate() after shellout */
{
TR(MY_TRACE, ("_nc_mouse_resume() called"));
/* re-connect to mouse -- called by doupdate() after shellout */
{
TR(MY_TRACE, ("_nc_mouse_resume() called"));
- switch (SP->_mouse_type) {
+ switch (sp->_mouse_type) {
case M_XTERM:
/* xterm: re-enable reporting */
case M_XTERM:
/* xterm: re-enable reporting */
- if (SP->_mouse_mask)
- mouse_activate(TRUE);
+ if (sp->_mouse_mask)
+ mouse_activate(sp, TRUE);
break;
#if USE_GPM_SUPPORT
case M_GPM:
/* GPM: reclaim our event set */
break;
#if USE_GPM_SUPPORT
case M_GPM:
/* GPM: reclaim our event set */
- if (SP->_mouse_mask)
- mouse_activate(TRUE);
+ if (sp->_mouse_mask)
+ mouse_activate(sp, TRUE);
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
break;
#endif
#if USE_SYSMOUSE
case M_SYSMOUSE:
+ mouse_activate(sp, TRUE);
break;
#endif
case M_NONE:
break;
#endif
case M_NONE:
*
**************************************************************************/
*
**************************************************************************/
-NCURSES_EXPORT(int)
-getmouse(MEVENT * aevent)
-/* grab a copy of the current mouse event */
+static int
+_nc_getmouse(SCREEN *sp, MEVENT * aevent)
{
T((T_CALLED("getmouse(%p)"), aevent));
{
T((T_CALLED("getmouse(%p)"), aevent));
- if ((aevent != 0) && (SP != 0) && (SP->_mouse_type != M_NONE)) {
- MEVENT *eventp = SP->_mouse_eventp;
+ if ((aevent != 0) && (sp != 0) && (sp->_mouse_type != M_NONE)) {
+ MEVENT *eventp = sp->_mouse_eventp;
/* compute the current-event pointer */
MEVENT *prev = PREV(eventp);
/* compute the current-event pointer */
MEVENT *prev = PREV(eventp);
*aevent = *prev;
TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld",
*aevent = *prev;
TR(TRACE_IEVENT, ("getmouse: returning event %s from slot %ld",
- _tracemouse(prev),
- (long) (prev - SP->_mouse_events)));
+ _nc_tracemouse(sp, prev),
+ (long) (prev - sp->_mouse_events)));
prev->id = INVALID_EVENT; /* so the queue slot becomes free */
returnCode(OK);
prev->id = INVALID_EVENT; /* so the queue slot becomes free */
returnCode(OK);
+/* grab a copy of the current mouse event */
-ungetmouse(MEVENT * aevent)
-/* enqueue a synthesized mouse event to be seen by the next wgetch() */
+getmouse(MEVENT * aevent)
+{
+ return _nc_getmouse(SP, aevent);
+}
+
+static int
+_nc_ungetmouse(SCREEN *sp, MEVENT * aevent)
{
int result = ERR;
T((T_CALLED("ungetmouse(%p)"), aevent));
{
int result = ERR;
T((T_CALLED("ungetmouse(%p)"), aevent));
- if (aevent != 0 && SP != 0) {
- MEVENT *eventp = SP->_mouse_eventp;
+ if (aevent != 0 && sp != 0) {
+ MEVENT *eventp = sp->_mouse_eventp;
/* stick the given event in the next-free slot */
*eventp = *aevent;
/* bump the next-free pointer into the circular list */
/* stick the given event in the next-free slot */
*eventp = *aevent;
/* bump the next-free pointer into the circular list */
- SP->_mouse_eventp = NEXT(eventp);
+ sp->_mouse_eventp = NEXT(eventp);
/* push back the notification event on the keyboard queue */
/* push back the notification event on the keyboard queue */
- result = ungetch(KEY_MOUSE);
+ result = _nc_ungetch(sp, KEY_MOUSE);
+/* enqueue a synthesized mouse event to be seen by the next wgetch() */
+NCURSES_EXPORT(int)
+ungetmouse(MEVENT * aevent)
+{
+ return _nc_ungetmouse(SP, aevent);
+}
+
NCURSES_EXPORT(mmask_t)
mousemask(mmask_t newmask, mmask_t * oldmask)
/* set the mouse event mask */
NCURSES_EXPORT(mmask_t)
mousemask(mmask_t newmask, mmask_t * oldmask)
/* set the mouse event mask */
*oldmask = SP->_mouse_mask;
if (newmask || SP->_mouse_initialized) {
*oldmask = SP->_mouse_mask;
if (newmask || SP->_mouse_initialized) {
if (SP->_mouse_type != M_NONE) {
result = newmask &
(REPORT_MOUSE_POSITION
if (SP->_mouse_type != M_NONE) {
result = newmask &
(REPORT_MOUSE_POSITION
| BUTTON_DOUBLE_CLICKED
| BUTTON_TRIPLE_CLICKED);
| BUTTON_DOUBLE_CLICKED
| BUTTON_TRIPLE_CLICKED);
- mouse_activate((bool) (result != 0));
+ mouse_activate(SP, (bool) (result != 0));
SP->_mouse_mask = result;
}
SP->_mouse_mask = result;
}
#include <curses.priv.h>
#include <stddef.h>
#include <curses.priv.h>
#include <stddef.h>
-MODULE_ID("$Id: lib_newwin.c,v 1.50 2008/05/03 16:36:39 tom Exp $")
+MODULE_ID("$Id: lib_newwin.c,v 1.51 2008/05/31 21:50:09 tom Exp $")
#define window_is(name) ((sp)->_##name == win)
#define window_is(name) ((sp)->_##name == win)
}
wp->next = _nc_windows;
}
wp->next = _nc_windows;
_nc_windows = wp;
T((T_CREATE("window %p"), win));
_nc_windows = wp;
T((T_CREATE("window %p"), win));
_nc_unlock_global(windowlist);
returnWin(win);
}
_nc_unlock_global(windowlist);
returnWin(win);
}
+
+/*
+ * wgetch() and other functions with a WINDOW* parameter may use a SCREEN*
+ * internally, and it is useful to allow those to be invoked without switching
+ * SCREEN's, e.g., for multi-threaded applications.
+ */
+NCURSES_EXPORT(SCREEN *)
+_nc_screen_of(WINDOW *win)
+{
+ SCREEN *sp = 0;
+
+ if (win != 0) {
+ WINDOWLIST *wp = (WINDOWLIST *) win;
+ sp = wp->screen;
+ }
+ return (sp);
+}
#include <term.h> /* cur_term */
#include <tic.h>
#include <term.h> /* cur_term */
#include <tic.h>
-MODULE_ID("$Id: lib_set_term.c,v 1.108 2008/05/03 22:42:43 tom Exp $")
+MODULE_ID("$Id: lib_set_term.c,v 1.109 2008/05/31 20:11:26 tom Exp $")
NCURSES_EXPORT(SCREEN *)
set_term(SCREEN *screenp)
NCURSES_EXPORT(SCREEN *)
set_term(SCREEN *screenp)
-no_mouse_parse(int code GCC_UNUSED)
+no_mouse_parse(SCREEN *sp GCC_UNUSED, int code GCC_UNUSED)
#include <ctype.h>
#include <term.h> /* num_labels, label_*, plab_norm */
#include <ctype.h>
#include <term.h> /* num_labels, label_*, plab_norm */
-MODULE_ID("$Id: lib_slk.c,v 1.31 2008/01/12 20:21:00 tom Exp $")
+MODULE_ID("$Id: lib_slk.c,v 1.33 2008/05/31 22:05:57 tom Exp $")
/*
* We'd like to move these into the screen context structure, but cannot,
/*
* We'd like to move these into the screen context structure, but cannot,
static void
slk_paint_info(WINDOW *win)
{
static void
slk_paint_info(WINDOW *win)
{
- if (win && SP->slk_format == 4) {
+ SCREEN *sp = _nc_screen_of(win);
+
+ if (win && sp && (sp->slk_format == 4)) {
int i;
mvwhline(win, 0, 0, 0, getmaxx(win));
wmove(win, 0, 0);
int i;
mvwhline(win, 0, 0, 0, getmaxx(win));
wmove(win, 0, 0);
- for (i = 0; i < SP->_slk->maxlab; i++) {
- mvwprintw(win, 0, SP->_slk->ent[i].ent_x, "F%d", i + 1);
+ for (i = 0; i < sp->_slk->maxlab; i++) {
+ mvwprintw(win, 0, sp->_slk->ent[i].ent_x, "F%d", i + 1);
-MODULE_ID("$Id: lib_ungetch.c,v 1.10 2008/05/03 20:20:58 tom Exp $")
+MODULE_ID("$Id: lib_ungetch.c,v 1.11 2008/05/31 16:44:54 tom Exp $")
int i;
T(("head = %d, tail = %d, peek = %d", head, tail, peek));
for (i = 0; i < 10; i++)
int i;
T(("head = %d, tail = %d, peek = %d", head, tail, peek));
for (i = 0; i < 10; i++)
- T(("char %d = %s", i, _tracechar(sp->_fifo[i])));
+ T(("char %d = %s", i, _nc_tracechar(sp, sp->_fifo[i])));
h_dec();
sp->_fifo[head] = ch;
h_dec();
sp->_fifo[head] = ch;
- T(("ungetch %s ok", _tracechar(ch)));
+ T(("ungetch %s ok", _nc_tracechar(sp, ch)));
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump(sp);
#ifdef TRACE
if (USE_TRACEF(TRACE_IEVENT)) {
_nc_fifo_dump(sp);
NCURSES_EXPORT(int)
ungetch(int ch)
{
NCURSES_EXPORT(int)
ungetch(int ch)
{
- T((T_CALLED("ungetch(%s)"), _tracechar(ch)));
+ T((T_CALLED("ungetch(%s)"), _nc_tracechar(SP, ch)));
returnCode(_nc_ungetch(SP, ch));
}
returnCode(_nc_ungetch(SP, ch));
}
#include <curses.priv.h>
#include <term.h>
#include <curses.priv.h>
#include <term.h>
-MODULE_ID("$Id: resizeterm.c,v 1.32 2008/05/03 14:28:55 tom Exp $")
+MODULE_ID("$Id: resizeterm.c,v 1.33 2008/05/31 16:51:12 tom Exp $")
#define stolen_lines (screen_lines - SP->_lines_avail)
#define stolen_lines (screen_lines - SP->_lines_avail)
result = resize_term(ToLines, ToCols);
#if USE_SIGWINCH
result = resize_term(ToLines, ToCols);
#if USE_SIGWINCH
- ungetch(KEY_RESIZE); /* so application can know this */
+ _nc_ungetch(SP, KEY_RESIZE); /* so application can know this */
clearok(curscr, TRUE); /* screen contents are unknown */
/* ripped-off lines are a special case: if we did not lengthen
clearok(curscr, TRUE); /* screen contents are unknown */
/* ripped-off lines are a special case: if we did not lengthen
/****************************************************************************
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
-MODULE_ID("$Id: tries.c,v 1.25 2007/09/29 20:37:13 tom Exp $")
+MODULE_ID("$Id: tries.c,v 1.26 2008/05/31 16:54:22 tom Exp $")
/*
* Expand a keycode into the string that it corresponds to, returning null if
/*
* Expand a keycode into the string that it corresponds to, returning null if
*((unsigned char *) (result + len)) = 128;
#ifdef TRACE
if (len == 0 && USE_TRACEF(TRACE_MAXIMUM)) {
*((unsigned char *) (result + len)) = 128;
#ifdef TRACE
if (len == 0 && USE_TRACEF(TRACE_MAXIMUM)) {
- _tracef("expand_key %s %s", _tracechar(code), _nc_visbuf(result));
+ _tracef("expand_key %s %s", _nc_tracechar(SP, code), _nc_visbuf(result));
_nc_unlock_global(tracef);
}
#endif
_nc_unlock_global(tracef);
}
#endif
- * $Id: curses.priv.h,v 1.375 2008/05/24 23:08:27 tom Exp $
+ * $Id: curses.priv.h,v 1.382 2008/05/31 21:41:41 tom Exp $
char *tracedmp_buf;
size_t tracedmp_used;
char *tracedmp_buf;
size_t tracedmp_used;
- char tracemse_buf[TRACEMSE_MAX];
-
unsigned char *tracetry_buf;
size_t tracetry_used;
unsigned char *tracetry_buf;
size_t tracetry_used;
int _maxclick;
bool (*_mouse_event) (SCREEN *);
bool (*_mouse_inline)(SCREEN *);
int _maxclick;
bool (*_mouse_event) (SCREEN *);
bool (*_mouse_inline)(SCREEN *);
- bool (*_mouse_parse) (int);
+ bool (*_mouse_parse) (SCREEN *, int);
void (*_mouse_resume)(SCREEN *);
void (*_mouse_wrap) (SCREEN *);
int _mouse_fd; /* file-descriptor, if any */
void (*_mouse_resume)(SCREEN *);
void (*_mouse_wrap) (SCREEN *);
int _mouse_fd; /* file-descriptor, if any */
long _outchars;
const char *_tputs_trace;
#endif
long _outchars;
const char *_tputs_trace;
#endif
+#endif
+
+#ifdef TRACE
+ char tracechr_buf[40];
+ char tracemse_buf[TRACEMSE_MAX];
#endif
/*
* ncurses/ncursesw are the same up to this point.
#endif
/*
* ncurses/ncursesw are the same up to this point.
extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
WINDOWLIST {
extern NCURSES_EXPORT_VAR(SIG_ATOMIC_T) _nc_have_sigwinch;
WINDOWLIST {
- WINDOW win; /* first, so WINDOW_EXT() works */
+ WINDOW win; /* first, so WINDOW_EXT() works */
+ SCREEN *screen; /* screen containing the window */
#ifdef _XOPEN_SOURCE_EXTENDED
char addch_work[(MB_LEN_MAX * 9) + 1];
unsigned addch_used; /* number of bytes in addch_work[] */
#ifdef _XOPEN_SOURCE_EXTENDED
char addch_work[(MB_LEN_MAX * 9) + 1];
unsigned addch_used; /* number of bytes in addch_work[] */
extern NCURSES_EXPORT(int) _nc_remove_string (TRIES **, const char *);
/* elsewhere ... */
extern NCURSES_EXPORT(int) _nc_remove_string (TRIES **, const char *);
/* elsewhere ... */
-extern NCURSES_EXPORT(ENTRY *) _nc_delink_entry(ENTRY *, TERMTYPE *);
+extern NCURSES_EXPORT(ENTRY *) _nc_delink_entry (ENTRY *, TERMTYPE *);
+extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_keyname (SCREEN *, int);
+extern NCURSES_EXPORT(NCURSES_CONST char *) _nc_unctrl (SCREEN *, chtype);
+extern NCURSES_EXPORT(SCREEN *) _nc_screen_of (WINDOW *);
extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int);
extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t);
extern NCURSES_EXPORT(char *) _nc_trace_bufcat (int, const char *);
extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int);
extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t);
extern NCURSES_EXPORT(char *) _nc_trace_bufcat (int, const char *);
+extern NCURSES_EXPORT(char *) _nc_tracechar (SCREEN *, int);
+extern NCURSES_EXPORT(char *) _nc_tracemouse (SCREEN *, MEVENT const *);
extern NCURSES_EXPORT(int) _nc_access (const char *, int);
extern NCURSES_EXPORT(int) _nc_baudrate (int);
extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *);
extern NCURSES_EXPORT(int) _nc_access (const char *, int);
extern NCURSES_EXPORT(int) _nc_baudrate (int);
extern NCURSES_EXPORT(int) _nc_freewin (WINDOW *);
extern NCURSES_EXPORT(int) _nc_outch (int);
extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);
extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int);
extern NCURSES_EXPORT(int) _nc_outch (int);
extern NCURSES_EXPORT(int) _nc_read_termcap_entry (const char *const, TERMTYPE *const);
extern NCURSES_EXPORT(int) _nc_setupscreen (int, int, FILE *, bool, int);
-extern NCURSES_EXPORT(int) _nc_timed_wait(SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
+extern NCURSES_EXPORT(int) _nc_timed_wait (SCREEN *, int, int, int * EVENTLIST_2nd(_nc_eventlist *));
extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, int (*)(int));
extern NCURSES_EXPORT(void) _nc_flush (void);
extern NCURSES_EXPORT(void) _nc_do_color (short, short, bool, int (*)(int));
extern NCURSES_EXPORT(void) _nc_flush (void);
-extern NCURSES_EXPORT(void) _nc_free_entry(ENTRY *, TERMTYPE *);
+extern NCURSES_EXPORT(void) _nc_free_entry (ENTRY *, TERMTYPE *);
extern NCURSES_EXPORT(void) _nc_freeall (void);
extern NCURSES_EXPORT(void) _nc_hash_map (void);
extern NCURSES_EXPORT(void) _nc_init_keytry (SCREEN *);
extern NCURSES_EXPORT(void) _nc_freeall (void);
extern NCURSES_EXPORT(void) _nc_hash_map (void);
extern NCURSES_EXPORT(void) _nc_init_keytry (SCREEN *);
-MODULE_ID("$Id: lib_data.c,v 1.44 2008/05/24 23:09:21 tom Exp $")
+MODULE_ID("$Id: lib_data.c,v 1.47 2008/05/31 19:44:36 tom Exp $")
/*
* OS/2's native linker complains if we don't initialize public data when
/*
* OS/2's native linker complains if we don't initialize public data when
NULL, /* tracedmp_buf */
0, /* tracedmp_used */
NULL, /* tracedmp_buf */
0, /* tracedmp_used */
- CHARS_0s, /* tracemse_buf */
-
NULL, /* tracetry_buf */
0, /* tracetry_used */
NULL, /* tracetry_buf */
0, /* tracetry_used */
/****************************************************************************
/****************************************************************************
- * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <curses.priv.h>
#include <term.h> /* acs_chars */
#include <curses.priv.h>
#include <term.h> /* acs_chars */
-MODULE_ID("$Id: lib_traceatr.c,v 1.59 2007/06/09 17:22:10 tom Exp $")
+MODULE_ID("$Id: lib_traceatr.c,v 1.60 2008/05/31 16:53:15 tom Exp $")
#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) {
(void) _nc_trace_bufcat(bufnum, found);
} else
if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) {
(void) _nc_trace_bufcat(bufnum, found);
} else
- (void) _nc_trace_bufcat(bufnum, _tracechar((int)ChCharOf(ch)));
+ (void) _nc_trace_bufcat(bufnum, _nc_tracechar(SP, (int)ChCharOf(ch)));
if (ChAttrOf(ch) != A_NORMAL) {
(void) _nc_trace_bufcat(bufnum, " | ");
if (ChAttrOf(ch) != A_NORMAL) {
(void) _nc_trace_bufcat(bufnum, " | ");
if (PUTC_n <= 0) {
if (PUTC_ch != L'\0') {
/* it could not be a multibyte sequence */
if (PUTC_n <= 0) {
if (PUTC_ch != L'\0') {
/* it could not be a multibyte sequence */
- (void) _nc_trace_bufcat(bufnum, _tracechar(UChar(ch->chars[PUTC_i])));
+ (void) _nc_trace_bufcat(bufnum, _nc_tracechar(SP, UChar(ch->chars[PUTC_i])));
}
break;
}
for (n = 0; n < PUTC_n; n++) {
if (n)
(void) _nc_trace_bufcat(bufnum, ", ");
}
break;
}
for (n = 0; n < PUTC_n; n++) {
if (n)
(void) _nc_trace_bufcat(bufnum, ", ");
- (void) _nc_trace_bufcat(bufnum, _tracechar(UChar(PUTC_buf[n])));
+ (void) _nc_trace_bufcat(bufnum, _nc_tracechar(SP, UChar(PUTC_buf[n])));
}
}
(void) _nc_trace_bufcat(bufnum, " }");
}
}
(void) _nc_trace_bufcat(bufnum, " }");
-MODULE_ID("$Id: lib_tracechr.c,v 1.13 2007/04/21 23:16:37 tom Exp $")
+MODULE_ID("$Id: lib_tracechr.c,v 1.17 2008/05/31 19:57:47 tom Exp $")
-#define MyBuffer _nc_globals.tracechr_buf
+_nc_tracechar(SCREEN *sp, int ch)
{
NCURSES_CONST char *name;
{
NCURSES_CONST char *name;
+ char *MyBuffer = ((sp != 0)
+ ? sp->tracechr_buf
+ : _nc_globals.tracechr_buf);
if (ch > KEY_MIN || ch < 0) {
if (ch > KEY_MIN || ch < 0) {
+ name = _nc_keyname(sp, ch);
if (name == 0 || *name == '\0')
name = "NULL";
(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
if (name == 0 || *name == '\0')
name = "NULL";
(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
*/
(void) sprintf(MyBuffer, "%#03o", ch);
} else {
*/
(void) sprintf(MyBuffer, "%#03o", ch);
} else {
- name = unctrl((chtype) ch);
+ name = _nc_unctrl(sp, (chtype) ch);
if (name == 0 || *name == 0)
name = "null"; /* shouldn't happen */
(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
}
return (MyBuffer);
}
if (name == 0 || *name == 0)
name = "null"; /* shouldn't happen */
(void) sprintf(MyBuffer, "'%.30s' = %#03o", name, ch);
}
return (MyBuffer);
}
+
+NCURSES_EXPORT(char *)
+_tracechar(int ch)
+{
+ return _nc_tracechar(SP, ch);
+}
#else
empty_module(_nc_lib_tracechr)
#endif
#else
empty_module(_nc_lib_tracechr)
#endif
/****************************************************************************
/****************************************************************************
- * Copyright (c) 1998-2005,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
-MODULE_ID("$Id: lib_tracemse.c,v 1.13 2007/04/21 21:23:00 tom Exp $")
+MODULE_ID("$Id: lib_tracemse.c,v 1.14 2008/05/31 17:20:25 tom Exp $")
-#define my_buffer _nc_globals.tracemse_buf
+#define my_buffer sp->tracemse_buf
-_tracemouse(MEVENT const *ep)
+_nc_tracemouse(SCREEN *sp, MEVENT const *ep)
{
(void) sprintf(my_buffer, TRACEMSE_FMT,
ep->id,
{
(void) sprintf(my_buffer, TRACEMSE_FMT,
ep->id,
+NCURSES_EXPORT(char *)
+_tracemouse(MEVENT const *ep)
+{
+ return _nc_tracemouse(SP, ep);
+}
+
#else /* !TRACE */
empty_module(_nc_lib_tracemouse)
#endif
#else /* !TRACE */
empty_module(_nc_lib_tracemouse)
#endif