Subject: MultiPixmap Titlebars Fix

From: Suzanne Skinner <[email-masked]>
Date: Tue, 20 Aug 2002 01:14:16 -0400

Greets all,

The attached patch (applied to fvwm-snap-20020819) fixes MultiPixmap titlebars
in CVS!

It turned out to be quite straightforward, as you'll see...

Suzanne

-- 
[email-masked] - http://www.igs.net/~tril/
--- fvwm/borders.c.orig	Tue Aug 20 00:31:43 2002
+++ fvwm/borders.c	Tue Aug 20 00:41:06 2002
@@ -200,8 +200,8 @@
  *  by DrawMultiPixmapTitlebar. ([email-masked])
  *
  ****************************************************************************/
-static void RenderIntoWindow(
-	GC gc, FvwmPicture *src, Window dest, int x_start, int y_start,
+static void RenderIntoPixmap(
+	GC gc, FvwmPicture *src, Pixmap dest, int x_start, int y_start,
 	int width, int height, Bool stretch)
 {
 	Pixmap pm;
@@ -247,9 +247,9 @@
  *
  ****************************************************************************/
 #define SWAP_ARGS(f,a1,a2) (f)?(a2):(a1),(f)?(a1):(a2)
-static void DrawMultiPixmapTitlebar(FvwmWindow *fw, DecorFace *df)
+static void DrawMultiPixmapTitlebar(FvwmWindow *fw, DecorFace *df,
+                                    Pixmap dest_pix)
 {
-	Window title_win;
 	GC gc;
 	char *title;
 	FvwmPicture **pm;
@@ -265,7 +265,6 @@
 	stretch_flags = df->u.multi_stretch_flags;
 	gc = Scr.TitleGC;
 	XSetClipMask(dpy, gc, None);
-	title_win = FW_W_TITLE(fw);
 	title = fw->visible_name;
 
 	tmp_g.width = 0;
@@ -273,14 +272,14 @@
 	get_title_geometry(fw, &tmp_g);
 	if (pm[TBP_MAIN])
 	{
-		RenderIntoWindow(
-			gc, pm[TBP_MAIN], title_win, 0, 0, tmp_g.width,
+		RenderIntoPixmap(
+			gc, pm[TBP_MAIN], dest_pix, 0, 0, tmp_g.width,
 			tmp_g.height, (stretch_flags & (1 << TBP_MAIN)));
 	}
 	else if (!title)
 	{
-		RenderIntoWindow(
-			gc, pm[TBP_LEFT_MAIN], title_win, 0, 0, tmp_g.width,
+		RenderIntoPixmap(
+			gc, pm[TBP_LEFT_MAIN], dest_pix, 0, 0, tmp_g.width,
 			tmp_g.height, (stretch_flags & (1 << TBP_LEFT_MAIN)));
 	}
 
@@ -347,16 +346,16 @@
 
 		if (pm[TBP_LEFT_MAIN] && before_space > 0)
 		{
-			RenderIntoWindow(
-				gc, pm[TBP_LEFT_MAIN], title_win, 0, 0,
+			RenderIntoPixmap(
+				gc, pm[TBP_LEFT_MAIN], dest_pix, 0, 0,
 				SWAP_ARGS(has_vt, before_space,
 					  fw->title_thickness),
 				(stretch_flags & (1 << TBP_LEFT_MAIN)));
 		}
 		if (pm[TBP_RIGHT_MAIN] && after_space > 0)
 		{
-			RenderIntoWindow(
-				gc, pm[TBP_RIGHT_MAIN], title_win,
+			RenderIntoPixmap(
+				gc, pm[TBP_RIGHT_MAIN], dest_pix,
 				SWAP_ARGS(has_vt, under_offset + under_width,
 					  0),
 				SWAP_ARGS(has_vt, after_space,
@@ -365,8 +364,8 @@
 		}
 		if (pm[TBP_UNDER_TEXT] && under_width > 0)
 		{
-			RenderIntoWindow(
-				gc, pm[TBP_UNDER_TEXT], title_win,
+			RenderIntoPixmap(
+				gc, pm[TBP_UNDER_TEXT], dest_pix,
 				SWAP_ARGS(has_vt, under_offset, 0),
 				SWAP_ARGS(has_vt, under_width,
 					  fw->title_thickness),
@@ -377,7 +376,7 @@
 		{
 
 			XCopyArea(
-				dpy, pm[TBP_LEFT_OF_TEXT]->picture, title_win,
+				dpy, pm[TBP_LEFT_OF_TEXT]->picture, dest_pix,
 				gc, 0, 0,
 				SWAP_ARGS(has_vt, size,
 					  fw->title_thickness),
@@ -388,7 +387,7 @@
 		if (size > 0 && size <= after_space)
 		{
 			XCopyArea(
-				dpy, pm[TBP_RIGHT_OF_TEXT]->picture, title_win,
+				dpy, pm[TBP_RIGHT_OF_TEXT]->picture, dest_pix,
 				gc, 0, 0,
 				SWAP_ARGS(has_vt, size,
 					  fw->title_thickness),
@@ -396,11 +395,11 @@
 					  0));
 			after_space -= size;
 		}
-		size = fw->title_thickness;
-		text_offset = fw->title_text_offset;
+
+		text_offset = fw->title_text_offset + 2;
 		memset(&fstr, 0, sizeof(fstr));
 		fstr.str = fw->visible_name;
-		fstr.win = title_win;
+		fstr.win = dest_pix;
 		if (has_vt)
 		{
 			fstr.x = text_offset;
@@ -425,7 +424,7 @@
 	if (size > 0 && size <= before_space)
 	{
 		XCopyArea(
-			dpy, pm[TBP_LEFT_END]->picture, title_win, gc, 0, 0,
+			dpy, pm[TBP_LEFT_END]->picture, dest_pix, gc, 0, 0,
 			SWAP_ARGS(has_vt, size, fw->title_thickness),
 			0, 0);
 	}
@@ -433,7 +432,7 @@
 	if (size > 0 && size <= after_space)
 	{
 		XCopyArea(
-			dpy, pm[TBP_RIGHT_END]->picture, title_win, gc, 0, 0,
+			dpy, pm[TBP_RIGHT_END]->picture, dest_pix, gc, 0, 0,
 			SWAP_ARGS(has_vt, size, fw->title_thickness),
 			fw->title_length - size, 0);
 	}
@@ -2113,7 +2112,7 @@
 #ifdef FANCY_TITLEBARS
 	else if (tdd.df->style.face_type == MultiPixmap)
 	{
-		DrawMultiPixmapTitlebar(fw, tdd.df);
+		DrawMultiPixmapTitlebar(fw, tdd.df, dest_pix);
 	}
 #endif
 	else

---

From: Dominik Vogt <[email-masked]>
Date: Tue, 20 Aug 2002 10:17:03 +0200

> It turned out to be quite straightforward, as you'll see...

Great!  It's already in CVS :-)

Bye

Dominik ^_^  ^_^

 --
Dominik Vogt, mail: [email-masked], phone: 0721/91374-382
Schlund + Partner AG, Erbprinzenstr. 4-12, D-76133 Karlsruhe
--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]

---

From: Olivier Chapuis <[email-masked]>
Date: Fri, 30 Aug 2002 11:16:05 +0200

> It turned out to be quite straightforward, as you'll see...

Suzanne, a question. Why the mask and the alpha of the pictures
are not used in drawing a multipixmap title? I can easily add
this feature if there are no obstructions I do not see.

Regards, Olivier

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 30 Aug 2002 09:47:27 +0000

> this feature if there are no obstructions I do not see.

You may also want to synchronize the title text code with and without
TitleStyle MultiPixmap. :) It seems, currently font shadows are not
respected and text position is a bit different when MultiPixmap used.

Regards,
Mikhael.