Things get confusing when one helper function reports that it
couldn't find an output, but the next doesn't report success.
This change moves most of the output from the helper functions
into TRACE() calls that can be investigated if need be, and
adds a fallthrough failure message to 'set_output'.

For informational purposes, the helper functions now also
directly report to the user if it has succeeded in obtaining
the information necessary to remap the output (with an indication of
just what extension was responsible).
---
 tools/xsetwacom.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index 2e7f3f2..dbfe4b6 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -2056,18 +2056,16 @@ static Bool set_output_xrandr(Display *dpy, XDevice 
*dev, param_t *param, int ar
        /* crtc holds our screen info, need to compare to actual screen size */
        if (found)
        {
-               TRACE("Setting CRTC %s\n", output_name);
+               fprintf(stderr, "Remapping to output area obtained via 
RandR.\n", output_name);
                _set_matrix(dpy, dev, crtc_info->x, crtc_info->y,
                            crtc_info->width, crtc_info->height);
 
                return True;
        } else
-       {
-               printf("Unable to find output '%s'. "
+               TRACE("Unable to find output '%s' through RandR. "
                        "Output may not be connected.\n", output_name);
 
-               return False;
-       }
+       return False;
 }
 
 /**
@@ -2086,14 +2084,14 @@ static Bool set_output_xinerama(Display *dpy, XDevice 
*dev, param_t *param, int
 
        if (!XineramaQueryExtension(dpy, &event, &error))
        {
-               fprintf(stderr, "Unable to set screen mapping. Xinerama 
extension not found\n");
+               TRACE("Xinerama extension not found.\n");
                return False;
        }
 
        if (!convert_value_from_user(param, argv[0], &head))
        {
-               fprintf(stderr, "Please specify the output name as HEAD-X,"
-                               "where X is the screen number\n");
+               TRACE("Please specify the output name as HEAD-X, "
+                               "where X is the screen number.\n");
                return False;
        }
 
@@ -2101,17 +2099,16 @@ static Bool set_output_xinerama(Display *dpy, XDevice 
*dev, param_t *param, int
 
        if (nscreens == 0)
        {
-               fprintf(stderr, "Xinerama failed to query screens.\n");
+               TRACE("Failed to query screens through Xinerama.\n");
                goto out;
        } else if (nscreens <= head)
        {
-               fprintf(stderr, "Found %d screens, but you requested %s.\n",
-                               nscreens, argv[0]);
+               TRACE("You requested %s, but Xinerama only found %d screens.\n",
+                               argv[0], nscreens);
                goto out;
        }
 
-       TRACE("Setting xinerama head %d\n", head);
-
+       fprintf(stderr, "Remapping to output area obtained via Xinerama.\n", 
argv[0]);
        _set_matrix(dpy, dev,
                    screens[head].x_org, screens[head].y_org,
                    screens[head].width, screens[head].height);
@@ -2160,7 +2157,8 @@ static void set_output(Display *dpy, XDevice *dev, 
param_t *param, int argc, cha
 
        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);
+                       if (!set_output_xrandr(dpy, dev, param, argc, argv))
+                               fprintf(stderr, "Unable to map tablet to output 
'%s'.\n", 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