fix mapping from XInput to the X button mask in the bug #831336 patch

This commit is contained in:
Tomas Smetana 2012-08-28 16:12:35 +02:00
parent 3de3137d55
commit 91c35b83f5
2 changed files with 46 additions and 1 deletions

View File

@ -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 <X11/Xlib.h>
#include <X11/extensions/XInput2.h>
+/* 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);

View File

@ -1,7 +1,7 @@
Summary: A freely licensed alternative to the GLUT library Summary: A freely licensed alternative to the GLUT library
Name: freeglut Name: freeglut
Version: 2.8.0 Version: 2.8.0
Release: 6%{?dist} Release: 7%{?dist}
URL: http://freeglut.sourceforge.net URL: http://freeglut.sourceforge.net
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
# For the manpages # For the manpages
@ -25,6 +25,7 @@ Patch0: freeglut-2.8.0-fixld.patch
# Fix for conflicting types found in GLext # Fix for conflicting types found in GLext
Patch1: freeglut-glextconflict.patch Patch1: freeglut-glextconflict.patch
Patch2: freeglut-2.8.0-fixXInput.patch Patch2: freeglut-2.8.0-fixXInput.patch
Patch3: freeglut-2.8.0-btnmask.patch
%description %description
freeglut is a completely open source alternative to the OpenGL Utility Toolkit freeglut is a completely open source alternative to the OpenGL Utility Toolkit
@ -58,6 +59,7 @@ license.
%patch0 -p1 -b .fixld %patch0 -p1 -b .fixld
%patch1 -p1 -b .fix-glext %patch1 -p1 -b .fix-glext
%patch2 -p1 -b .fixXInput %patch2 -p1 -b .fixXInput
%patch3 -p1 -b .btnmask
%build %build
# --disable-warnings -> don't add -Werror to CFLAGS # --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 %changelog
* Mon Aug 27 2012 Tomas Smetana <tsmetana@redhat.com> - 2.8.0-7
- fix mapping from XInput to the X button mask in the bug #831336 patch
* Wed Aug 15 2012 Tomas Smetana <tsmetana@redhat.com> - 2.8.0-6 * Wed Aug 15 2012 Tomas Smetana <tsmetana@redhat.com> - 2.8.0-6
- fix #831336: fix broken menus; patch backported from upstream SVN revision - fix #831336: fix broken menus; patch backported from upstream SVN revision
1375 by Manfred Spraul 1375 by Manfred Spraul