- 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.
*----------------------------------------------------------------------*
*
* All portions of code are copyright by their respective author/s.
- * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com>
+ * Copyright (c) 2005-2008 Marc Lehmann <pcg@goof.com>
* Copyright (c) 2007 Sasha Vasko <sasha@aftercode.net>
*
* This program is free software; you can redistribute it and/or modify
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;
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);
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
if (target == NULL)
return false;
+ target->init_asv ();
+
TIMING_TEST_START (tp);
- invalidate();
+ invalidate ();
# ifdef ENABLE_TRANSPARENCY
if (flags & isTransparent)
{
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))
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,
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 */
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);
# endif
return true;
}
+
return false;
}
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
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 ()
{
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";
{
if (!rs[Rs_title])
rs[Rs_title] = rxvt_basename (cmd_argv[0]);
+
if (!rs[Rs_iconName])
rs[Rs_iconName] = rs[Rs_title];
}
{
if (!rs[Rs_title])
rs[Rs_title] = rs[Rs_name];
+
if (!rs[Rs_iconName])
rs[Rs_iconName] = rs[Rs_name];
}
* 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;
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
#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