From: root Date: Tue, 4 Nov 2008 11:03:28 +0000 (+0000) Subject: iconfile patch X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=30146389f01dc1d4053598788bcb540b4aa4b049;p=dana%2Furxvt.git iconfile patch --- diff --git a/Changes b/Changes index 888377aa..6c9e93ea 100644 --- a/Changes +++ b/Changes @@ -37,6 +37,7 @@ TODO: cursor over overlays, when focus change? monopolising the whole process by outputting a lot of text. - 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). 9.05 Sun Jun 15 20:09:20 CEST 2008 - new option --cd/chdir to set the starting working directory. diff --git a/doc/rxvt.1.pod b/doc/rxvt.1.pod index 6abc73f4..563d2283 100644 --- a/doc/rxvt.1.pod +++ b/doc/rxvt.1.pod @@ -184,6 +184,12 @@ radii to 1 and another to a large number creates interesting effects on some backgrounds. Maximum radius value is 128. Compile I; resource I. +=item B<-icon> I + +Compile I: Use the specified image as application icon. This +is used by many window managers, taskbars and pagers to represent the +appliation window; resource I. + =item B<-bg> I Window background colour; resource B. @@ -715,9 +721,13 @@ Specify background blending type; option B<-blt>. =item B I -Apply Gaussian Blurr with the specified radius to the transparent +Apply gaussian blur with the specified radius to the transparent background image; option B<-blr>. +=item B I + +Set the application icon pixmap; option B<-icon>. + =item B I Use the specified colour for the scrollbar [default #B2B2B2]. diff --git a/src/init.C b/src/init.C index ace90f42..e781623e 100644 --- a/src/init.C +++ b/src/init.C @@ -1137,6 +1137,53 @@ rxvt_term::create_windows (int argc, const char *const *argv) XmbSetWMProperties (dpy, top, NULL, NULL, (char **)argv, argc, &szHint, &wmHint, &classHint); +#if ENABLE_EWMH +# ifdef HAVE_AFTERIMAGE + /* + * set up icon hint + * rs [Rs_iconfile] is path to icon, asv has been created in init_resources + */ + if (rs [Rs_iconfile] && asv) + { + ASImage *im = file2ASImage (rs [Rs_iconfile], 0xFFFFFFFF, SCREEN_GAMMA, 0, NULL); + if (im) + { + int w = im->width; + int h = im->height; + long* buffer = (long *)malloc ((2 + w * h) * sizeof (long)); + ASImage *result = scale_asimage (asv, im, + w, h, ASA_ARGB32, + 100, ASIMAGE_QUALITY_DEFAULT); + destroy_asimage (&im); + + if (buffer && result) + { + ARGB32 *asbuf = result->alt.argb32; + buffer [0] = w; + buffer [1] = h; + + for (unsigned int i = 0; i < w * h; ++i) + buffer [i + 2] = asbuf [i]; + + destroy_asimage (&result); + XChangeProperty (dpy, top, xa[XA_NET_WM_ICON], XA_CARDINAL, 32, + PropModeReplace, (const unsigned char*) buffer, 2 + w * h); + free (buffer); + } + else + { + if (!buffer) + rxvt_warn ("Memory allocation for icon hint failed, continuing without.\n"); + + if (!result) + rxvt_warn ("Icon image transformation to ARGB failed, continuing without.\n"); + } + } + else + rxvt_warn ("Loading image icon failed, continuing without.\n"); + } +# endif +#endif #if ENABLE_FRILLS if (mwmhints.flags) diff --git a/src/rsinc.h b/src/rsinc.h index 45aa5944..903a7716 100644 --- a/src/rsinc.h +++ b/src/rsinc.h @@ -116,4 +116,5 @@ #ifdef HAVE_AFTERIMAGE def (blendtype) def (blurradius) + def (iconfile) #endif diff --git a/src/rxvttoolkit.C b/src/rxvttoolkit.C index 103c58df..5110a818 100644 --- a/src/rxvttoolkit.C +++ b/src/rxvttoolkit.C @@ -61,6 +61,7 @@ const char *const xa_names[] = "_NET_WM_NAME", "_NET_WM_ICON_NAME", "_NET_WM_PING", + "_NET_WM_ICON", #endif #if USE_XIM "WM_LOCALE_NAME", diff --git a/src/rxvttoolkit.h b/src/rxvttoolkit.h index d009a9db..7b5ff29b 100644 --- a/src/rxvttoolkit.h +++ b/src/rxvttoolkit.h @@ -61,6 +61,7 @@ enum { XA_NET_WM_NAME, XA_NET_WM_ICON_NAME, XA_NET_WM_PING, + XA_NET_WM_ICON, #endif #if USE_XIM XA_WM_LOCALE_NAME, diff --git a/src/xdefaults.C b/src/xdefaults.C index c861f858..1b654c5c 100644 --- a/src/xdefaults.C +++ b/src/xdefaults.C @@ -263,7 +263,10 @@ optList[] = { #endif #ifdef HAVE_AFTERIMAGE STRG (Rs_blendtype, "blendType", "blt", "string", "background image blending type - alpha, tint, etc..."), - STRG (Rs_blurradius, "blurRadius", "blr", "HxV", "Gaussian Blur radii to apply to the root background"), + STRG (Rs_blurradius, "blurRadius", "blr", "HxV", "gaussian blur radii to apply to the root background"), +# if ENABLE_EWMH + STRG (Rs_iconfile, "iconFile", "icon", "file", "path to aplication icon image"), +# endif #endif INFO ("e", "command arg ...", "command to execute") };