summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-06-25 10:38:27 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-06-25 16:16:14 +1000
commitfdeb127e4015a5800cab1b9b7313a78d56866c7b (patch)
tree0bb245fc918d6d231a469402687d30eba703f2a4
parent2b4391a20f8725018de20cab1da30a2da8f65c42 (diff)
Xlib13 XGrabButton: don't overrun the number of buttons configured.
NS_button contains the static button mappings (for whatever reason). Don't try to access it nbuttons() time because that will return the number of buttons configured on the device (usually 12). Instead, use the size of the array we're traversing through. Aside from running OOB on an array being considered impolite, it also gives us BadValue when trying to XTestFakeButtonEvent a Button 0, which the test suite doesn't like. Fixes UNRESOLVED on test case 10/39. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--xts5/Xlib13/XGrabButton.m5
1 files changed, 3 insertions, 2 deletions
diff --git a/xts5/Xlib13/XGrabButton.m b/xts5/Xlib13/XGrabButton.m
index 8bf89eb9..dac8535f 100644
--- a/xts5/Xlib13/XGrabButton.m
+++ b/xts5/Xlib13/XGrabButton.m
@@ -852,6 +852,7 @@ else
Report untested.
>>CODE
extern struct valname S_button[];
+extern int NS_button;
int i;
button = AnyButton;
@@ -865,7 +866,7 @@ int i;
(void) warppointer(display, grab_window, 10, 10);
- for (i = 0; i < nbuttons(); i++) {
+ for (i = 0; i < NS_button; i++) {
buttonpress(display, (unsigned int)S_button[i].val);
if (pgrabbed())
CHECK;
@@ -886,7 +887,7 @@ int i;
CHECK;
}
- CHECKPASS(1+2*nbuttons());
+ CHECKPASS(1+2*NS_button);
>>ASSERTION Good B 3
It is not required that the specified button currently be assigned
to a physical button.