repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: 41890684a8e37a30fd910acfc6b1fa083149acdc:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit 41890684a8e37a30fd910acfc6b1fa083149acdc
Author: Emanuele Giaquinta 
Date:   Sun Oct 3 21:44:39 2010 +0000

    Use a flag to enable 'root' pixmap operation rather than abusing align
    value.

diff --git a/src/background.C b/src/background.C
index a7e3da3407dd628e0457602c26373273db14d706..
index ..ee1aa2dc49d43a25930766d20c0be6c4daa4b19e 100644
--- a/src/background.C
+++ b/src/background.C
@@ -159,7 +159,7 @@ bgPixmap_t::window_position_sensitive ()
 # ifdef BG_IMAGE_FROM_FILE
   if (have_image)
     {
-      if (h_align == rootAlign || v_align == rootAlign)
+      if (flags & rootAlign)
         return true;
     }
 # endif
@@ -209,13 +209,10 @@ check_set_align_value (int geom_flags, int flag, int &align, int new_value)
 {
   if (geom_flags & flag)
     {
-      if (new_value != bgPixmap_t::rootAlign)
-        {
-          if (new_value < -100)
-            new_value = -100;
-          else if (new_value > 200)
-            new_value = 200;
-        }
+      if (new_value < -100)
+        new_value = -100;
+      else if (new_value > 200)
+        new_value = 200;
       if (new_value != align)
         {
           align = new_value;
@@ -420,9 +417,9 @@ bgPixmap_t::set_geometry (const char *geom)
                 }
               else if (CHECK_GEOM_OPS ("root"))
                 {
+                  new_flags |= rootAlign;
                   w = h = noScale;
-                  x = y = rootAlign;
-                  geom_flags |= WidthValue|HeightValue|XValue|YValue;
+                  geom_flags |= WidthValue|HeightValue;
                 }
 #  undef CHECK_GEOM_OPS

@@ -466,18 +463,17 @@ bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &
       h = v_scale * target_height / 100;
     }

-  if (h_align == rootAlign || v_align == rootAlign)
+  if (flags & rootAlign)
     {
       target->get_window_origin (x, y);
       x = -x;
       y = -y;
     }
-
-  if (h_align != rootAlign)
-    x = make_align_position (h_align, target_width, w > 0 ? w : image_width);
-
-  if (v_align != rootAlign)
-    y = make_align_position (v_align, target_height, h > 0 ? h : image_height);
+  else
+    {
+      x = make_align_position (h_align, target_width, w > 0 ? w : image_width);
+      y = make_align_position (v_align, target_height, h > 0 ? h : image_height);
+    }

   flags &= ~sizeSensitive;
   if (h_scale != 0 || v_scale != 0
diff --git a/src/background.h b/src/background.h
index 3456e15aa453883c2c732e0d6b99b0e0edca8f0a..
index ..c644699dd850068924e8c85aceea28e5d2b928e7 100644
--- a/src/background.h
+++ b/src/background.h
@@ -25,7 +25,8 @@ struct bgPixmap_t
   enum {
     geometrySet     = 1 <<  0,
     propScale       = 1 <<  1,
-    geometryFlags   = geometrySet | propScale,
+    rootAlign       = 1 <<  2,
+    geometryFlags   = geometrySet | propScale | rootAlign,

     tintSet         = 1 <<  8,
     tintNeeded      = 1 <<  9,
@@ -79,7 +80,6 @@ struct bgPixmap_t
     defaultScale = windowScale,
     centerAlign = 50,
     defaultAlign = centerAlign,
-    rootAlign = -10000
   };

   unsigned int h_scale, v_scale;/* percents of the window size */

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