This patch adds a function 'set_output_area' which attempts to parse
the commandline argument as a string of the form "WIDTHxHEIGHT@X,Y".
If it succeeds, the transformation matrix will bet set appropriately.
---
 tools/xsetwacom.c |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index 8c5178f..2e7f3f2 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -2123,6 +2123,24 @@ out:
        return success;
 }
 
+static Bool set_output_area(Display *dpy, XDevice *dev, param_t *param, int 
argc, char **argv)
+{
+       int width, height, xorig, yorig;
+
+       if (sscanf(argv[0], "%dx%d@%d,%d", &width, &height, &xorig, &yorig) == 
4)
+       {
+               fprintf(stderr, "Remapping to output area obtained via 
parsing.\n", argv[0]);
+               _set_matrix(dpy, dev, xorig, yorig, width, height);
+               return True;
+       }
+       else
+       {
+               TRACE("Unable to parse '%s' as a string of format 
WIDTHxHEIGHT@X,Y.\n", argv[0]);
+       }
+
+       return False;
+}
+
 static void set_output(Display *dpy, XDevice *dev, param_t *param, int argc, 
char **argv)
 {
        if (argc == 0)
@@ -2140,8 +2158,9 @@ static void set_output(Display *dpy, XDevice *dev, 
param_t *param, int argc, cha
                return;
        }
 
-       if (!set_output_xinerama(dpy, dev, param, argc, argv))
-               set_output_xrandr(dpy, dev, param, argc, argv);
+       if (!set_output_area(dpy, dev, param, argc, argv))
+               if (!set_output_xinerama(dpy, dev, param, argc, argv))
+                       set_output_xrandr(dpy, dev, param, argc, argv);
 }
 
 
-- 
1.7.5.2


------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to