Bug 233488 - attempt to use mouse with ncurses inside screen causes erratic behavior
attempt to use mouse with ncurses inside screen causes erratic behavior
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: gpm (Show other bugs)
6
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tomas Janousek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-22 14:46 EDT by Gabriel Somlo
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version: gpm-1.20.1-81.fc6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-03-23 12:36:30 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Gabriel Somlo 2007-03-22 14:46:14 EDT
Description of problem:

programs using the mouse click feature of ncurses act crazy when run from
within /usr/bin/screen. When mousemask() is used after initscr() in a
ncurses-based program, getch() will go crazy. See example code below.

Version-Release number of selected component (if applicable):

ncurses-5.5-24.20060715
ncurses-devel-5.5-24.20060715
screen-4.0.3-2.fc6

How reproducible:

by compiling and executing the following example code (cursebug.c):

#include <stdio.h>
#include <ncurses.h>

int main(int argc, char **argv) {

    initscr();

    mousemask(BUTTON1_PRESSED | BUTTON1_CLICKED, NULL);

    halfdelay(10);

    for (;;) {
        int key = getch();
        switch (key) {
            case 'q':
            case 'Q':
                return 0;
            case KEY_MOUSE:
                fprintf(stderr, "Mouse Click.\n");
                break;
            default:
                fprintf(stderr, "default: key = %d\n", key);
                break;
        }
    }

    endwin();

    return 0;
}

Steps to Reproduce:
1. compile code: gcc -o cursebug cursebug.c -Wall -lncurses
2. in a window, start screen: /usr/bin/screen
3. then, start example from within screen: ./cursebug 2>cursebug.log
3. in a separate window, view log: tail -f cursebug.log
  
Actual results:

getch() returns -1 in a very tight loop

Expected results:

getch() should return -1 once every second (as per halfdelay(10)), and
actual key presses and mouse clicks when entered. This works fine when
example is run directly from console or an xterm, but not from within
screen.

Additional info:
Comment 1 Miroslav Lichvar 2007-03-23 11:17:24 EDT
Thanks for the report, looks like a gpm problem.
Comment 2 Tomas Janousek 2007-03-23 12:36:30 EDT
A gpm prob indeed. I broke it with the deadsocket patch. There was a better way
to do it and I hope I took the One this time. Should be fixed in the upcoming
update. You can try out the rawhide srpm in the meantime, it's equivalent.
Comment 3 Fedora Update System 2007-03-23 18:16:41 EDT
gpm-1.20.1-81.fc6 has been pushed for fc6, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.
Comment 4 Fedora Update System 2007-03-23 18:17:38 EDT
gpm-1.20.1-81.fc5 has been pushed for fc5, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.
Comment 5 Gabriel Somlo 2007-03-27 14:01:24 EDT
sorry for taking this long to respond -- just for the record, gpm-1.20.1-81.fc6
does indeed fix the problem. Thanks !

Note You need to log in before you can comment on or make changes to this bug.