Things are just going to get more complex, so we shuttle the
code out into its own helper function. This helper returns 'True'
(i.e., it sucessfully maps the output) when provided with no
commandline arguments.
---
 tools/xsetwacom.c |   35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index 66e2697..ac474f2 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -2360,20 +2360,35 @@ static Bool set_output_relative(Display *dpy, XDevice 
*dev, param_t *param, int
        return False;
 }
 
+/**
+ * Adjust the transformation matrix to map the given device to the entire
+ * desktop. No command-line arguments are accepted for this function. If
+ * this function succeeds in modifying the transformation matrix, it
+ * returns 'true'.
+ */
+static Bool set_output_desktop(Display *dpy, XDevice *dev, param_t *param, int 
argc, char **argv)
+{
+       if (argc > 0)
+       {
+               TRACE("Desktop mapping helper does not take arguments.");
+               return False;
+       }
+
+       int width = DisplayWidth(dpy, DefaultScreen(dpy));
+       int height = DisplayHeight(dpy, DefaultScreen(dpy));
+
+       _set_matrix(dpy, dev, 0, 0, width, height);
+
+       return True;
+}
+
 static void set_output(Display *dpy, XDevice *dev, param_t *param, int argc, 
char **argv)
 {
        Bool (*fn[]) (Display * dpy, XDevice *dev, param_t *param, int argc, 
char **argv) =
-       { set_output_relative, set_output_area, set_output_xinerama, 
set_output_xrandr };
+       { set_output_desktop, set_output_relative, set_output_area,
+         set_output_xinerama, set_output_xrandr };
 
-       if (argc == 0)
-       {
-               float matrix[9] = { 1, 0, 0,
-                                   0, 1, 0,
-                                   0, 0, 1};
-               _set_matrix_prop(dpy, dev, matrix);
-               return;
-       }
-       else if (argc != param->arg_count)
+       if (argc != 0 && argc != param->arg_count)
        {
                fprintf(stderr, "'%s' requires exactly 0 or %d value(s).\n", 
param->name,
                        param->arg_count);
-- 
1.7.6


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system, 
user administration capabilities and model configuration. Take 
the hassle out of deploying and managing Subversion and the 
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to