Merge lp:~chasedouglas/geis/v1-device-add-subscribe-fix into lp:geis
Proposed by
Chase Douglas
Status: | Merged |
---|---|
Merged at revision: | 273 |
Proposed branch: | lp:~chasedouglas/geis/v1-device-add-subscribe-fix |
Merge into: | lp:geis |
Prerequisite: | lp:~chasedouglas/geis/v1-device-add-subscribe-test |
Diff against target: |
28 lines (+10/-7) 1 file modified
libutouch-geis/geis_v1.c (+10/-7) |
To merge this branch: | bzr merge lp:~chasedouglas/geis/v1-device-add-subscribe-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stephen M. Webb (community) | Approve | ||
Chase Douglas (community) | Needs Resubmitting | ||
Review via email: mp+109414@code.launchpad.net |
Description of the change
Fix for lp:1009270: Unity fails to use multitouch gestures if magic touchpad is connected after Unity has launched.
To post a comment you must log in.
I ran into a race condition in the test case that caused this change to repeatedly fail. I modified the test case as follows and the test case passed.
The fix itself looks like it should do the right thing, #803408 notwithstanding, and when used with GEIS_DEBUG=3 produces the expected debug output.
=== modified file 'testsuite/ geis1/gtest_ devices. cpp' geis1/gtest_ devices. cpp 2012-06-08 18:10:30 +0000 geis1/gtest_ devices. cpp 2012-06-14 18:31:09 +0000 GeisGestureType type, GeisGestureId id, GeisSize count,
GeisGestureAtt r* attrs);
--- testsuite/
+++ testsuite/
@@ -25,7 +25,12 @@
void GestureUpdate(
+ void CreateNewDevice(); ptr<Testsuite: :EvemuDevice> new_device_;
+
+ void UseNewDevice();
+
protected:
+ std::unique_
bool saw_events_;
};
@@ -42,6 +47,11 @@
GeisSize count, GeisGestureAttr* attrs) {
}
+void device_ callback( void* cookie, GeisInputDeviceId deviceId, void* attrs) { cast<Geis1Devic eTests* >(cookie) ; >UseNewDevice( );
+ Geis1DeviceTests* fixture = reinterpret_
+ fixture-
+}
+
} // namespace
void Geis1DeviceTest s::GestureUpdat e(GeisGestureTy pe type, GeisGestureId id,
@@ -50,6 +60,14 @@
saw_events_ = true;
}
+void Geis1DeviceTest s::CreateNewDev ice() { .reset( new Testsuite: :EvemuDevice( TEST_DEVICE_ PROP_FILE) ); s::UseNewDevice () { ->play( TEST_DEVICE_ EVENTS_ FILE); Geis1DeviceTest s, addDeviceSubscr iption) ptr<Testsuite: :EvemuDevice> new_device; has_been_ created = GEIS_FALSE; events_ received = GEIS_FALSE;
+ new_device_
+}
+
+void Geis1DeviceTest
+ new_device_
+}
+
/*
* Test case for lp:1009270 -- Geis v1 does not report gestures for new devices
*
@@ -58,9 +76,6 @@
*/
TEST_F(
{
- std::unique_
- GeisBoolean device_
- GeisBoolean gesture_
static const char* gestures[] = null_func,
{
@@ -76,13 +91,19 @@
&gesture_
};
+ static GeisInputFuncs inputfuncs = { EQ(GEIS_ STATUS_ SUCCESS, geis_input_ devices( geis(), &inputfuncs, this)); EQ(GEIS_ STATUS_ SUCCESS,
geis_ subscribe( geis(), GEIS_ALL_ INPUT_DEVICES, gestures, &callbacks,
this));
+ &device_callback,
+ &device_callback,
+ &device_callback
+ };
+
+ ASSERT_
+
ASSERT_
- new_device. reset(new Testsuite: :EvemuDevice( TEST_DEVICE_ PROP_FILE) ); >play(TEST_ DEVICE_ EVENTS_ FILE);
- sleep(1);
- new_device-
+ CreateNewDevice();
while (1) {
fd_set read_fds;