xf86-input-elographics: allow limiting the touchable area of the display
authorMichael Smith <msmith@cbnco.com>
Mon, 15 Nov 2010 19:33:52 +0000 (14:33 -0500)
committerMichael Smith <msmith@cbnco.com>
Mon, 15 Nov 2010 19:35:25 +0000 (14:35 -0500)
Add ScreenWidth and ScreenHeight configuration options to override
the screen size.

see also: https://bugs.freedesktop.org/show_bug.cgi?id=31397

Signed-off-by: Michael Smith <msmith@cbnco.com>
recipes/xorg-driver/xf86-input-elographics-1.2.4/elo-adjustable-screen-size.patch [new file with mode: 0644]
recipes/xorg-driver/xf86-input-elographics_1.2.4.bb

diff --git a/recipes/xorg-driver/xf86-input-elographics-1.2.4/elo-adjustable-screen-size.patch b/recipes/xorg-driver/xf86-input-elographics-1.2.4/elo-adjustable-screen-size.patch
new file mode 100644 (file)
index 0000000..c8d56cb
--- /dev/null
@@ -0,0 +1,83 @@
+upstream: https://bugs.freedesktop.org/show_bug.cgi?id=31397
+
+Allow limiting the "touchable" area of the display.
+
+The intel driver only allows for one X screen in dual-head mode, and
+elographics normally uses the size of the entire screen to calculate
+touch event locations.
+
+This patch adds ScreenWidth and ScreenHeight configuration options to
+override the screen size, and ScreenXOffset and ScreenYOffset in case
+the touchscreen covers part of the screen that doesn't begin at (0,0).
+
+
+--- xf86-input-elographics-1.2.3/src/xf86Elo.c.orig    2008-10-13 19:52:10.000000000 -0400
++++ xf86-input-elographics-1.2.3/src/xf86Elo.c 2009-07-14 01:50:21.000000000 -0400
+@@ -196,6 +196,8 @@
+   int         screen_no;              /* Screen associated with the device            */
+   int         screen_width;           /* Width of the associated X screen             */
+   int         screen_height;          /* Height of the screen                         */
++  int         screen_x_offset;        /* X offset within the screen                   */
++  int         screen_y_offset;        /* Y offset within the screen                   */
+   Bool                inited;                 /* The controller has already been configured ? */
+   Bool                is_a_2310;              /* Set if the smartset is a 2310.               */
+   int         checksum;               /* Current checksum of data in assembly buffer  */
+@@ -355,9 +357,11 @@
+     input_x = v0;
+     input_y = v1;
+   }
+-  *x = (priv->screen_width * (input_x - priv->min_x)) / width;
++  *x = (priv->screen_width * (input_x - priv->min_x)) / width
++       + priv->screen_x_offset;
+   *y = (priv->screen_height -
+-      (priv->screen_height * (input_y - priv->min_y)) / height);
++      (priv->screen_height * (input_y - priv->min_y)) / height)
++       + priv->screen_y_offset;
+   /*
+    * MHALAS: Based on the description in xf86XInputSetScreen
+@@ -791,8 +795,14 @@
+         priv->screen_no < 0) {
+       priv->screen_no = 0;
+       }
+-      priv->screen_width = screenInfo.screens[priv->screen_no]->width;
+-      priv->screen_height = screenInfo.screens[priv->screen_no]->height;
++      if (priv->screen_width == -1) {
++        priv->screen_width = screenInfo.screens[priv->screen_no]->width;
++      }
++      if (priv->screen_height == -1) {
++        priv->screen_height = screenInfo.screens[priv->screen_no]->height;
++      }
++      xf86Msg(X_CONFIG, "Elographics screen dimensions: %dx%d\n",
++              priv->screen_width, priv->screen_height);
+       /*
+        * Device reports button press for up to 1 button.
+@@ -996,6 +1006,8 @@
+   priv->screen_no = 0;
+   priv->screen_width = -1;
+   priv->screen_height = -1;
++  priv->screen_x_offset = 0;
++  priv->screen_y_offset = 0;
+   priv->inited = 0;
+   priv->is_a_2310 = 0;
+   priv->checksum = ELO_INIT_CHECKSUM;
+@@ -1104,8 +1116,18 @@
+   local->name = xf86SetStrOption(local->options, "DeviceName", XI_TOUCHSCREEN);
+   xf86Msg(X_CONFIG, "Elographics X device name: %s\n", local->name);
++
+   priv->screen_no = xf86SetIntOption(local->options, "ScreenNo", 0);
+   xf86Msg(X_CONFIG, "Elographics associated screen: %d\n", priv->screen_no);
++
++  priv->screen_width = xf86SetIntOption(local->options, "ScreenWidth", -1);
++  priv->screen_height = xf86SetIntOption(local->options, "ScreenHeight", -1);
++
++  priv->screen_x_offset = xf86SetIntOption(local->options, "ScreenXOffset", 0);
++  priv->screen_y_offset = xf86SetIntOption(local->options, "ScreenYOffset", 0);
++  xf86Msg(X_CONFIG, "Elographics screen offset: (%d,%d)\n",
++          priv->screen_x_offset, priv->screen_y_offset);
++
+   priv->untouch_delay = xf86SetIntOption(local->options, "UntouchDelay", ELO_UNTOUCH_DELAY);
+   xf86Msg(X_CONFIG, "Elographics untouch delay: %d ms\n", priv->untouch_delay*10);
+   priv->report_delay = xf86SetIntOption(local->options, "ReportDelay", ELO_REPORT_DELAY);
index 99505c5..14a6585 100644 (file)
@@ -1,7 +1,9 @@
 require xorg-driver-input.inc
 DESCRIPTION = "X.Org X server -- ELOGraphics input driver"
 PE = "2"
-PR = "${INC_PR}.0"
+PR = "${INC_PR}.1"
+
+SRC_URI += "file://elo-adjustable-screen-size.patch"
 
 SRC_URI[archive.md5sum] = "c4dbc216b2ddfcec93ae74ca00fae95a"
 SRC_URI[archive.sha256sum] = "dfede47c14c40e51294c84bf8f9bec5f5e0b17c80f370ae2ac6bddad79f9e66b"