Bug fix TIVI-782, the x moves oppsite direction. 96/3496/3
authorWang Quanxian <quanxian.wang@intel.com>
Tue, 7 May 2013 04:08:39 +0000 (12:08 +0800)
committerWang Quanxian <quanxian.wang@intel.com>
Tue, 7 May 2013 04:08:39 +0000 (12:08 +0800)
When move finger to left, the mouse will move to right.
Signed-Off-By Quanxian Wang <quanxian.wang@intel.com>

packaging/99-chelong-quirk.rules [new file with mode: 0644]
packaging/weston.spec
src/compositor-drm.c
src/evdev.c
src/evdev.h

diff --git a/packaging/99-chelong-quirk.rules b/packaging/99-chelong-quirk.rules
new file mode 100644 (file)
index 0000000..6837118
--- /dev/null
@@ -0,0 +1 @@
+ATTRS{idVendor}=="0eef", ATTRS{idProduct}=="0001", ENV{WL_QUIRK_SWAP_XAXIS}="yes"
index 0491abf..0b28881 100644 (file)
@@ -12,6 +12,7 @@ Source3:    99-vtc1000-quirk.rules
 Source4:    rc.weston
 Source5:    weston.sh
 Source6:    weston.manifest
+Source7:    99-chelong-quirk.rules
 BuildRequires: pkgconfig(wayland-server)
 BuildRequires: pkgconfig(egl)
 BuildRequires: pkgconfig(gl)
@@ -85,8 +86,9 @@ install -m 755 clients/smoke $RPM_BUILD_ROOT%{_bindir}/wayland-smoke
 # Systemd
 mkdir -p $RPM_BUILD_ROOT/%{_libdir}/systemd/system/graphical.target.wants
 install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT/%{_libdir}/systemd/system/
-mkdir -p $RPM_BUILD_ROOT/%{_libdir}/udev/rules.d/
-install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/%{_libdir}/udev/rules.d/
+mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/
+install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/
+install -m 0644 %{SOURCE7} $RPM_BUILD_ROOT/%{_sysconfdir}/udev/rules.d/
 ln -sf ../weston.service $RPM_BUILD_ROOT/%{_libdir}/systemd/system/graphical.target.wants/weston.service
 
 # System V
@@ -120,7 +122,7 @@ tar -C $RPM_BUILD_ROOT%{_datadir}/icons/default -xvf %{SOURCE1}
 %{_datadir}/man/*/*
 %{_libdir}/systemd/system/weston.service
 %{_libdir}/systemd/system/graphical.target.wants/weston.service
-%{_libdir}/udev/rules.d/99-vtc1000-quirk.rules
+%{_sysconfdir}/udev/rules.d/*
 %{_sysconfdir}/profile.d/weston.sh
 %{_sysconfdir}/rc.d/init.d/weston
 %{_sysconfdir}/rc.d/rc3.d/S20weston
index 1010733..345de57 100644 (file)
@@ -1804,6 +1804,8 @@ device_parse_quirks(struct evdev_device *evdev_device,
 {
        if (udev_device_get_property_value(udev_device, "WL_QUIRK_SWAP_AXES"))
                evdev_device->quirks |= EVDEV_QUIRK_SWAP_AXES;
+       else if (udev_device_get_property_value(udev_device, "WL_QUIRK_SWAP_XAXIS"))
+               evdev_device->quirks |= EVDEV_QUIRK_SWAP_XAXIS;
 }
 
 static const char default_seat[] = "seat0";
index 157264b..42f4ef8 100644 (file)
@@ -131,41 +131,42 @@ evdev_process_absolute_motion(struct evdev_device *device,
        const int screen_width = device->output->current->width;
        const int screen_height = device->output->current->height;
 
-       if (device->quirks & EVDEV_QUIRK_SWAP_AXES) {
-               switch (e->code) {
-               case ABS_X:
+       switch (e->code) {
+       case ABS_X:
+               if (device->quirks & EVDEV_QUIRK_SWAP_AXES) {
                        device->abs.y =
                                (e->value - device->abs.min_y) * screen_height /
                                (device->abs.max_y - device->abs.min_y) +
                                device->output->y;
-                       device->pending_events |= EVDEV_ABSOLUTE_MOTION;
-                       break;
-               case ABS_Y:
+               } else if (device->quirks & EVDEV_QUIRK_SWAP_XAXIS) { 
+                       device->abs.x =
+                               (device->abs.max_x - (e->value - device->abs.min_x)) * screen_width /
+                               (device->abs.max_x - device->abs.min_x) +
+                               device->output->x;
+               } else {
+                       /* Normally Process Y */
                        device->abs.x =
                                (e->value - device->abs.min_x) * screen_width /
                                (device->abs.max_x - device->abs.min_x) +
                                device->output->x;
-                       device->pending_events |= EVDEV_ABSOLUTE_MOTION;
-                       break;
                }
-
-       } else {
-               switch (e->code) {
-               case ABS_X:
+               break;
+               device->pending_events |= EVDEV_ABSOLUTE_MOTION;
+       case ABS_Y:
+               if (device->quirks & EVDEV_QUIRK_SWAP_AXES) {
                        device->abs.x =
                                (e->value - device->abs.min_x) * screen_width /
                                (device->abs.max_x - device->abs.min_x) +
                                device->output->x;
-                       device->pending_events |= EVDEV_ABSOLUTE_MOTION;
-                       break;
-               case ABS_Y:
+               } else {
+                       /* Normally Process Y */
                        device->abs.y =
                                (e->value - device->abs.min_y) * screen_height /
                                (device->abs.max_y - device->abs.min_y) +
                                device->output->y;
-                       device->pending_events |= EVDEV_ABSOLUTE_MOTION;
-                       break;
                }
+               device->pending_events |= EVDEV_ABSOLUTE_MOTION;
+               break;
        }
 }
 
index cc14597..63d6220 100644 (file)
@@ -48,6 +48,7 @@ enum evdev_device_capability {
 enum evdev_device_quirks {
        EVDEV_QUIRK_NONE = 0,
        EVDEV_QUIRK_SWAP_AXES = (1 << 0),
+       EVDEV_QUIRK_SWAP_XAXIS = (2 << 0),
 };
 
 struct evdev_device {