diff -uprN grx248.old/include/grx20.h grx248/include/grx20.h --- grx248.old/include/grx20.h 2011-11-18 20:00:32 +0000 +++ grx248/include/grx20.h 2011-11-23 17:02:19 +0000 @@ -1424,13 +1424,19 @@ void GrMoveCursor(GrCursor *cursor,int x #define GR_M_RIGHT_UP 0x010 #define GR_M_MIDDLE_DOWN 0x020 #define GR_M_MIDDLE_UP 0x040 -#define GR_M_BUTTON_DOWN (GR_M_LEFT_DOWN | GR_M_MIDDLE_DOWN | GR_M_RIGHT_DOWN) -#define GR_M_BUTTON_UP (GR_M_LEFT_UP | GR_M_MIDDLE_UP | GR_M_RIGHT_UP) +#define GR_M_P4_DOWN 0x400 +#define GR_M_P4_UP 0x800 +#define GR_M_P5_DOWN 0x2000 +#define GR_M_P5_UP 0x4000 +#define GR_M_BUTTON_DOWN (GR_M_LEFT_DOWN | GR_M_MIDDLE_DOWN | GR_M_RIGHT_DOWN | GR_M_P4_DOWN | GR_M_P5_DOWN) +#define GR_M_BUTTON_UP (GR_M_LEFT_UP | GR_M_MIDDLE_UP | GR_M_RIGHT_UP | GR_M_P4_UP | GR_M_P5_UP) #define GR_M_BUTTON_CHANGE (GR_M_BUTTON_UP | GR_M_BUTTON_DOWN ) -#define GR_M_LEFT 1 /* mouse button index bits */ -#define GR_M_RIGHT 2 -#define GR_M_MIDDLE 4 +#define GR_M_LEFT 0x01 /* mouse button index bits */ +#define GR_M_RIGHT 0x02 +#define GR_M_MIDDLE 0x04 +#define GR_M_P4 0x08 +#define GR_M_P5 0x10 #define GR_M_KEYPRESS 0x080 /* other event flag bits */ #define GR_M_POLL 0x100 diff -uprN grx248.old/src/mouse/dosinput.c grx248/src/mouse/dosinput.c --- grx248.old/src/mouse/dosinput.c 2001-03-23 03:49:10 +0000 +++ grx248/src/mouse/dosinput.c 2011-11-23 17:17:16 +0000 @@ -141,6 +141,8 @@ void _GrUpdateInputs(void) GR_M_LEFT, GR_M_MIDDLE, GR_M_RIGHT, + GR_M_P4, + GR_M_P5, GrKeyStat() ); real_dtime(ev.dtime,evt_lasttime); @@ -188,6 +190,8 @@ void GrMouseGetEventT(int flags,GrMouseE GR_M_LEFT, GR_M_MIDDLE, GR_M_RIGHT, + GR_M_P4, + GR_M_P5, GrKeyStat() ); if ( ev->flags ) /* something happend */ diff -uprN grx248.old/src/mouse/input.h grx248/src/mouse/input.h --- grx248.old/src/mouse/input.h 2011-09-20 13:14:56 +0000 +++ grx248/src/mouse/input.h 2011-11-23 22:16:41 +0000 @@ -32,7 +32,7 @@ } \ } while(0) -#define fill_mouse_ev(EV,OLDBT,NEWBT,LB,MB,RB,KBSTAT) do { \ +#define fill_mouse_ev(EV,OLDBT,NEWBT,LB,MB,RB,P4,P5,KBSTAT) do { \ int bdown = NEWBT & (~OLDBT); \ int btnup = OLDBT & (~NEWBT); \ EV.flags = MOUINFO->moved ? GR_M_MOTION : 0; \ @@ -44,12 +44,18 @@ if(NEWBT & LB) EV.buttons |= GR_M_LEFT; \ if(NEWBT & MB) EV.buttons |= GR_M_MIDDLE; \ if(NEWBT & RB) EV.buttons |= GR_M_RIGHT; \ + if(NEWBT & P4) EV.buttons |= GR_M_P4; \ + if(NEWBT & P5) EV.buttons |= GR_M_P5; \ if(bdown & LB) EV.flags |= GR_M_LEFT_DOWN; \ if(bdown & MB) EV.flags |= GR_M_MIDDLE_DOWN; \ if(bdown & RB) EV.flags |= GR_M_RIGHT_DOWN; \ + if(bdown & P4) EV.flags |= GR_M_P4_DOWN; \ + if(bdown & P5) EV.flags |= GR_M_P5_DOWN; \ if(btnup & LB) EV.flags |= GR_M_LEFT_UP; \ if(btnup & MB) EV.flags |= GR_M_MIDDLE_UP; \ - if(btnup & RB) EV.flags |= GR_M_RIGHT_UP; \ + if(btnup & RB) EV.flags |= GR_M_RIGHT_UP; \ + if(btnup & P4) EV.flags |= GR_M_P4_UP; \ + if(btnup & P5) EV.flags |= GR_M_P5_UP; \ } while(0) #define fill_keybd_ev(EV,KEY,KBSTAT) do { \ diff -uprN grx248.old/src/mouse/lnxinpu2.c grx248/src/mouse/lnxinpu2.c --- grx248.old/src/mouse/lnxinpu2.c 2003-03-11 23:31:38 +0000 +++ grx248/src/mouse/lnxinpu2.c 2011-11-24 19:53:20 +0000 @@ -374,6 +374,8 @@ int _GrReadCharFromKeyboard(void) #define PS2_LEFTBUTTON 1 #define PS2_MIDDLEBUTTON 4 #define PS2_RIGHTBUTTON 2 +#define PS2_FOURTHBUTTON 8 +#define PS2_FIFTHBUTTON 16 static int mou_filedsc; static int mou_buttons; @@ -509,7 +511,8 @@ void _GrUpdateInputs(void) fill_mouse_ev(ev, mou_buttons, mb, PS2_LEFTBUTTON, - PS2_MIDDLEBUTTON, PS2_RIGHTBUTTON, 0); + PS2_MIDDLEBUTTON, PS2_RIGHTBUTTON, + PS2_FOURTHBUTTON, PS2_FIFTHBUTTON, 0); real_dtime(ev.dtime, evt_lasttime); enqueue_event(ev); MOUINFO->moved = FALSE; @@ -558,7 +561,8 @@ void GrMouseGetEventT(int flags, GrMouse fill_mouse_ev((*ev), mou_buttons, mou_buttons, PS2_LEFTBUTTON, - PS2_MIDDLEBUTTON, PS2_RIGHTBUTTON, 0); + PS2_MIDDLEBUTTON, PS2_RIGHTBUTTON, + PS2_FOURTHBUTTON, PS2_FIFTHBUTTON, 0); if (ev->flags) /* something happend */ real_dtime(ev->dtime, evt_lasttime); else diff -uprN grx248.old/src/mouse/lnxinput.c grx248/src/mouse/lnxinput.c --- grx248.old/src/mouse/lnxinput.c 2002-01-08 23:11:54 +0000 +++ grx248/src/mouse/lnxinput.c 2011-11-24 18:51:09 +0000 @@ -435,6 +435,8 @@ void _GrUpdateInputs(void) MOUSE_LEFTBUTTON, MOUSE_MIDDLEBUTTON, MOUSE_RIGHTBUTTON, + MOUSE_FOURTHBUTTON, + MOUSE_FIFTHBUTTON, 0 ); real_dtime(ev.dtime,evt_lasttime); @@ -484,6 +486,8 @@ void GrMouseGetEventT(int flags,GrMouseE MOUSE_LEFTBUTTON, MOUSE_MIDDLEBUTTON, MOUSE_RIGHTBUTTON, + MOUSE_FOURTHBUTTON, + MOUSE_FIFTHBUTTON, 0 ); if ( ev->flags ) /* something happend */ diff -uprN grx248.old/src/mouse/sdlinp.c grx248/src/mouse/sdlinp.c --- grx248.old/src/mouse/sdlinp.c 2007-03-19 10:34:16 +0000 +++ grx248/src/mouse/sdlinp.c 2011-11-24 11:04:46 +0000 @@ -148,7 +148,7 @@ void GrMouseGetEventT(int flags, GrMouse (tout == 0L) || (MOUINFO->moved && (flags & GR_M_MOTION))) { fill_mouse_ev((*ev), mou_buttons, mou_buttons, - GR_M_LEFT, GR_M_MIDDLE, GR_M_RIGHT, GrKeyStat()); + GR_M_LEFT, GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, GrKeyStat()); if (ev->flags) /* something happend */ real_dtime(ev->dtime, evt_lasttime); else @@ -241,10 +241,12 @@ static int DequeueSDLEvent(GrMouseEvent case SDL_BUTTON_LEFT : buttons = GR_M_LEFT | mou_buttons; break; case SDL_BUTTON_RIGHT : buttons = GR_M_RIGHT | mou_buttons; break; case SDL_BUTTON_MIDDLE : buttons = GR_M_MIDDLE | mou_buttons; break; + case SDL_BUTTON_WHEELUP: buttons = GR_M_P4 | mou_buttons; break; + case SDL_BUTTON_WHEELDOWN : buttons = GR_M_P5 | mou_buttons; break; default : return(-1); } fill_mouse_ev((*ev), mou_buttons, buttons, GR_M_LEFT, - GR_M_MIDDLE, GR_M_RIGHT, GrKeyStat()); + GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, GrKeyStat()); mou_buttons = buttons; MOUINFO->moved = FALSE; return(1); @@ -254,10 +256,12 @@ static int DequeueSDLEvent(GrMouseEvent case SDL_BUTTON_LEFT : buttons = ~GR_M_LEFT & mou_buttons; break; case SDL_BUTTON_RIGHT : buttons = ~GR_M_RIGHT & mou_buttons; break; case SDL_BUTTON_MIDDLE : buttons = ~GR_M_MIDDLE & mou_buttons; break; + case SDL_BUTTON_WHEELUP: buttons = ~GR_M_P4 & mou_buttons; break; + case SDL_BUTTON_WHEELDOWN : buttons = ~GR_M_P5 & mou_buttons; break; default : return(-1); } fill_mouse_ev((*ev), mou_buttons, buttons, GR_M_LEFT, - GR_M_MIDDLE, GR_M_RIGHT, GrKeyStat()); + GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, GrKeyStat()); mou_buttons = buttons; MOUINFO->moved = FALSE; return(1); diff -uprN grx248.old/src/mouse/w32inp.c grx248/src/mouse/w32inp.c --- grx248.old/src/mouse/w32inp.c 2011-10-18 19:07:16 +0000 +++ grx248/src/mouse/w32inp.c 2011-11-24 11:35:29 +0000 @@ -183,7 +183,7 @@ void GrMouseGetEventT(int flags, GrMouse (tout == 0L) || (MOUINFO->moved && (flags & GR_M_MOTION))) { fill_mouse_ev((*ev), mou_buttons, mou_buttons, - GR_M_LEFT, GR_M_MIDDLE, GR_M_RIGHT, kbd_lastmod); + GR_M_LEFT, GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, kbd_lastmod); if (ev->flags) /* something happend */ real_dtime(ev->dtime, evt_lasttime); else @@ -283,7 +283,7 @@ static int DequeueW32Event(GrMouseEvent MOUINFO->xpos = LOWORD(evaux.lParam); MOUINFO->ypos = HIWORD(evaux.lParam); fill_mouse_ev((*ev), mou_buttons, buttons, GR_M_LEFT, - GR_M_MIDDLE, GR_M_RIGHT, evaux.kbstat); + GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, evaux.kbstat); mou_buttons = buttons; MOUINFO->moved = FALSE; kbd_lastmod = evaux.kbstat; @@ -294,7 +294,7 @@ static int DequeueW32Event(GrMouseEvent MOUINFO->xpos = LOWORD(evaux.lParam); MOUINFO->ypos = HIWORD(evaux.lParam); fill_mouse_ev((*ev), mou_buttons, buttons, GR_M_LEFT, - GR_M_MIDDLE, GR_M_RIGHT, evaux.kbstat); + GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, evaux.kbstat); mou_buttons = buttons; MOUINFO->moved = FALSE; kbd_lastmod = evaux.kbstat; @@ -305,7 +305,7 @@ static int DequeueW32Event(GrMouseEvent MOUINFO->xpos = LOWORD(evaux.lParam); MOUINFO->ypos = HIWORD(evaux.lParam); fill_mouse_ev((*ev), mou_buttons, buttons, GR_M_LEFT, - GR_M_MIDDLE, GR_M_RIGHT, evaux.kbstat); + GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, evaux.kbstat); mou_buttons = buttons; MOUINFO->moved = FALSE; kbd_lastmod = evaux.kbstat; @@ -316,7 +316,7 @@ static int DequeueW32Event(GrMouseEvent MOUINFO->xpos = LOWORD(evaux.lParam); MOUINFO->ypos = HIWORD(evaux.lParam); fill_mouse_ev((*ev), mou_buttons, buttons, GR_M_LEFT, - GR_M_MIDDLE, GR_M_RIGHT, evaux.kbstat); + GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, evaux.kbstat); mou_buttons = buttons; MOUINFO->moved = FALSE; kbd_lastmod = evaux.kbstat; @@ -327,7 +327,7 @@ static int DequeueW32Event(GrMouseEvent MOUINFO->xpos = LOWORD(evaux.lParam); MOUINFO->ypos = HIWORD(evaux.lParam); fill_mouse_ev((*ev), mou_buttons, buttons, GR_M_LEFT, - GR_M_MIDDLE, GR_M_RIGHT, evaux.kbstat); + GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, evaux.kbstat); mou_buttons = buttons; MOUINFO->moved = FALSE; kbd_lastmod = evaux.kbstat; @@ -338,7 +338,19 @@ static int DequeueW32Event(GrMouseEvent MOUINFO->xpos = LOWORD(evaux.lParam); MOUINFO->ypos = HIWORD(evaux.lParam); fill_mouse_ev((*ev), mou_buttons, buttons, GR_M_LEFT, - GR_M_MIDDLE, GR_M_RIGHT, evaux.kbstat); + GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, evaux.kbstat); + mou_buttons = buttons; + MOUINFO->moved = FALSE; + kbd_lastmod = evaux.kbstat; + return 1; + + case WM_MOUSEWHEEL: + buttons = mou_buttons ^ (((short)HIWORD(evaux.wParam) > 0) ? + GR_M_P4 : GR_M_P5); + MOUINFO->xpos = LOWORD(evaux.lParam); + MOUINFO->ypos = HIWORD(evaux.lParam); + fill_mouse_ev((*ev), mou_buttons, buttons, GR_M_LEFT, + GR_M_MIDDLE, GR_M_RIGHT, GR_M_P4, GR_M_P5, evaux.kbstat); mou_buttons = buttons; MOUINFO->moved = FALSE; kbd_lastmod = evaux.kbstat; diff -uprN grx248.old/src/mouse/xwininp.c grx248/src/mouse/xwininp.c --- grx248.old/src/mouse/xwininp.c 2011-09-20 13:15:08 +0000 +++ grx248/src/mouse/xwininp.c 2011-11-23 21:40:31 +0000 @@ -496,6 +496,8 @@ unsigned int _XButtonEventToGrButton (XB case Button1: mask = Button1Mask; break; case Button2: mask = Button2Mask; break; case Button3: mask = Button3Mask; break; + case Button4: mask = Button4Mask; break; + case Button5: mask = Button5Mask; break; } switch (event->type) { case ButtonPress: state |= mask; break; @@ -503,7 +505,9 @@ unsigned int _XButtonEventToGrButton (XB } return ( ((state & Button1Mask) ? GR_M_LEFT : 0) | ((state & Button2Mask) ? GR_M_MIDDLE : 0) - | ((state & Button3Mask) ? GR_M_RIGHT : 0)); + | ((state & Button3Mask) ? GR_M_RIGHT : 0) + | ((state & Button4Mask) ? GR_M_P4 : 0) + | ((state & Button5Mask) ? GR_M_P5 : 0)); } static INLINE @@ -604,6 +608,8 @@ void _GrUpdateInputs(void) GR_M_LEFT, GR_M_MIDDLE, GR_M_RIGHT, + GR_M_P4, + GR_M_P5, kbd_lastmod ); if (evt_lasttime_ok) @@ -705,6 +711,8 @@ void GrMouseGetEventT(int flags,GrMouseE GR_M_LEFT, GR_M_MIDDLE, GR_M_RIGHT, + GR_M_P4, + GR_M_P5, kbd_lastmod ); if ( ev->flags ) { diff -uprN grx248.old/src/vdrivers/vd_win32.c grx248/src/vdrivers/vd_win32.c --- grx248.old/src/vdrivers/vd_win32.c 2011-11-24 20:41:41 +0000 +++ grx248/src/vdrivers/vd_win32.c 2011-11-24 11:16:57 +0000 @@ -631,6 +631,16 @@ static LRESULT CALLBACK WndProc(HWND hWn } return 0; + case WM_MOUSEWHEEL: + { + kbstat = convertwin32keystate(); + /* twice to simulate down up */ + EnqueueW32Event(uMsg, wParam, lParam, kbstat); + EnqueueW32Event(uMsg, wParam, lParam, kbstat); + } + return 0; + + case WM_PAINT: { HDC hDC; diff -uprN grx248.old/test/mousetst.c grx248/test/mousetst.c --- grx248.old/test/mousetst.c 2007-08-02 17:07:58 +0000 +++ grx248/test/mousetst.c 2011-11-24 11:36:59 +0000 @@ -56,9 +56,13 @@ TESTFUNC(mousetest) if(evt.flags & GR_M_LEFT_DOWN) strcpy( mend,"[left down] "); if(evt.flags & GR_M_MIDDLE_DOWN) strcpy( mend,"[middle down] "); if(evt.flags & GR_M_RIGHT_DOWN) strcpy( mend,"[right down] "); + if(evt.flags & GR_M_P4_DOWN) strcpy( mend,"[p4 down] "); + if(evt.flags & GR_M_P5_DOWN) strcpy( mend,"[p5 down] "); if(evt.flags & GR_M_LEFT_UP) strcpy( mend,"[left up] "); if(evt.flags & GR_M_MIDDLE_UP) strcpy( mend,"[middle up] "); - if(evt.flags & GR_M_RIGHT_UP) strcpy( mend,"[right up] "); + if(evt.flags & GR_M_RIGHT_UP) strcpy( mend,"[right up] "); + if(evt.flags & GR_M_P4_UP) strcpy( mend,"[p4 up] "); + if(evt.flags & GR_M_P5_UP) strcpy( mend,"[p5 up] "); if(evt.flags & GR_M_KEYPRESS) sprintf(mend,"[key (0x%03x)] ",evt.key); sprintf(mend,"at X=%d, Y=%d, ",evt.x,evt.y); sprintf(mend,