repo: rxvt-unicode-sixel action: commit revision: path_from: revision_from: c0aa9e5b206c282233927e9df178030644065f83: path_to: revision_to:
commit c0aa9e5b206c282233927e9df178030644065f83 Author: Emanuele GiaquintaDate: Sat Oct 30 16:39:04 2010 +0000 Validate root pixmap once rather than everytime we render it. diff --git a/src/background.C b/src/background.C
--- a/src/background.C
+++ b/src/background.C
@@ -1306,7 +1306,6 @@ bgPixmap_t::make_transparency_pixmap ()
Display *dpy = target->dpy;
int root_width = DisplayWidth (dpy, screen);
int root_height = DisplayHeight (dpy, screen);
- unsigned int root_pmap_width, root_pmap_height;
int window_width = target->szHint.width;
int window_height = target->szHint.height;
int sx, sy;
@@ -1320,20 +1319,6 @@ bgPixmap_t::make_transparency_pixmap ()
|| sx >= root_width || sy >= root_height)
return 0;
- if (root_pixmap != None)
- {
- /* we want to validate the pixmap and get its size at the same time : */
- int junk;
- unsigned int ujunk;
- /* root pixmap may be bad - allow a error */
- target->allowedxerror = -1;
-
- if (!XGetGeometry (dpy, root_pixmap, &root, &junk, &junk, &root_pmap_width, &root_pmap_height, &ujunk, &ujunk))
- root_pixmap = None;
-
- target->allowedxerror = 0;
- }
-
if (root_pixmap == None)
return 0;
@@ -1396,6 +1381,22 @@ bgPixmap_t::set_root_pixmap ()
new_root_pixmap = target->get_pixmap_property (XA_ESETROOT_PMAP_ID);
root_pixmap = new_root_pixmap;
+
+ // validate root pixmap
+ if (root_pixmap != None)
+ {
+ unsigned int width, height;
+ Window wdummy;
+ int idummy;
+ unsigned int udummy;
+
+ target->allowedxerror = -1;
+
+ if (!XGetGeometry (target->dpy, root_pixmap, &wdummy, &idummy, &idummy, &width, &height, &udummy, &udummy))
+ root_pixmap = None;
+
+ target->allowedxerror = 0;
+ }
}
# endif /* ENABLE_TRANSPARENCY */
-----END OF PAGE-----