Commit f5f37a85 authored by Alexandre Julliard's avatar Alexandre Julliard

wineconsole: Portability fixes in the curses mouse support.

parent fdb4c7e9
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59e for Wine 0.9.16.
# Generated by GNU Autoconf 2.60a for Wine 0.9.16.
#
# Report bugs to <wine-devel@winehq.org>.
#
......@@ -1443,7 +1443,7 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
Wine configure 0.9.16
generated by GNU Autoconf 2.59e
generated by GNU Autoconf 2.60a
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
......@@ -1457,7 +1457,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Wine $as_me 0.9.16, which was
generated by GNU Autoconf 2.59e. Invocation command line was
generated by GNU Autoconf 2.60a. Invocation command line was
$ $0 $@
......@@ -2927,6 +2927,11 @@ static char *f (char * (*g) (char **, int), char **p, ...)
that's true only with -std. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
inside strings and character constants. */
#define FOO(x) 'x'
int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
......@@ -11793,6 +11798,119 @@ _ACEOF
fi
fi
ac_save_LIBS="$LIBS"
LIBS="$LIBS $CURSESLIBS"
for ac_func in mousemask
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
LIBS="$ac_save_LIBS"
fi
......@@ -24601,7 +24719,7 @@ exec 6>&1
# values after options handling.
ac_log="
This file was extended by Wine $as_me 0.9.16, which was
generated by GNU Autoconf 2.59e. Invocation command line was
generated by GNU Autoconf 2.60a. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
......@@ -24654,7 +24772,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
Wine config.status 0.9.16
configured by $0, generated by GNU Autoconf 2.59e,
configured by $0, generated by GNU Autoconf 2.60a,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
Copyright (C) 2006 Free Software Foundation, Inc.
......
......@@ -541,6 +541,10 @@ then
[AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have the curses library (-lcurses)])
CURSESLIBS="-lcurses"])
fi
ac_save_LIBS="$LIBS"
LIBS="$LIBS $CURSESLIBS"
AC_CHECK_FUNCS(mousemask)
LIBS="$ac_save_LIBS"
fi
AC_SUBST(CURSESLIBS)
......
......@@ -437,6 +437,9 @@
/* Define to 1 if the system has the type `mode_t'. */
#undef HAVE_MODE_T
/* Define to 1 if you have the `mousemask' function. */
#undef HAVE_MOUSEMASK
/* Define if you have NAS including devel headers */
#undef HAVE_NAS
......
......@@ -40,7 +40,10 @@
#elif defined(HAVE_CURSES_H)
# include <curses.h>
#endif
#undef KEY_EVENT /* avoid redefinition warning */
/* avoid redefinition warnings */
#undef KEY_EVENT
#undef MOUSE_MOVED
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
......@@ -67,7 +70,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(curses);
struct inner_data_curse
{
mmask_t initial_mouse_mask;
unsigned long initial_mouse_mask;
HANDLE hInput;
WINDOW* pad;
chtype* line;
......@@ -77,23 +80,30 @@ struct inner_data_curse
static void *nc_handle = NULL;
#ifdef initscr /* work around Solaris breakage */
#undef initscr
extern WINDOW *initscr(void);
#endif
#define MAKE_FUNCPTR(f) static typeof(f) * p_##f;
MAKE_FUNCPTR(curs_set)
MAKE_FUNCPTR(delwin)
MAKE_FUNCPTR(endwin)
#ifndef getmaxx
MAKE_FUNCPTR(getmaxx)
#endif
#ifndef getmaxy
MAKE_FUNCPTR(getmaxy)
#endif
MAKE_FUNCPTR(getmouse)
MAKE_FUNCPTR(has_colors)
MAKE_FUNCPTR(init_pair)
#ifndef initscr
MAKE_FUNCPTR(initscr)
#endif
#ifndef intrflush
MAKE_FUNCPTR(intrflush)
#endif
MAKE_FUNCPTR(keypad)
MAKE_FUNCPTR(mouseinterval)
MAKE_FUNCPTR(mousemask)
MAKE_FUNCPTR(newpad)
#ifndef nodelay
MAKE_FUNCPTR(nodelay)
......@@ -108,6 +118,10 @@ MAKE_FUNCPTR(stdscr)
MAKE_FUNCPTR(waddchnstr)
MAKE_FUNCPTR(wmove)
MAKE_FUNCPTR(wgetch)
#ifdef HAVE_MOUSEMASK
MAKE_FUNCPTR(mouseinterval)
MAKE_FUNCPTR(mousemask)
#endif
#undef MAKE_FUNCPTR
......@@ -139,18 +153,20 @@ static BOOL WCCURSES_bind_libcurses(void)
LOAD_FUNCPTR(curs_set)
LOAD_FUNCPTR(delwin)
LOAD_FUNCPTR(endwin)
#ifndef getmaxx
LOAD_FUNCPTR(getmaxx)
#endif
#ifndef getmaxy
LOAD_FUNCPTR(getmaxy)
#endif
LOAD_FUNCPTR(getmouse)
LOAD_FUNCPTR(has_colors)
LOAD_FUNCPTR(init_pair)
#ifndef initscr
LOAD_FUNCPTR(initscr)
#endif
#ifndef intrflush
LOAD_FUNCPTR(intrflush)
#endif
LOAD_FUNCPTR(keypad)
LOAD_FUNCPTR(mouseinterval)
LOAD_FUNCPTR(mousemask)
LOAD_FUNCPTR(newpad)
#ifndef nodelay
LOAD_FUNCPTR(nodelay)
......@@ -165,6 +181,10 @@ static BOOL WCCURSES_bind_libcurses(void)
LOAD_FUNCPTR(waddchnstr)
LOAD_FUNCPTR(wmove)
LOAD_FUNCPTR(wgetch)
#ifdef HAVE_MOUSEMASK
LOAD_FUNCPTR(mouseinterval)
LOAD_FUNCPTR(mousemask)
#endif
#undef LOAD_FUNCPTR
......@@ -183,12 +203,16 @@ sym_not_found:
#define curs_set p_curs_set
#define delwin p_delwin
#define endwin p_endwin
#ifndef getmaxx
#define getmaxx p_getmaxx
#endif
#ifndef getmaxy
#define getmaxy p_getmaxy
#endif
#define getmouse p_getmouse
#define has_colors p_has_colors
#define init_pair p_init_pair
#ifndef initscr
#define initscr p_initscr
#endif
#ifndef intrflush
#define intrflush p_intrflush
#endif
......@@ -551,6 +575,7 @@ static unsigned WCCURSES_FillComplexChar(INPUT_RECORD* ir, WORD vk, WORD kc, DWO
*/
static unsigned WCCURSES_FillMouse(INPUT_RECORD* ir)
{
#ifdef HAVE_MOUSEMASK
static unsigned bstate /* = 0 */;
static COORD pos /* = {0, 0} */;
......@@ -603,6 +628,9 @@ static unsigned WCCURSES_FillMouse(INPUT_RECORD* ir)
pos.X = mevt.x; pos.Y = mevt.y;
return 1;
#else
return 0;
#endif
}
/******************************************************************
......@@ -745,7 +773,6 @@ static unsigned WCCURSES_FillCode(struct inner_data* data, INPUT_RECORD* ir, int
case KEY_REFERENCE:
case KEY_REFRESH:
case KEY_REPLACE:
case KEY_RESIZE:
case KEY_RESTART:
case KEY_RESUME:
case KEY_SAVE:
......@@ -754,6 +781,9 @@ static unsigned WCCURSES_FillCode(struct inner_data* data, INPUT_RECORD* ir, int
case KEY_SCOMMAND:
case KEY_SCOPY:
case KEY_SCREATE:
#ifdef KEY_RESIZE
case KEY_RESIZE:
#endif
goto notFound;
case KEY_SDC:
......@@ -829,7 +859,7 @@ static void WCCURSES_GetEvents(struct inner_data* data)
WINE_TRACE("Got o%o (0x%x)\n", inchar,inchar);
if (inchar & KEY_CODE_YES)
if (inchar >= KEY_MIN && inchar <= KEY_MAX)
{
numEvent = WCCURSES_FillCode(data, ir, inchar);
}
......@@ -848,14 +878,17 @@ static void WCCURSES_GetEvents(struct inner_data* data)
*/
static void WCCURSES_DeleteBackend(struct inner_data* data)
{
mmask_t mm;
if (!PRIVATE(data)) return;
CloseHandle(PRIVATE(data)->hInput);
delwin(PRIVATE(data)->pad);
#ifdef HAVE_MOUSEMASK
{
mmask_t mm;
mousemask(PRIVATE(data)->initial_mouse_mask, &mm);
}
#endif
endwin();
HeapFree(GetProcessHeap(), 0, PRIVATE(data)->line);
......@@ -950,23 +983,29 @@ enum init_return WCCURSES_InitBackend(struct inner_data* data)
intrflush(stdscr, FALSE);
nodelay(stdscr, TRUE);
keypad(stdscr, TRUE);
#ifdef HAVE_MOUSEMASK
if (data->curcfg.quick_edit)
{
mmask_t mm;
mousemask(BUTTON1_PRESSED|BUTTON1_RELEASED|
BUTTON2_PRESSED|BUTTON2_RELEASED|
BUTTON3_PRESSED|BUTTON3_RELEASED|
BUTTON_SHIFT|BUTTON_CTRL|BUTTON_ALT|REPORT_MOUSE_POSITION,
&PRIVATE(data)->initial_mouse_mask);
&mm);
/* no click event generation... we just need button up/down events
* it doesn't seem that mouseinterval(-1) behaves as documented...
* 0 seems to be better value to disable click event generation
*/
mouseinterval(0);
PRIVATE(data)->initial_mouse_mask = mm;
}
else
{
mousemask(0, &PRIVATE(data)->initial_mouse_mask);
mmask_t mm;
mousemask(0, &mm);
PRIVATE(data)->initial_mouse_mask = mm;
}
#endif
return init_success;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment