Bug#472063: gpm: Mouse in xterm doesn't work any more
Samuel Thibault
samuel.thibault at ens-lyon.org
Sun Mar 23 21:34:31 UTC 2008
Grmbl, now I'm getting segfaults in aumix... That is because aumix
initializes ncurses first, then gpm, but it happens that patch
013_xterm_mouse_support_000 does this:
+#ifdef HAVE_TERM_H
+ if (setupterm((char *) 0, 1, &terror) == 0 && terror == 1
+ && (mousecap=tigetstr("kmous")) && mousecap != (char *)-1
+ && mousecap[0]) {
+ del_curterm(cur_term);
+#else /* ! HAVE_TERM_H */
if ((term=(char *)getenv("TERM")) && !strncmp(term,"xterm",5)) {
+#endif
if(gpm_tried) return gpm_fd; /* no stack */
gpm_fd=-2;
GPM_XTERM_ON;
gpm_flag=1;
return gpm_fd;
}
+#ifdef HAVE_TERM_H
+ if (cur_term)
+ del_curterm(cur_term);
+#endif /* HAVE_TERM_H */
and that destroys the initialization of ncurses, thus leading to a
segfault later. Initializing gpm first is not so great in the way aumix
is written because it looks like this:
main() {
...
InitScreen();
StartMouse();
...
}
StartMouse() {
Gpm_Open();
mousemask();
}
moving the call to StartMouse before InitScreen would make the
mousemask() call have no effect since ncurses is then not initialized...
libgpm calling del_curterm seems a bit odd to me: will there be side
effects if it leaves cur_term initialized? Won't another call to
setupterm just override what was initialized by libgpm? (from reading
the ncurses source, it looks like it will)
Samuel
More information about the pkg-gpm-devel
mailing list