Commit 72c69cfc60d6b762415828930a63e485aa00185f

  • avatar
  • Peter Hutterer <peter.hutterer @wh…t.net> (Committer)
  • Thu Dec 24 00:01:05 CET 2009
  • avatar
  • Ping Cheng <pingc @wa…m.com> (Author)
  • Wed Dec 23 02:48:09 CET 2009
Add local maxX, maxY, resolX, and resolY

Instead of switching maximum and resolution back and forth between
touch and penabled devices globally, we define them into WacomDevice.
The values are initialized in xf86WcmInitialToolSize once and used
through out the life of the device.

Signed-off-by: Ping Cheng <pinglinux@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  
18801880
18811881 DBG(10, priv, "\n");
18821882
1883 if (!IsTouch(priv))
1884 {
1885 oldMaxX = common->wcmMaxX;
1886 oldMaxY = common->wcmMaxY;
1887 }
1888 else
1889 {
1890 oldMaxX = common->wcmMaxTouchX;
1891 oldMaxY = common->wcmMaxTouchY;
1892 }
1883 oldMaxX = priv->maxX;
1884 oldMaxY = priv->maxY;
18931885
18941886 tmpTopX = priv->topX;
18951887 tmpBottomX = priv->bottomX;
18901890
18911891 if (common->wcmRotate == ROTATE_CW || common->wcmRotate == ROTATE_CCW)
18921892 {
1893 if (!IsTouch(priv))
1894 {
1895 common->wcmMaxX = oldMaxY;
1896 common->wcmMaxY = oldMaxX;
1897 }
1898 else
1899 {
1900 common->wcmMaxTouchX = oldMaxY;
1901 common->wcmMaxTouchY = oldMaxX;
1902 }
1893 priv->maxX = oldMaxY;
1894 priv->maxY = oldMaxX;
19031895 }
19041896
19051897 switch (common->wcmRotate) {
19531953 /* rotate all devices at once! else they get misaligned */
19541954 for (tmppriv = common->wcmDevices; tmppriv; tmppriv = tmppriv->next)
19551955 {
1956 if (!IsTouch(priv))
1957 {
1958 oldMaxX = common->wcmMaxX;
1959 oldMaxY = common->wcmMaxY;
1960 }
1961 else
1962 {
1963 oldMaxX = common->wcmMaxTouchX;
1964 oldMaxY = common->wcmMaxTouchY;
1965 }
1956 oldMaxX = priv->maxX;
1957 oldMaxY = priv->maxY;
19661958
19671959 if (oldRotation == ROTATE_CW || oldRotation == ROTATE_CCW)
19681960 {
1969 if (!IsTouch(priv))
1970 {
1971 common->wcmMaxX = oldMaxY;
1972 common->wcmMaxY = oldMaxX;
1973 }
1974 else
1975 {
1976 common->wcmMaxTouchX = oldMaxY;
1977 common->wcmMaxTouchY = oldMaxX;
1978 }
1961 priv->maxX = oldMaxY;
1962 priv->maxY = oldMaxX;
19791963 }
19801964
19811965 tmpTopX = tmppriv->topX;
  
345345 {
346346 values[0] = 0;
347347 values[1] = 0;
348 if (!IsTouch(priv))
349 values[2] = common->wcmMaxX;
350 else
351 values[2] = common->wcmMaxTouchX;
352 if (!IsTouch(priv))
353 values[3] = common->wcmMaxY;
354 else
355 values[3] = common->wcmMaxTouchY;
348 values[2] = priv->maxX;
349 values[3] = priv->maxY;
356350 }
357351
358352 priv->topX = area->topX = values[0];
  
146146 WacomToolAreaPtr area = priv->toolarea, inlist;
147147 WacomCommonPtr common = priv->common;
148148 double screenRatio, tabletRatio;
149 int bottomx = common->wcmMaxX, bottomy = common->wcmMaxY;
149 int bottomx = priv->maxX, bottomy = priv->maxY;
150150
151151 DBG(10, priv, "\n");
152152
153 if (IsTouch(priv))
154 {
155 bottomx = common->wcmMaxTouchX;
156 bottomy = common->wcmMaxTouchY;
157 }
158
159153 /* Verify Box */
160154 if (priv->topX > bottomx)
161155 {
342342 WacomDevicePtr priv = (WacomDevicePtr)local->private;
343343 WacomCommonPtr common = priv->common;
344344 int topx = 0, topy = 0, resolution;
345 int bottomx = common->wcmMaxX, bottomy = common->wcmMaxY;
345 int bottomx = priv->maxX, bottomy = priv->maxY;
346346#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
347347 Atom label;
348348#endif
349 if (IsTouch(priv))
350 {
351 bottomx = common->wcmMaxTouchX;
352 bottomy = common->wcmMaxTouchY;
353 }
354349
355350 xf86WcmMappingFactor(local);
356351
368368#endif
369369 }
370370
371 if (!IsTouch(priv))
372 resolution = common->wcmResolX;
373 else
374 resolution = common->wcmTouchResolX;
371 resolution = priv->resolX;
375372 if (common->wcmScaling)
376373 {
377374 /* In case xf86WcmDevConvert didn't get called */
402402#endif
403403 }
404404
405 if (!IsTouch(priv))
406 resolution = common->wcmResolY;
407 else
408 resolution = common->wcmTouchResolY;
405 resolution = priv->resolY;
409406 if (common->wcmScaling)
410407 {
411408 /* In case xf86WcmDevConvert didn't get called */
577577 WacomCommonPtr common = priv->common;
578578 WacomToolPtr toollist = common->wcmTool;
579579 WacomToolAreaPtr arealist;
580 int bottomx = 0, bottomy = 0;
581580
581 /* assign max and resolution here since we don't get them during
582 * the configuration stage */
582583 if (IsTouch(priv))
583584 {
584 bottomx = common->wcmMaxTouchX;
585 bottomy = common->wcmMaxTouchY;
585 priv->maxX = common->wcmMaxTouchX;
586 priv->maxY = common->wcmMaxTouchY;
587 priv->resolX = common->wcmTouchResolX;
588 priv->resolY = common->wcmTouchResolY;
586589 }
587590 else
588591 {
589 bottomx = common->wcmMaxX;
590 bottomy = common->wcmMaxY;
592 priv->maxX = common->wcmMaxX;
593 priv->maxY = common->wcmMaxY;
594 priv->resolX = common->wcmResolX;
595 priv->resolY = common->wcmResolY;
591596 }
592597
593598 for (; toollist; toollist=toollist->next)
601601 for (; arealist; arealist=arealist->next)
602602 {
603603 if (!arealist->bottomX)
604 arealist->bottomX = bottomx;
604 arealist->bottomX = priv->maxX;
605605 if (!arealist->bottomY)
606 arealist->bottomY = bottomy;
606 arealist->bottomY = priv->maxY;
607607 }
608608 }
609609
  
170170 int topY; /* Y top */
171171 int bottomX; /* X bottom */
172172 int bottomY; /* Y bottom */
173 int resolX; /* X resolution */
174 int resolY; /* Y resolution */
175 int maxX; /* tool logical maxX */
176 int maxY; /* tool logical maxY */
173177 int sizeX; /* active X size */
174178 int sizeY; /* active Y size */
175179 double factorX; /* X factor */