File root-tail-1.2-shade.diff of Package root-tail

--- root-tail-1.2/root-tail.c
+++ root-tail-1.2/root-tail.c
@@ -46,9 +46,6 @@
 #include <regex.h>
 #endif
 
-#define SHADE_X 2
-#define SHADE_Y 2
-
 /* some italic fonts still go over the margin - this margin of error cleans up the mess */
 #define MARGIN_OF_ERROR 2
 
@@ -123,9 +120,9 @@
 struct timeval interval = { 2, 400000 };
 
 /* command line options */
-int opt_noinitial, opt_shade, opt_frame, opt_reverse, opt_nofilename,
-  opt_outline, opt_noflicker, opt_whole, opt_update, opt_wordwrap,
-  opt_justify, geom_mask, opt_minspace, reload;
+int opt_noinitial, opt_shade = 0, opt_shade_x = 2, opt_shade_y = 2, opt_frame,
+  opt_reverse, opt_nofilename, opt_outline, opt_noflicker, opt_whole,
+  opt_update, opt_wordwrap, opt_justify, geom_mask, opt_minspace, reload;
 const char *command = NULL,
   *fontname = USE_FONT, *dispname = NULL, *def_color = DEF_COLOR,
   *continuation = "|| ", *cont_color = DEF_CONT_COLOR;
@@ -529,8 +526,8 @@
                 {
                   XSetForeground (disp, WinGC, black_color);
                   draw_text (disp, root, WinGC,
-                             win_x + effect_x_offset + SHADE_X,
-                             win_y + offset + SHADE_Y, line, foreground = 0);
+                             win_x + effect_x_offset + opt_shade_x,
+                             win_y + offset + opt_shade_y, line, foreground = 0);
                 }
 
               XSetForeground (disp, WinGC, line->logfile->color);
@@ -1327,7 +1324,10 @@
             }
           else if (!strcmp (arg, "-shade"))
             opt_shade = 1;
-          else if (!strcmp (arg, "-outline"))
+          else if (!strcmp (arg, "-offsets")) {
+            opt_shade_x = atoi (argv[++i]);
+            opt_shade_y = atoi (argv[++i]);
+          } else if (!strcmp (arg, "-outline"))
             opt_outline = 1;
           else if (!strcmp (arg, "-minspace"))
             opt_minspace = 1;
@@ -1506,14 +1506,14 @@
   else if (opt_shade && !opt_minspace)
     {
       /* adding a shadow increases the space used */
-      effect_x_space = abs (SHADE_X);
-      effect_y_space = abs (SHADE_Y);
+      effect_x_space = abs (opt_shade_x);
+      effect_y_space = abs (opt_shade_y);
 
       /* if the shadow is to the right and below then we don't need
        * to move the text to make space for it, but shadows to the left
        * and above need accomodating */
-      effect_x_offset = SHADE_X > 0 ? 0 : -SHADE_X;
-      effect_y_offset = SHADE_Y > 0 ? 0 : -SHADE_Y;
+      effect_x_offset = opt_shade_x > 0 ? 0 : -opt_shade_x;
+      effect_y_offset = opt_shade_y > 0 ? 0 : -opt_shade_y;
     }
   else
     {
@@ -1612,6 +1612,7 @@
           "                           defaults to \"|| \"\n"
           " -wordwrap                 wrap long lines at spaces to avoid breaking words\n"
           " -shade                    add shading to font\n"
+          " -offsets   x y            use specified offsets when shading\n"
           " -outline                  add black outline to font\n"
           " -minspace                 force minimum line spacing\n"
           " -noinitial                don't display the last file lines on\n"
openSUSE Build Service is sponsored by