repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: 3119b575d559dc895924af47a04ecf5c862c793a: path_to: revision_to:
commit 3119b575d559dc895924af47a04ecf5c862c793a Author: Emanuele GiaquintaDate: Fri Nov 19 23:29:30 2010 +0000 Keep track of the window position to avoid spurious redraws when the bg image is sensitive to position. diff --git a/src/background.C b/src/background.C
--- a/src/background.C
+++ b/src/background.C
@@ -105,6 +105,7 @@ bgPixmap_t::bgPixmap_t ()
pixmap = None;
valid_since = invalid_since = 0;
target = 0;
+ target_x = target_y = 0;
}
void
@@ -124,6 +125,20 @@ bgPixmap_t::destroy ()
XFreePixmap (target->dpy, pixmap);
}
+bool
+bgPixmap_t::set_position (int x, int y)
+{
+
+ if (target_x != x
+ || target_y != y)
+ {
+ target_x = x;
+ target_y = y;
+ return true;
+ }
+ return false;
+}
+
bool
bgPixmap_t::window_size_sensitive ()
{
@@ -385,9 +400,8 @@ bgPixmap_t::get_image_geometry (int image_width, int image_height, int &w, int &
if (flags & rootAlign)
{
- target->get_window_origin (x, y);
- x = -x;
- y = -y;
+ x = -target_x;
+ y = -target_y;
}
else
{
@@ -1202,7 +1216,8 @@ bgPixmap_t::make_transparency_pixmap ()
XGCValues gcv;
GC gc;
- target->get_window_origin (sx, sy);
+ sx = target_x;
+ sy = target_y;
/* check if we are outside of the visible part of the virtual screen : */
if (sx + window_width <= 0 || sy + window_height <= 0
diff --git a/src/background.h b/src/background.h
--- a/src/background.h +++ b/src/background.h @@ -112,6 +112,9 @@ struct bgPixmap_t unsigned int pmap_width, pmap_height; unsigned int pmap_depth; + int target_x; + int target_y; + bool set_position (int x, int y); bool window_size_sensitive (); bool window_position_sensitive (); diff --git a/src/command.C b/src/command.C
--- a/src/command.C
+++ b/src/command.C
@@ -1438,6 +1438,25 @@ rxvt_term::x_cb (XEvent &ev)
while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
;
+#ifdef HAVE_BG_PIXMAP
+ bool moved = false;
+ if (bgPixmap.window_position_sensitive ())
+ {
+ int x, y;
+ if (ev.xconfigure.send_event)
+ {
+ x = ev.xconfigure.x;
+ y = ev.xconfigure.y;
+ }
+ else
+ get_window_origin (x, y);
+
+ if (bgPixmap.set_position (x, y)
+ || (bgPixmap.flags & bgPixmap_t::isInvalid))
+ moved = true;
+ }
+#endif
+
if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height)
{
seen_resize = 1;
@@ -1446,7 +1465,7 @@ rxvt_term::x_cb (XEvent &ev)
else
{
#ifdef HAVE_BG_PIXMAP
- if (bgPixmap.window_position_sensitive ())
+ if (moved)
{
if (mapped)
update_background ();
@@ -3468,7 +3487,15 @@ rxvt_term::process_xterm_seq (int op, char *str, char resp)
}
if (changed)
- update_background ();
+ {
+ if (bgPixmap.window_position_sensitive ())
+ {
+ int x, y;
+ get_window_origin (x, y);
+ bgPixmap.set_position (x, y);
+ }
+ update_background ();
+ }
}
break;
#endif
-----END OF PAGE-----