summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/input/input_x11.cpp
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
committer Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
commit97b67170277437131adf6ed4d60139c172529e4f (patch)
tree7a5cbf608f191075f1612b1af15832c206a3fe2d /src/osd/modules/input/input_x11.cpp
parentb380514764cf857469bae61c11143a19f79a74c5 (diff)
(nw) Clean up the mess on master
This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release.
Diffstat (limited to 'src/osd/modules/input/input_x11.cpp')
-rw-r--r--src/osd/modules/input/input_x11.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/osd/modules/input/input_x11.cpp b/src/osd/modules/input/input_x11.cpp
index 0762b5ae35d..f7c48a10d87 100644
--- a/src/osd/modules/input/input_x11.cpp
+++ b/src/osd/modules/input/input_x11.cpp
@@ -401,7 +401,23 @@ public:
else if (xevent.type == button_press_type || xevent.type == button_release_type)
{
XDeviceButtonEvent *button = reinterpret_cast<XDeviceButtonEvent *>(&xevent);
- lightgun.buttons[button->button] = (xevent.type == button_press_type) ? 0x80 : 0;
+
+ /*
+ * SDL/X11 Number the buttons 1,2,3, while windows and other parts of MAME
+ * like offscreen_reload expect 0,2,1. Transpose buttons 2 and 3, and then
+ * -1 the button number to align the numbering schemes.
+ */
+ int button_number = button->button;
+ switch (button_number)
+ {
+ case 2:
+ button_number = 3;
+ break;
+ case 3:
+ button_number = 2;
+ break;
+ }
+ lightgun.buttons[button_number - 1] = (xevent.type == button_press_type) ? 0x80 : 0;
}
}