Okay, here's my latest attempt at a patch. I've renamed "flip_[x|y]"
to "invert_[x|y]" and moved them into "EvdevRec", I've removed
"swap_xy", and I've moved the reading of parameters to PreInit.

I hope that's what you wanted. If not let me know. I'm hoping to have
access to the touch screen for an hour or two on friday, so I can do a
bit more testing/development at that time.

Thanks,
Søren

Attachment: evdev.c.patch7
Description: Binary data

Attachment: evdev.h.patch2
Description: Binary data

Attachment: Makefile.am.patch0
Description: Binary data

/*
 * Copyright © 2008 Soren Hauberg
 *
 * Permission to use, copy, modify, distribute, and sell this software
 * and its documentation for any purpose is hereby granted without
 * fee, provided that the above copyright notice appear in all copies
 * and that both that copyright notice and this permission notice
 * appear in supporting documentation, and that the name of Red Hat
 * not be used in advertising or publicity pertaining to distribution
 * of the software without specific, written prior permission.  Red
 * Hat makes no representations about the suitability of this software
 * for any purpose.  It is provided "as is" without express or implied
 * warranty.
 *
 * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
 * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 * Authors:
 *	Soren Hauberg ([EMAIL PROTECTED])
 */
 
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <xf86.h>
#include <xf86Xinput.h>
#include <X11/Xatom.h>
#include <exevents.h>

#include <evdev-properties.h>
#include "evdev.h"

#define TRANSFORM(X, MIN_X, DELTA_X, RANGE_X) \
        (DELTA_X == 0) ? X : ((RANGE_X * (X - MIN_X))/DELTA_X)

int EvdevTransformTouchX(EvdevPtr pEvdev, int value)
{
  int abs_x, delta;
  delta = pEvdev->touchscreen.max_x - pEvdev->touchscreen.min_x;
  abs_x = TRANSFORM(value, pEvdev->touchscreen.min_x, delta, pEvdev->max_x);

  return abs_x;
}

int EvdevTransformTouchY(EvdevPtr pEvdev, int value)
{
  int abs_y, delta;
  delta = pEvdev->touchscreen.max_y - pEvdev->touchscreen.min_y;
  abs_y = TRANSFORM(value, pEvdev->touchscreen.min_y, delta, pEvdev->max_y);

  return abs_y;
}

_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to