From 91c35b83f5b7ff83c7a609314dcd07cbb8b772f0 Mon Sep 17 00:00:00 2001 From: Tomas Smetana Date: Tue, 28 Aug 2012 16:12:35 +0200 Subject: [PATCH] fix mapping from XInput to the X button mask in the bug #831336 patch --- freeglut-2.8.0-btnmask.patch | 40 ++++++++++++++++++++++++++++++++++++ freeglut.spec | 7 ++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 freeglut-2.8.0-btnmask.patch diff --git a/freeglut-2.8.0-btnmask.patch b/freeglut-2.8.0-btnmask.patch new file mode 100644 index 0000000..0b150d4 --- /dev/null +++ b/freeglut-2.8.0-btnmask.patch @@ -0,0 +1,40 @@ +diff -up freeglut-2.8.0/src/freeglut_xinput.c.btnmask freeglut-2.8.0/src/freeglut_xinput.c +--- freeglut-2.8.0/src/freeglut_xinput.c.btnmask 2012-08-27 15:55:07.841482330 +0200 ++++ freeglut-2.8.0/src/freeglut_xinput.c 2012-08-27 15:57:12.423604612 +0200 +@@ -13,6 +13,9 @@ + #include + #include + ++/* convert the XInput button state mask to the regular X mouse event button mask */ ++#define BUTTON_MASK(xistate) ((xistate) << 8) ++ + /* import function from freeglut_main.c */ + int fghGetXModifiers( int state ); + +@@ -188,7 +191,7 @@ void fgHandleExtensionEvents( XEvent* ba + std_ev.xcrossing.detail = evcross->detail; + std_ev.xcrossing.same_screen = evcross->same_screen; + std_ev.xcrossing.focus = evcross->focus; +- std_ev.xcrossing.state = *(unsigned int*)evcross->buttons.mask; ++ std_ev.xcrossing.state = BUTTON_MASK(*(unsigned int*)evcross->buttons.mask); + + XPutBackEvent(fgDisplay.Display, &std_ev); + break; +@@ -213,7 +216,7 @@ void fgHandleExtensionEvents( XEvent* ba + std_ev.xbutton.y = event->event_y; + std_ev.xbutton.x_root = event->root_x; + std_ev.xbutton.y_root = event->root_y; +- std_ev.xbutton.state = *(unsigned int*)event->buttons.mask; ++ std_ev.xbutton.state = BUTTON_MASK(*(unsigned int*)event->buttons.mask); + std_ev.xbutton.button = event->detail; + + XPutBackEvent(fgDisplay.Display, &std_ev); +@@ -245,7 +248,7 @@ void fgHandleExtensionEvents( XEvent* ba + std_ev.xmotion.y = event->event_y; + std_ev.xmotion.x_root = event->root_x; + std_ev.xmotion.y_root = event->root_y; +- std_ev.xmotion.state = *(unsigned int*)event->buttons.mask; ++ std_ev.xmotion.state = BUTTON_MASK(*(unsigned int*)event->buttons.mask); + std_ev.xmotion.is_hint = NotifyNormal; + + XPutBackEvent(fgDisplay.Display, &std_ev); diff --git a/freeglut.spec b/freeglut.spec index 56fad5e..38f339d 100644 --- a/freeglut.spec +++ b/freeglut.spec @@ -1,7 +1,7 @@ Summary: A freely licensed alternative to the GLUT library Name: freeglut Version: 2.8.0 -Release: 6%{?dist} +Release: 7%{?dist} URL: http://freeglut.sourceforge.net Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz # For the manpages @@ -25,6 +25,7 @@ Patch0: freeglut-2.8.0-fixld.patch # Fix for conflicting types found in GLext Patch1: freeglut-glextconflict.patch Patch2: freeglut-2.8.0-fixXInput.patch +Patch3: freeglut-2.8.0-btnmask.patch %description freeglut is a completely open source alternative to the OpenGL Utility Toolkit @@ -58,6 +59,7 @@ license. %patch0 -p1 -b .fixld %patch1 -p1 -b .fix-glext %patch2 -p1 -b .fixXInput +%patch3 -p1 -b .btnmask %build # --disable-warnings -> don't add -Werror to CFLAGS @@ -91,6 +93,9 @@ install -p -m 644 doc/man/*.3 $RPM_BUILD_ROOT/%{_mandir}/man3 %changelog +* Mon Aug 27 2012 Tomas Smetana - 2.8.0-7 +- fix mapping from XInput to the X button mask in the bug #831336 patch + * Wed Aug 15 2012 Tomas Smetana - 2.8.0-6 - fix #831336: fix broken menus; patch backported from upstream SVN revision 1375 by Manfred Spraul