Things get confusing when one helper function reports that it
couldn't find an output, but the next one doesn't report
success. This change moves most of the output from the helper
functions into TRACE() calls that can be investigated further 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 reponsible).
---
Changes from v1:
 * None, yet.

 tools/xsetwacom.c |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index 5a3e791..5c1eaa1 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -2067,18 +2067,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;
 }
 
 /**
@@ -2115,14 +2113,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;
        }
 
@@ -2130,17 +2128,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);
@@ -2196,7 +2193,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.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