--- ncurses/base/lib_mouse.c +++ ncurses/base/lib_mouse.c 2008-04-11 17:48:00.119274018 +0200 @@ -352,6 +352,11 @@ enable_xterm_mouse(int enable) static int allow_gpm_mouse(void) { +#if defined(linux) && (defined(_REENTRANT) || defined(_THREAD_SAFE)) + /* Danger Robinson: do not use dlopen for libgpm if already loaded */ + if ((Gpm_Wgetch)) + return FALSE; +#endif /* GPM does printf's without checking if stdout is a terminal */ if (isatty(fileno(stdout))) { char *env = getenv("TERM"); @@ -359,7 +364,7 @@ allow_gpm_mouse(void) * it should pass xterm events through. There is no real advantage * in allowing GPM to do this. */ - if (env == 0 || strncmp(env, "xterm", 5)) + if (env == 0 || strncmp(env, "linux", 5) == 0) return TRUE; } return FALSE; --- ncurses/curses.priv.h +++ ncurses/curses.priv.h 2008-04-11 17:33:58.695131162 +0200 @@ -397,6 +397,9 @@ typedef struct { #if USE_GPM_SUPPORT #undef buttons /* term.h defines this, and gpm uses it! */ #include +#if defined(linux) && (defined(_REENTRANT) || defined(_THREAD_SAFE)) +weak_symbol(Gpm_Wgetch); +#endif #ifdef HAVE_LIBDL /* link dynamically to GPM */