patch-evtouch_c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. fixed compile for xorg 1.7.1
  2. --- xf86-input-evtouch-0.8.8.orig/evtouch.c 2008-11-11 09:47:55.000000000 +0100
  3. +++ xf86-input-evtouch-0.8.8/evtouch.c 2010-01-06 16:11:16.000000000 +0100
  4. @@ -30,10 +30,10 @@
  5. #define _evdev_touch_C_
  6. -#include <xf86Version.h>
  7. -#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0)
  8. -#define XFREE86_V4
  9. -#endif
  10. +//#include <xf86Version.h>
  11. +//#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0)
  12. +//#define XFREE86_V4
  13. +//#endif
  14. /*****************************************************************************
  15. * Standard Headers
  16. @@ -88,6 +88,11 @@
  17. #include <linux/input.h>
  18. +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
  19. +#include <X11/Xatom.h>
  20. +#include <xserver-properties.h>
  21. +#endif
  22. +
  23. /*****************************************************************************
  24. * Local Headers
  25. ****************************************************************************/
  26. @@ -132,14 +137,14 @@ InputDriverRec EVTOUCH = {
  27. 0
  28. };
  29. -#ifdef XFree86LOADER
  30. +//#ifdef XFree86LOADER
  31. static XF86ModuleVersionInfo VersionRec =
  32. {
  33. "evtouch",
  34. "Kenan Esau",
  35. MODINFOSTRING1,
  36. MODINFOSTRING2,
  37. - XF86_VERSION_CURRENT,
  38. + XORG_VERSION_CURRENT,
  39. 0, 8, 8,
  40. ABI_CLASS_XINPUT,
  41. ABI_XINPUT_VERSION,
  42. @@ -167,9 +172,9 @@ Unplug(pointer p)
  43. }
  44. -XF86ModuleData evtouchModuleData = {&VersionRec, Plug, Unplug };
  45. +_X_EXPORT XF86ModuleData evtouchModuleData = {&VersionRec, Plug, Unplug };
  46. -#endif /* XFree86LOADER */
  47. +//#endif /* XFree86LOADER */
  48. static const char *default_options[] =
  49. @@ -581,6 +586,32 @@ DeviceOff (DeviceIntPtr dev)
  50. }
  51. +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
  52. +static void xf86WcmInitButtonLabels(Atom *labels, int nlabels)
  53. +{
  54. + memset(labels, 0, nlabels * sizeof(Atom));
  55. + switch(nlabels)
  56. + {
  57. + default:
  58. + case 7:
  59. + labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
  60. + case 6:
  61. + labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
  62. + case 5:
  63. + labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN);
  64. + case 4:
  65. + labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP);
  66. + case 3:
  67. + labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
  68. + case 2:
  69. + labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
  70. + case 1:
  71. + labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
  72. + break;
  73. + }
  74. +}
  75. +#endif
  76. +
  77. static Bool
  78. @@ -591,12 +622,21 @@ DeviceInit (DeviceIntPtr dev)
  79. EVTouchPrivatePtr priv = (EVTouchPrivatePtr) (local->private);
  80. unsigned char map[EV_MAX_BUTTONS];
  81. int i;
  82. +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
  83. + Atom *axis_labels, *btn_labels;
  84. +#endif
  85. for (i = 0; i < EV_MAX_BUTTONS; i++)
  86. map[i] = i;
  87. priv->btn_count = EV_MAX_BUTTONS;
  88. +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
  89. + axis_labels = xcalloc(2, sizeof(Atom));
  90. + btn_labels = xcalloc(EV_MAX_BUTTONS, sizeof(Atom));
  91. + xf86WcmInitButtonLabels(btn_labels, EV_MAX_BUTTONS);
  92. +#endif
  93. +
  94. /*
  95. * these have to be here instead of in the SetupProc, because when the
  96. * SetupProc is run at server startup, screenInfo is not setup yet
  97. @@ -629,8 +669,18 @@ DeviceInit (DeviceIntPtr dev)
  98. /*
  99. * Device reports button press for 5 buttons.
  100. */
  101. - if (InitButtonClassDeviceStruct (dev, EV_MAX_BUTTONS, map) == FALSE)
  102. + if (InitButtonClassDeviceStruct (dev, EV_MAX_BUTTONS,
  103. +
  104. + #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
  105. + btn_labels,
  106. + #endif
  107. + map) == FALSE)
  108. {
  109. +
  110. +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
  111. + xfree(btn_labels);
  112. +#endif
  113. +
  114. ErrorF("Unable to allocate EVTouch touchscreen ButtonClassDeviceStruct\n");
  115. return BadAlloc;
  116. }
  117. @@ -653,7 +703,12 @@ DeviceInit (DeviceIntPtr dev)
  118. * Device reports motions on 2 axes in absolute coordinates.
  119. * Axes min and max values are reported in raw coordinates.
  120. */
  121. - if (InitValuatorClassDeviceStruct(dev, 2, xf86GetMotionEvents,
  122. + if (InitValuatorClassDeviceStruct(dev, 2,
  123. +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
  124. + axis_labels,
  125. +#endif
  126. +
  127. +// xf86GetMotionEvents,
  128. local->history_size, Absolute) == FALSE)
  129. {
  130. ErrorF ("Unable to allocate EVTouch touchscreen ValuatorClassDeviceStruct\n");
  131. @@ -672,7 +727,24 @@ DeviceInit (DeviceIntPtr dev)
  132. EV_AXIS_MAX_RES /* max_res */ );
  133. xf86InitValuatorDefaults(dev, 1);
  134. #else
  135. - xf86InitValuatorAxisStruct(dev, 0, priv->min_x, priv->max_x,
  136. + xf86InitValuatorAxisStruct(dev, 0,
  137. +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
  138. + XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X),
  139. +#endif
  140. + 0, priv->screen_width,
  141. + 1024,
  142. + EV_AXIS_MIN_RES /* min_res */ ,
  143. + EV_AXIS_MAX_RES /* max_res */ );
  144. + xf86InitValuatorDefaults(dev, 0);
  145. +
  146. + xf86InitValuatorAxisStruct(dev, 1,
  147. +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
  148. + XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y),
  149. +#endif
  150. + 0, priv->screen_width,
  151. + 1024,
  152. + EV_AXIS_MIN_RES /* min_res */ ,
  153. + EV_AXIS_MAX_RES /* max_res */ );
  154. xf86InitValuatorDefaults(dev, 1);
  155. #endif