From 210f1fb3d2bc25dcd409f513c05dcbe2f40b5cb5 Mon Sep 17 00:00:00 2001 From: William McBrine Date: Thu, 30 Mar 2006 02:12:56 +0000 Subject: [PATCH] The event type for the scroll wheel in X is not necessarily ButtonPress, and in fact, seems to be dependent on the last non-scrollwheel button event. So, I've moved the test out of the event switch. I feel a little weird about it, but so far, it works. --- x11/pdcx11.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/x11/pdcx11.c b/x11/pdcx11.c index 15ba19e3..e3d7d3d7 100644 --- a/x11/pdcx11.c +++ b/x11/pdcx11.c @@ -8,7 +8,7 @@ #include #include -RCSID("$Id: pdcx11.c,v 1.57 2006/03/29 20:06:41 wmcbrine Exp $"); +RCSID("$Id: pdcx11.c,v 1.58 2006/03/30 02:12:56 wmcbrine Exp $"); AppData app_data; @@ -2353,30 +2353,29 @@ void XCursesButton(Widget w, XEvent *event, String *params, Cardinal *nparams) Mouse_status.changes = 0; + /* Handle button 4 and 5, which are normally mapped to + the wheel mouse scroll up and down */ + + if ((SP->_trap_mbe & MOUSE_WHEEL_SCROLL) + && (button_no == 4 || button_no == 5)) + { + /* Send the KEY_MOUSE to curses program */ + + memset(&Mouse_status, 0, sizeof(Mouse_status)); + + Mouse_status.changes = (button_no == 5) ? + PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP; + + MOUSE_X_POS = MOUSE_Y_POS = -1; + + XCursesSendKeyToCurses((unsigned long)KEY_MOUSE, + &Mouse_status); + return; + } + switch(event->type) { case ButtonPress: - - /* Handle button 4 and 5, which are normally mapped to - the wheel mouse scroll up and down */ - - if ((SP->_trap_mbe & MOUSE_WHEEL_SCROLL) - && (button_no == 4 || button_no == 5)) - { - /* Send the KEY_MOUSE to curses program */ - - memset(&Mouse_status, 0, sizeof(Mouse_status)); - - Mouse_status.changes = (button_no == 5) ? - PDC_MOUSE_WHEEL_DOWN : PDC_MOUSE_WHEEL_UP; - - MOUSE_X_POS = MOUSE_Y_POS = -1; - - XCursesSendKeyToCurses((unsigned long)KEY_MOUSE, - &Mouse_status); - return; - } - remove_release = False; handle_real_release = False;