From: root Date: Tue, 4 Nov 2008 13:20:40 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=ddad191596033cd0c33a8de051f3060067fb18ed;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/Changes b/Changes index 6c9e93ea..fd7dfdc9 100644 --- a/Changes +++ b/Changes @@ -38,6 +38,7 @@ TODO: cursor over overlays, when focus change? - try to work around linux first breaking sched_yield and now breaking the only known workaround. - new option -icon, resource iconFile (based on patch by Frank Schmitt). + - intiialise the as visual only on demand, instead of unconditionally. 9.05 Sun Jun 15 20:09:20 CEST 2008 - new option --cd/chdir to set the starting working directory. diff --git a/src/background.C b/src/background.C index ccd11bfa..c60a32b0 100644 --- a/src/background.C +++ b/src/background.C @@ -3,7 +3,7 @@ *----------------------------------------------------------------------* * * All portions of code are copyright by their respective author/s. - * Copyright (c) 2005-2006 Marc Lehmann + * Copyright (c) 2005-2008 Marc Lehmann * Copyright (c) 2007 Sasha Vasko * * This program is free software; you can redistribute it and/or modify @@ -451,10 +451,14 @@ bgPixmap_t::render_asim (ASImage *background, ARGB32 background_tint) if (target == NULL) return false; - int target_width = (int)target->szHint.width; - int target_height = (int)target->szHint.height; - int new_pmap_width = target_width, new_pmap_height = target_height; - ASImage *result = NULL; + target->init_asv (); + + ASImage *result = 0; + + int target_width = target->szHint.width; + int target_height = target->szHint.height; + int new_pmap_width = target_width; + int new_pmap_height = target_height; int x = 0; int y = 0; @@ -665,19 +669,15 @@ bgPixmap_t::render_asim (ASImage *background, ARGB32 background_tint) bool bgPixmap_t::set_file (const char *file) { - char *f; - assert (file); if (*file) { # ifdef HAVE_AFTERIMAGE - if (target->asimman == NULL) + if (!target->asimman) target->asimman = create_generic_imageman (target->rs[Rs_path]); - if ((f = strchr (file, ';')) == NULL) - original_asim = get_asimage (target->asimman, file, 0xFFFFFFFF, 100); - else + if (char *f = strchr (file, ';')) { size_t len = f - file; f = (char *)malloc (len + 1); @@ -686,6 +686,8 @@ bgPixmap_t::set_file (const char *file) original_asim = get_asimage (target->asimman, f, 0xFFFFFFFF, 100); free (f); } + else + original_asim = get_asimage (target->asimman, file, 0xFFFFFFFF, 100); return original_asim; # endif @@ -1119,9 +1121,11 @@ bgPixmap_t::render () if (target == NULL) return false; + target->init_asv (); + TIMING_TEST_START (tp); - invalidate(); + invalidate (); # ifdef ENABLE_TRANSPARENCY if (flags & isTransparent) { @@ -1143,7 +1147,7 @@ bgPixmap_t::render () ASImage *background = NULL; ARGB32 as_tint = TINT_LEAVE_SAME; if (background_flags) - background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100); + background = pixmap2ximage (target->asv, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, 100); # ifdef ENABLE_TRANSPARENCY if (!(background_flags & transpPmapTinted) && (flags & tintNeeded)) @@ -1160,6 +1164,7 @@ bgPixmap_t::render () as_tint = shading2tint32 (&as_shade); } + if (!(background_flags & transpPmapBlured) && (flags & blurNeeded) && background != NULL) { ASImage* tmp = blur_asimage_gauss (target->asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, @@ -1176,12 +1181,10 @@ bgPixmap_t::render () if (render_asim (background, as_tint)) flags = flags & ~isInvalid; if (background) - destroy_asimage (&background); + destroy_asimage (&background); } else if (background_flags && pmap_depth != target->depth) - { - result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); - } + result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); # elif !XFT /* our own client-side tinting */ @@ -1191,6 +1194,7 @@ bgPixmap_t::render () if (background_flags && (flags & isInvalid)) { result = XGetImage (target->dpy, pixmap, 0, 0, pmap_width, pmap_height, AllPlanes, ZPixmap); + if (result != NULL && !(background_flags & transpPmapTinted) && (flags & tintNeeded)) { rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); @@ -1275,6 +1279,7 @@ bgPixmap_t::set_target (rxvt_term *new_target) # endif return true; } + return false; } diff --git a/src/background.h b/src/background.h index 431afee8..9b6a0b23 100644 --- a/src/background.h +++ b/src/background.h @@ -19,35 +19,41 @@ struct bgPixmap_t void destroy (); enum { - geometrySet = (1UL<<0), - propScale = (1UL<<1), - geometryFlags = (geometrySet|propScale), - - tintSet = (1UL<<8), - tintNeeded = (1UL<<9), - tintWholesome = (1UL<<10), - tintServerSide = (1UL<<11), - tintFlags = (tintSet|tintServerSide|tintNeeded|tintWholesome), - blurNeeded = (1UL<<12), - blurServerSide = (1UL<<13), /* this doesn't work yet */ - - isTransparent = (1UL<<16), - isInvalid = (1UL<<17), - isVtOrigin = (1UL<<18), /* if set pixmap has origin at corner of - vt window instead of parent[0]! */ - hasChanged = (1UL<<19) + geometrySet = 1 << 0, + propScale = 1 << 1, + geometryFlags = geometrySet | propScale, + + tintSet = 1 << 8, + tintNeeded = 1 << 9, + tintWholesome = 1 << 10, + tintServerSide = 1 << 11, + tintFlags = tintSet | tintServerSide | tintNeeded | tintWholesome, + + blurNeeded = 1 << 12, + blurServerSide = 1 << 13, /* this doesn't work yet */ + + isTransparent = 1 << 16, + isInvalid = 1 << 17, + isVtOrigin = 1 << 18, /* if set pixmap has origin at corner of + vt window instead of parent[0]! */ + hasChanged = 1 << 19, }; - unsigned long flags; + unsigned int flags; enum { - transpPmapTiled = (1UL<<0), - transpPmapTinted = tintNeeded, - transpPmapBlured = blurNeeded, - transpTransformations = (tintNeeded|blurNeeded) + transpPmapTiled = 1 << 0, + transpPmapTinted = tintNeeded, + transpPmapBlured = blurNeeded, + transpTransformations = tintNeeded | blurNeeded, }; /* these flags are returned by make_transparency_pixmap if called */ - bool check_clearChanged () { bool r = flags & hasChanged; flags &= ~hasChanged; return r; }; + bool check_clearChanged () + { + bool r = flags & hasChanged; + flags &= ~hasChanged; + return r; + }; # ifdef BG_IMAGE_FROM_FILE # ifdef HAVE_AFTERIMAGE @@ -67,7 +73,10 @@ struct bgPixmap_t unsigned int h_scale, v_scale;/* percents of the window size */ int h_align, v_align; /* percents of the window size: 0 - left align, 50 - center, 100 - right */ - void unset_geometry () { flags = flags & ~geometryFlags; }; + void unset_geometry () + { + flags = flags & ~geometryFlags; + }; bool set_geometry (const char *geom); void set_defaultGeometry () { diff --git a/src/init.C b/src/init.C index e781623e..0a9040e3 100644 --- a/src/init.C +++ b/src/init.C @@ -394,17 +394,17 @@ rxvt_term::init_resources (int argc, const char *const *argv) select_visual (strtol (rs[Rs_depth], 0, 0)); #endif -#ifdef HAVE_AFTERIMAGE - set_application_name ((char*)rs[Rs_name]); - set_output_threshold (OUTPUT_LEVEL_WARNING); - asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); -#endif free (r_argv); for (int i = NUM_RESOURCES; i--; ) if (rs [i] == resval_undef) rs [i] = 0; +#ifdef HAVE_AFTERIMAGE + set_application_name ((char *)rs[Rs_name]); + set_output_threshold (OUTPUT_LEVEL_WARNING); +#endif + #if ENABLE_PERL if (!rs[Rs_perl_ext_1]) rs[Rs_perl_ext_1] = "default"; @@ -425,6 +425,7 @@ rxvt_term::init_resources (int argc, const char *const *argv) { if (!rs[Rs_title]) rs[Rs_title] = rxvt_basename (cmd_argv[0]); + if (!rs[Rs_iconName]) rs[Rs_iconName] = rs[Rs_title]; } @@ -432,6 +433,7 @@ rxvt_term::init_resources (int argc, const char *const *argv) { if (!rs[Rs_title]) rs[Rs_title] = rs[Rs_name]; + if (!rs[Rs_iconName]) rs[Rs_iconName] = rs[Rs_name]; } @@ -1143,10 +1145,13 @@ rxvt_term::create_windows (int argc, const char *const *argv) * set up icon hint * rs [Rs_iconfile] is path to icon, asv has been created in init_resources */ - if (rs [Rs_iconfile] && asv) + + if (rs [Rs_iconfile]) { + init_asv (); + ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); - if (im) + if (asv && im) { int w = im->width; int h = im->height; @@ -1167,7 +1172,7 @@ rxvt_term::create_windows (int argc, const char *const *argv) destroy_asimage (&result); XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, - PropModeReplace, (const unsigned char*) buffer, 2 + w * h); + PropModeReplace, (const unsigned char*) buffer, 2 + w * h); free (buffer); } else diff --git a/src/rxvt.h b/src/rxvt.h index ce8b3fbc..0b14b9b1 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -1029,6 +1029,12 @@ struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { #ifdef HAVE_AFTERIMAGE ASVisual *asv; ASImageManager *asimman; + + void init_asv () + { + if (!asv) + asv = create_asvisual_for_id (dpy, display->screen, depth, XVisualIDFromVisual (visual), cmap, NULL); + } #endif #if ENABLE_OVERLAY