repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 41890684a8e37a30fd910acfc6b1fa083149acdc: path_to: revision_to:
commit 41890684a8e37a30fd910acfc6b1fa083149acdc Author: Emanuele GiaquintaDate: 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
--- 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
--- 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-----