* Arne Georg Gleditsch
> Ah, now I follow.  My mistake, I didn't realize styles could be set on
> a per-window basis.  I'll see if I can't make something work for my
> setup using WindowStyle.

Could something like the appended be appropriate?


                                                        Arne.
diff -ru fvwm-2.5.9.orig/fvwm/add_window.c fvwm-2.5.9/fvwm/add_window.c
--- fvwm-2.5.9.orig/fvwm/add_window.c	2004-02-19 10:36:01.000000000 +0100
+++ fvwm-2.5.9/fvwm/add_window.c	2004-03-13 23:08:10.000000000 +0100
@@ -84,6 +84,7 @@
 #include "frame.h"
 #include "colormaps.h"
 #include "decorations.h"
+#include "expand.h"
 
 /* ---------------------------- local definitions -------------------------- */
 
@@ -1461,6 +1462,8 @@
 	char *name;
 	int count;
 	int len;
+	window_style style;
+	char *template;
 
 	if (fw == NULL)
 	{
@@ -1521,6 +1524,32 @@
 		ext_name = name;
 	}
 
+	lookup_style(fw, &style);
+	template = SGET_VISIBLE_WNAME_FORMAT(style);
+
+	if (template != NULL)
+	{
+		char *arguments[11];
+		cond_rc_t dummy_rc;
+		const exec_context_t *exc;
+		exec_context_changes_t ecc;
+
+		memset(&arguments, 0, sizeof(arguments));
+		condrc_init(&dummy_rc);
+
+		ecc.type = EXCT_NULL;
+		ecc.w.fw = fw;
+		exc = exc_create_context(&ecc, ECC_TYPE | ECC_FW);
+
+		if (ext_name != name)
+			free(ext_name);
+
+		ext_name = expand_vars(template, arguments,
+				       False, False, &dummy_rc, exc);
+
+		exc_destroy_context(exc);
+	}
+	
 	if (is_icon)
 	{
 		fw->visible_icon_name = ext_name;
diff -ru fvwm-2.5.9.orig/fvwm/fvwm.h fvwm-2.5.9/fvwm/fvwm.h
--- fvwm-2.5.9.orig/fvwm/fvwm.h	2004-02-16 14:45:59.000000000 +0100
+++ fvwm-2.5.9/fvwm/fvwm.h	2004-03-13 22:58:06.000000000 +0100
@@ -530,6 +530,7 @@
 	unsigned recapture_honors_starts_on_page : 1;
 	unsigned has_placement_penalty : 1;
 	unsigned has_placement_percentage_penalty : 1;
+	unsigned has_visible_wname_format : 1;
 } style_flags;
 
 typedef struct
@@ -594,6 +595,7 @@
 	int start_screen;
 	int max_window_width;
 	int max_window_height;
+	char *visible_window_name_format;
 	int shade_anim_steps;
 	icon_boxes *icon_boxes;
 	float norm_placement_penalty;
diff -ru fvwm-2.5.9.orig/fvwm/style.c fvwm-2.5.9/fvwm/style.c
--- fvwm-2.5.9.orig/fvwm/style.c	2004-02-16 14:45:59.000000000 +0100
+++ fvwm-2.5.9/fvwm/style.c	2004-03-13 23:01:31.000000000 +0100
@@ -613,6 +613,23 @@
 			*merged_style,
 			SGET_75_PLACEMENT_PERCENTAGE_PENALTY(*add_style));
 	}
+	if (add_style->flag_mask.has_visible_wname_format)
+	{
+		if (do_free_src_and_alloc_copy)
+		{
+			SAFEFREE(SGET_VISIBLE_WNAME_FORMAT(*merged_style));
+
+			SSET_VISIBLE_WNAME_FORMAT(
+				*merged_style, (SGET_VISIBLE_WNAME_FORMAT(*add_style)) ?
+				safestrdup(SGET_VISIBLE_WNAME_FORMAT(*add_style)) : NULL);
+		}
+		else
+		{
+			SSET_VISIBLE_WNAME_FORMAT(
+				*merged_style, SGET_VISIBLE_WNAME_FORMAT(*add_style));
+		}
+	}
+
 	/* merge the style flags */
 
 	/*** ATTENTION:
@@ -3853,6 +3870,15 @@
 			S_SET_IS_PSIZE_FIXED(SCM(*ps), 1);
 			S_SET_IS_PSIZE_FIXED(SCC(*ps), 1);
 		}
+		else if (StrEquals(token, "VisibleWindowNameFormat"))
+		{
+			SAFEFREE(SGET_VISIBLE_WNAME_FORMAT(*ps));
+			GetNextToken(rest, &token);
+			SSET_VISIBLE_WNAME_FORMAT(*ps, token);
+			ps->flags.has_visible_wname_format = (token != NULL);
+			ps->flag_mask.has_visible_wname_format = 1;
+			ps->change_mask.has_visible_wname_format = 1;
+		}
 		else
 		{
 			found = False;
@@ -4613,6 +4639,13 @@
 		flags->do_update_cr_motion_method = True;
 	}
 
+	/* Visible window name format */
+	if (ret_style->change_mask.has_visible_wname_format)
+	{
+		flags->do_update_visible_window_name = True;
+		flags->do_redecorate = True;
+	}
+
 	return;
 }
 
diff -ru fvwm-2.5.9.orig/fvwm/style.h fvwm-2.5.9/fvwm/style.h
--- fvwm-2.5.9.orig/fvwm/style.h	2004-02-16 14:45:59.000000000 +0100
+++ fvwm-2.5.9/fvwm/style.h	2004-03-03 22:03:59.000000000 +0100
@@ -523,6 +523,10 @@
 	((s).max_window_height)
 #define SSET_MAX_WINDOW_HEIGHT(s,x) \
 	((s).max_window_height = (x))
+#define SGET_VISIBLE_WNAME_FORMAT(s) \
+	((s).visible_window_name_format)
+#define SSET_VISIBLE_WNAME_FORMAT(s,x) \
+	((s).visible_window_name_format = (x))
 #define SGET_WINDOW_SHADE_STEPS(s) \
 	((s).shade_anim_steps)
 #define SSET_WINDOW_SHADE_STEPS(s,x) \

Reply via email to