Subject: Re: Passing events to Reparented windows

From: Dominik Vogt <[email-masked]>
Date: Fri, 2 Jul 2004 14:44:02 +0200

> Forgive my ignorance of anything more than the basics of xlib stuff here,
> I've read the XReparentWindow and related man pages, but I'd like to double
> check i'm heading in the right direction..
> 
> I had assumed there was some reason why when I swallowed a window with
> FvwmButtons (or Scott's FvwmTabs) it wouldnt get ConfigureNotify events
> when moved (double checked with xev -window ..),

The reason is that the swallowed window doe not move relative to
its parent.  When a decorated window is moved, fvwm sends a
synthetic ConfigureNotify event to the client, but FvwmButtons
does not do this (for whatever reason).

> not a big problem but it
> meant that things like transparent terminals didnt work properly...but
> messing around today, it seems pretty easy to pass the events to the
> swallowed windows and it works exactly how I'd expect...am I missing
> something?

This was simply forgotten when implementing FvwmButtons.

> Is it worth submiting the patch?

Yes.

> Should it be optional, eg Swallow(PassEvents, UseOld, etc...).

Some applications may do funny things if they see the
ConfigureNotiy event, but they would already do so when they are
swallowed initially.  So I'd say an option is not necessary.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]

---

From: Tavis Ormandy <[email-masked]>
Date: Sat, 3 Jul 2004 10:52:49 +0100

[sorry if this comes twice, my last reply never reached the list]

> > Is it worth submiting the patch?

Thanks for the reply Dominik, This is the patch I've been using, I'm
sure it's horribly wrong, but it does seem to get Swallowed transparent
windows updated correctly :)

Maybe it will at least help demonstrate what I was talking about :)

Example configuration (requires rxvt >=2.7.3, I think):

Colorset 34 fg black, bg white, RootTransparent buffer
DestroyModuleConfig FvwmTest: *
*FvwmTest: Geometry 634x384
*FvwmTest: Colorset 34
*FvwmTest: Rows 2
*FVwmTest: Columns 2
*FvwmTest: (1x1, Swallow TransTerm `Exec exec rxvt -tr -name TransTerm -e rain -d 200`)
*FvwmTest: (1x1, Swallow TransTerm `Exec exec rxvt -tr -name TransTerm -e rain -d 200`)
*FvwmTest: (2x1, Title "Close", Action `Current Close`)

-- 
-------------------------------------
[email-masked] | finger me for my gpg key.
-------------------------------------------------------
Index: FvwmButtons.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmButtons/FvwmButtons.c,v
retrieving revision 1.186
diff -u -w -r1.186 FvwmButtons.c
--- FvwmButtons.c	29 Jun 2004 18:05:55 -0000	1.186
+++ FvwmButtons.c	3 Jul 2004 09:39:30 -0000
@@ -1070,7 +1070,43 @@
 	else if (Event.xconfigure.window == MyWindow &&
 		 Event.xconfigure.send_event)
 	{
+	  button=-1;
+	  ub=UberButton;
+
 	  update_root_transparency(&Event);
+	  while(NextButton(&ub,&b,&button,0))
+	  {
+		  if ((b->flags & b_Swallow) && SwallowedWindow(b))
+		  {
+			  Window swin = SwallowedWindow(b), br;
+			  XEvent BEvent;
+			  unsigned int bx, by, bw, bh, bbw, bd;
+
+			  if (!XGetGeometry(Dpy, swin, &br, &bx, &by, &bw, &bh, &bbw, &bd))
+			  {
+			  	continue;
+			  }
+
+#ifdef DEBUG_EVENTS
+			  fprintf (stderr, "Sending ConfigureNotify to Button: %#9x\n"
+			  	"New Position: %ux%u\n", 
+					(int) swin, 
+					Event.xconfigure.x+b->x, 
+					Event.xconfigure.y+b->y);
+#endif
+
+			  BEvent.type = ConfigureNotify;
+			  BEvent.xconfigure.display = Dpy;
+			  BEvent.xconfigure.event = swin;
+			  BEvent.xconfigure.window = swin;
+			  BEvent.xconfigure.x = Event.xconfigure.x+bx;
+			  BEvent.xconfigure.y = Event.xconfigure.y+by;
+			  BEvent.xconfigure.width = bw;
+			  BEvent.xconfigure.height = bh;
+			  BEvent.xconfigure.border_width = bbw;
+			  FSendEvent(Dpy, swin, False, StructureNotifyMask, &BEvent);
+	  	  }
+	  }
 	}
       }
       break;

---

From: Tavis Ormandy <[email-masked]>
Date: Fri, 2 Jul 2004 23:10:54 +0100

+++ FvwmButtons.c	2 Jul 2004 22:06:16 -0000
+		  if (b->flags & b_Swallow && SwallowedWindow(b))

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 5 Jul 2004 14:36:49 +0200

> windows updated correctly :)

No, the patch is fine (but see below).

> Index: FvwmButtons.c

Add

                          fev_make_null_event(&Bevent, Dpy);

> +			  BEvent.xconfigure.display = Dpy;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Remove this line.

> +			  BEvent.xconfigure.border_width = bbw;

Add

			  BEvent.xconfigure.above = None;
			  BEvent.override_redirect = False;

Ciao

Dominik ^_^  ^_^