-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: rxvt-unicode-sixel
action: commit
revision:
path_from:
revision_from: 0792abe927130c4c239db957409986c31aba3f60:
path_to:
revision_to:

git.thebackupbox.net

rxvt-unicode-sixel

git://git.thebackupbox.net/rxvt-unicode-sixel

commit 0792abe927130c4c239db957409986c31aba3f60
Author: Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
Date:   Sat Aug 13 09:05:44 2011 +0000

    Do not special case the scale/position string of the bg image.

    Make it possible to specify it anywhere in the list rather than just at
    the beginning, like other operations.

diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod

index b01ab78d57bdf1e72783abf1adbe47a5a5ddb28a..

index ..e46780ddfd71d09440811a3a61a62488c11036f9 100644

--- a/doc/rxvt.1.pod
+++ b/doc/rxvt.1.pod
@@ -185,10 +185,10 @@ Window background colour; resource B<background>.

 Window foreground colour; resource B<foreground>.

-=item B<-pixmap> I<file[;geom[:op1][:op2][...]]>
+=item B<-pixmap> I<file[;oplist]>

 Compile I<afterimage> or I<pixbuf>: Specify image file for the background and also
-optionally specify its scaling with a geometry string. Note you may need to
+optionally specify a list of operations to modify it. Note you may need to
 add quotes to avoid special shell interpretation of the C<;> in the
 command-line; for more details see resource B<backgroundPixmap>.

@@ -745,22 +745,22 @@ Use the specified colour for the scrollbar's trough area [default
 The colour of the border around the text area and between the scrollbar
 and the text.

-=item B<backgroundPixmap:> I<file[;geom[:op1][:op2][...]]>
+=item B<backgroundPixmap:> I<file[;oplist]>

 Use the specified image file for the background and also
-optionally specify its scaling with a geometry string B<WxH+X+Y>,
-(default C<100x100+50+50>) in which B<"W" / "H"> specify the
-horizontal/vertical scale (percent), and B<"X" / "Y"> locate the image
-centre (percent).  A scale of 0 disables scaling.
-The maximum permitted scale is 1000.
-Additional operations can be specified after colon B<:op1:op2...>.
+optionally specify a colon separated list of operations to modify it.
 Supported operations are:

+  B<WxH+X+Y>  sets scale and position. B<"W" / "H"> specify the
+              horizontal/vertical scale (percent), and B<"X" / "Y">
+              locate the image centre (percent). A scale of 0 disables
+              scaling. The maximum permitted scale is 1000.
   op=tile     enables tiling
   op=pscale   enables proportional scaling
   op=root     use the position of the terminal window relative to the root
               window as the image offset, simulating a root window background

+The default scale and position setting is C<100x100+50+50>.
 Alternatively, a predefined set of templates can be used to achieve
 the most common setups:

diff --git a/src/background.C b/src/background.C

index add853874785ad71e8229b75b60b7ebd526fe172..

index ..bc5e11f2bd5da8ecb8a2cb9fab979461c401060b 100644

--- a/src/background.C
+++ b/src/background.C
@@ -199,54 +199,14 @@ rxvt_term::bg_set_geometry (const char *geom, bool update)
   int geom_flags = 0;
   int x = 0, y = 0;
   unsigned int w = 0, h = 0;
-  unsigned int n;
   unsigned long new_flags = (bg_flags & (~BG_GEOMETRY_FLAGS));
-  const char *ops;

   if (geom == NULL)
     return false;

-  char str[256];
-
-  ops = strchr (geom, ':');
-  if (ops == NULL)
-    n = strlen (geom);
-  else
-    n = ops - geom;
-
-  if (n >= sizeof (str))
-    return false;
-
-  memcpy (str, geom, n);
-  str[n] = '\0';
-  rxvt_strtrim (str);
-
-  if (str[0])
-    {
-      /* we have geometry string - let's handle it prior to applying ops */
-      geom_flags = XParseGeometry (str, &x, &y, &w, &h);
-    } /* done parsing geometry string */
-
-  if (!update)
-    {
-      if (!(geom_flags & XValue))
-        x = y = defaultAlign;
-      else if (!(geom_flags & YValue))
-        y = x;
-
-      if (!(geom_flags & (WidthValue|HeightValue)))
-        w = h = defaultScale;
-      else if (!(geom_flags & HeightValue))
-        h = w;
-      else if (!(geom_flags & WidthValue))
-        w = h;
-
-      geom_flags |= WidthValue|HeightValue|XValue|YValue;
-    }
-
-  if (ops)
+  if (geom[0])
     {
-      char **arr = rxvt_strsplit (':', ops + 1);
+      char **arr = rxvt_strsplit (':', geom);

       for (int i = 0; arr[i]; i++)
         {
@@ -331,11 +291,31 @@ rxvt_term::bg_set_geometry (const char *geom, bool update)
               w = h = noScale;
               geom_flags |= WidthValue|HeightValue;
             }
+
+          else
+            geom_flags |= XParseGeometry (arr[i], &x, &y, &w, &h);
         } /* done parsing ops */

       rxvt_free_strsplit (arr);
     }

+  if (!update)
+    {
+      if (!(geom_flags & XValue))
+        x = y = defaultAlign;
+      else if (!(geom_flags & YValue))
+        y = x;
+
+      if (!(geom_flags & (WidthValue|HeightValue)))
+        w = h = defaultScale;
+      else if (!(geom_flags & HeightValue))
+        h = w;
+      else if (!(geom_flags & WidthValue))
+        w = h;
+
+      geom_flags |= WidthValue|HeightValue|XValue|YValue;
+    }
+
   if (check_set_scale_value (geom_flags, WidthValue, h_scale, w))  changed = true;
   if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) changed = true;
   if (check_set_align_value (geom_flags, XValue, h_align, x))      changed = true;

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 13:32:01 2024