touch support seems broken since qt4-x11-4.8.1
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
qt4-x11 (Ubuntu) |
Triaged
|
Medium
|
Unassigned |
Bug Description
I found that touch examples of QT (under /usr/lib/
Then I download the source code of qt4-x11 by 'apt-get source' and debug it. I found that there may be a mistake in file "debian/
702 + QApplicationPri
703 +
704 + for (int k = 0; k < devices[
705 + XIAnyClassInfo *xiclassinfo = devices[
706 + if (xiclassinfo->type == XITouchClass) {
......
712 + } else if (xiclassinfo->type == XIValuatorClass) {
713 + XIValuatorClassInfo *v = (XIValuatorClas
714 + tdi.numValuators++;
......
728 + if (is_touch)
729 + touchDevices[
Thease codes is the initialization of `touchDevices', note that `tdi' is allocated from stack without any initialization, the initial value of `tdi.numValuators' is uncertain. Its value is always a negative number on my machine, even after couples of post increase(line 714).
Trouble comes when program reaches to function `QETWidget:
562 + double *values = dev->valuators.
563 + for (int i = 0; i < qMin(dev-
......
617 + }
As I mentioned earlier, `tdi.numValuators' is always a negative number, program *never* will enter this `for' loop. As a result, application cannot get any touch properties except tracking ID. That is the trouble.
I add a initializint statement for `tdi.numValuators':
702 + QApplicationPri
703 + tdi.numValuators = 0;
The problem is solved.
Finally, I try to figure out the different between qt4-x11-4.7.4 and qt4-x11-4.8.1. Look this commit http://
@@ -699,17 +682,20 @@
+ for (int i = 0; i < count; ++i) {
+ if (!devices[
+ continue;
++
++ bool is_touch = false;
++ QApplicationPri
++
+ for (int k = 0; k < devices[
+ XIAnyClassInfo *xiclassinfo = devices[
+ if (xiclassinfo->type == XITouchClass) {
++ is_touch = true;
+ XITouchClassInfo *t = (XITouchClassInfo *)xiclassinfo;
-+ QApplicationPri
+ tdi.deviceid = devices[
+ tdi.directTouch = t->mode == XIDirectTouch;
+ tdi.maxTouches = t->num_touches;
-+ } else if (xiclassinfo->type == XITouchValuator
-+ XITouchValuator
-+ QApplicationPri
++ } else if (xiclassinfo->type == XIValuatorClass) {
++ XIValuatorClassInfo *v = (XIValuatorClas
+ tdi.numValuators++;
+ if (v->label == ATOM(XAbsMTTouc
+ copy(tdi.
In the older version, `tdi' is create by `QHash::operator[]' implicitly, which is allocated from heap directly, memory in heep may be clear than stack I think. Anyway, adding a default constructor for struct TouchDeviceInfo should be a beter solution.
Changed in qt4-x11 (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Medium |
After 4 years, we still got a customer complain about the touch event unavailable on QT-4.8.x today, could anyone please focus on this issue and get it fix? Or some one tough me what I can do for this?