Hello,

Please try the patch attached.  I've not yet updated the documentation, but
in your case, Vincent, you should just be able to do:

Style Display !AllowShapeHints

... and even with XShape support compiled against FVWM, the border of the
Display window won't disappear now.

Note that the Display XClient is definitely to blame here -- but I've
neither the gumption or interest to track it down -- and either way, having
a circumventative measure in FVWM is probably a good thing, hence why I'm
fixing it here, rather than getting knee deep in Imagemagick.

One of the caveats with this though, is the style only applies once the
window is mapped, and unlike most other styles *cannot* then toggle the
state of AllowShapeHints, until the window is closed and re-mapped.  This is
a limitation with XShape.

-- Thomas Adam
commit fadb9ba9e7b6820afa9556ba71ae3e3d0e12e7e2
Author: Thomas Adam <tho...@xteddy.org>
Date:   Tue Oct 5 21:20:00 2010 +0100

    Tentative fix for shaped windows (Debian #588537)
    
    Flesh out how we might handle explicitly not applying window shape masks to
    windows which would otherwise do so.  Whilst this fixes a bug in display(1)
    which is part of Imagemagick, it should be noted that this "fix" will only
    apply to windows which -- if they have shaped support defined -- are still
    under FVWM's control (that is, without OverrideRedirect set).
    
    In the case of "xteddy -wm" (dear little xteddy!), this will never show a
    border around the window, irrespective of any AllowShapeHints style set, as
    the client in question never accepts such values in the first place.
    There's nothing FVWM can do about this.
---
 fvwm/ConfigFvwmDefaults |    1 +
 fvwm/frame.c            |    2 +-
 fvwm/fvwm.c             |    1 +
 fvwm/fvwm.h             |    1 +
 fvwm/geometry.c         |    3 ++-
 fvwm/style.c            |    6 ++++++
 fvwm/style.h            |    4 ++++
 fvwm/window_flags.h     |    6 ++++++
 8 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/fvwm/ConfigFvwmDefaults b/fvwm/ConfigFvwmDefaults
index 0c578f0..182036f 100644
--- a/fvwm/ConfigFvwmDefaults
+++ b/fvwm/ConfigFvwmDefaults
@@ -46,6 +46,7 @@ Style * LowerTransient, RaiseTransient, StackTransientParent
 Style * TileCascadePlacement, Title, MouseFocus
 Style * UseIconPosition, RightTitleRotatedCW, UseTitleDecorRotation
 Style * EWMHPlacementUseDynamicWorkingArea, EWMHMaximizeUseDynamicWorkingArea
+Style * AllowShapeHints
 # Default styles for tear off menus
 Style fvwm_menu NoPPosition, NeverFocus, NoLenience, \
 	WindowListSkip, CirculateSkip
diff --git a/fvwm/frame.c b/fvwm/frame.c
index a42efa9..bd91bee 100644
--- a/fvwm/frame.c
+++ b/fvwm/frame.c
@@ -2092,7 +2092,7 @@ void frame_setup_shape(FvwmWindow *fw, int w, int h, int shape_mode)
 	rectangle r;
 	size_borders b;
 
-	if (!FShapesSupported)
+	if (!FShapesSupported || !ALLOW_SHAPE_HINTS(fw))
 	{
 		return;
 	}
diff --git a/fvwm/fvwm.c b/fvwm/fvwm.c
index 710f5ec..e6be83f 100644
--- a/fvwm/fvwm.c
+++ b/fvwm/fvwm.c
@@ -1382,6 +1382,7 @@ static void SetRCDefaults(void)
 		{ "DefaultColors black grey", "", "" },
 		{ DEFAULT_MENU_STYLE, "", "" },
 		{ "TitleStyle Centered -- Raised", "", "" },
+		{ "Style * AllowShapeHints", "", "" },
 		{ "Style * Color lightgrey/dimgrey", "", "" },
 		{ "Style * HilightFore black, HilightBack grey", "", "" },
 		{
diff --git a/fvwm/fvwm.h b/fvwm/fvwm.h
index ddeb8c9..1872f66 100644
--- a/fvwm/fvwm.h
+++ b/fvwm/fvwm.h
@@ -268,6 +268,7 @@ typedef struct
 #define WINDOWSHADE_LAZY_MASK   0x3
 		unsigned windowshade_laziness : 2;
 		unsigned use_title_decor_rotation : 1;
+		unsigned allow_shape_hints : 1;
 		focus_policy_t focus_policy;
 	} s;
 } common_flags_t;
diff --git a/fvwm/geometry.c b/fvwm/geometry.c
index f6eeeeb..cf234d5 100644
--- a/fvwm/geometry.c
+++ b/fvwm/geometry.c
@@ -523,7 +523,8 @@ void set_window_border_size(
 	else
 	{
 		fw->unshaped_boundary_width = used_width;
-		fw->boundary_width = (fw->wShaped) ? 0 : used_width;
+		fw->boundary_width = (fw->wShaped && !ALLOW_SHAPE_HINTS(fw))
+			? 0 : used_width;
 	}
 
 	return;
diff --git a/fvwm/style.c b/fvwm/style.c
index eebf4f8..712c50a 100644
--- a/fvwm/style.c
+++ b/fvwm/style.c
@@ -2091,6 +2091,12 @@ static Bool style_parse_one_style_option(
 			S_SET_DO_IGNORE_RESTACK(SCM(*ps), 1);
 			S_SET_DO_IGNORE_RESTACK(SCC(*ps), 1);
 		}
+		else if (StrEquals(token, "AllowShapeHints"))
+		{
+			S_SET_ALLOW_SHAPE_HINTS(SCF(*ps), on);
+			S_SET_ALLOW_SHAPE_HINTS(SCM(*ps), 1);
+			S_SET_ALLOW_SHAPE_HINTS(SCC(*ps), 1);
+		}
 		else if (StrEquals(token, "AllowMaximizeFixedSize"))
 		{
 			S_SET_MAXIMIZE_FIXED_SIZE_DISALLOWED(SCF(*ps), !on);
diff --git a/fvwm/style.h b/fvwm/style.h
index 0a2bc68..452646a 100644
--- a/fvwm/style.h
+++ b/fvwm/style.h
@@ -321,6 +321,10 @@
 	((c).s.use_icon_position_hint)
 #define S_SET_USE_ICON_POSITION_HINT(c,x) \
 	((c).s.use_icon_position_hint = !!(x))
+#define S_ALLOW_SHAPE_HINTS(c) \
+	((c).s.allow_shape_hints)
+#define S_SET_ALLOW_SHAPE_HINTS(c,x) \
+	((c).s.allow_shape_hints = !!(x))
 #define S_USE_INDEXED_WINDOW_NAME(c) \
 	((c).s.use_indexed_window_name)
 #define S_SET_USE_INDEXED_WINDOW_NAME(c,x) \
diff --git a/fvwm/window_flags.h b/fvwm/window_flags.h
index 9aa762e..4fbbe33 100644
--- a/fvwm/window_flags.h
+++ b/fvwm/window_flags.h
@@ -123,6 +123,12 @@
 	(fw)->flags.common.s.use_icon_position_hint = !!(x)
 #define SETM_USE_ICON_POSITION_HINT(fw,x) \
 	(fw)->flag_mask.common.s.use_icon_position_hint = !!(x)
+#define ALLOW_SHAPE_HINTS(fw) \
+	((fw)->flags.common.s.allow_shape_hints)
+#define SET_ALLOW_SHAPE_HINTS(fw,x) \
+	(fw)->flags.common.s.allow_shape_hints = !!(x)
+#define SETM_ALLOW_SHAPE_HINTS(fw,x) \
+	(fw)->flag_mask.common.s.allow_shape_hints = !!(x)
 #define USE_INDEXED_WINDOW_NAME(fw) \
 	((fw)->flags.common.s.use_indexed_window_name)
 #define SET_USE_INDEXED_WINDOW_NAME(fw,x) \

Reply via email to