X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fmsdos.c;h=efcd80205918fd491e3524139bab1884c4fd071f;hp=05948fd9f8ccca1e0373abe93201a92f44604768;hb=3d97e3d9c20a984e70dae5e63e7c5069fb136c91;hpb=50c422d96b6da2c0412b6bd3763e9d1a029a6014 diff --git a/src/msdos.c b/src/msdos.c index 05948fd9..efcd8020 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -741,14 +741,18 @@ int XPending(Display *display) /* mouse button event */ if (mouse_b != last_mouse_b) { - for (i=1; i<4; i<<=1) + for (i=0; i<3; i++) /* check all three mouse buttons */ { - if ((last_mouse_b & i) != (mouse_b & i)) + int bitmask = (1 << i); + + if ((last_mouse_b & bitmask) != (mouse_b & bitmask)) { + int mapping[3] = { 1, 3, 2 }; + pending_events++; xbutton = (XButtonEvent *)&event_buffer[pending_events]; - xbutton->type = (mouse_b & i ? ButtonPress : ButtonRelease); - xbutton->button = i; + xbutton->type = (mouse_b & bitmask ? ButtonPress : ButtonRelease); + xbutton->button = mapping[i]; xbutton->x = mouse_x - display->screens[display->default_screen].x; xbutton->y = mouse_y - display->screens[display->default_screen].y; }