Subject: FVWM: FvwmBanner

From: Marco Mariani <[email-masked]>
Date: Sat, 24 Aug 1996 19:26:12 -0100 (GMT-0100)

The attached files are a patch to FvwmBanner and, just in case of an
inclusion in the fvwm package, to the manpage.

When I start up X, I like having a picture on the center of the background
(the silly linux penguin) for ten seconds. Unfortunately, I thought, if I
happen to click on the image, it disappears. My patch prevents it, by
introducing the option "*FvwmBannerMouse Ignore".

While I was at it, I also added FvwmBannerX and FvwmBannerY.

Now my question is: is there a way to pass the ButtonRelease to fvwm so that
it will display the root menu over the image?

All The Best,
 Marco

Excuse the waste of bandwidth, please send flames to my alternate address
([email-masked]).
--- FvwmBanner.c.orig	Sat Aug 24 16:19:32 1996
+++ FvwmBanner.c	Sat Aug 24 18:36:43 1996
@@ -71,8 +71,14 @@
 char *pixmapPath = NULL;
 char *pixmapName = NULL;
 char *myName = NULL;
+char *mouseoption = NULL;
 
 int timeout = 3000000; /* default time of 3 seconds */
+int ignoremouse = 0;
+int image_x = 0;
+int image_y = 0;
+int image_x_defined = 0;
+int image_y_defined = 0;
 
 Display *dpy;			/* which display are we talking to */
 Window Root;
@@ -187,8 +193,28 @@
   mysizehints.max_width = mysizehints.width;
   mysizehints.win_gravity = NorthWestGravity;
 
-  mysizehints.x = (ScreenWidth - view.attributes.width)/2;
-  mysizehints.y = (ScreenHeight - view.attributes.height)/2;
+#ifndef MAX
+#define MAX(x,y) ((x)>(y)?(x):(y))
+#define MIN(x,y) ((x)<(y)?(x):(y))
+#endif
+
+  if (image_x_defined) {
+    if (image_x>=0)
+      mysizehints.x = MIN(image_x,ScreenWidth-view.attributes.width);
+    else
+      mysizehints.x = MAX(ScreenWidth-view.attributes.width+image_x,0);
+  }
+  else mysizehints.x = (ScreenWidth - view.attributes.width)/2;
+
+
+  if (image_y_defined) {
+    if (image_y>=0)
+      mysizehints.y = MIN(image_y,ScreenHeight-view.attributes.height);
+    else
+      mysizehints.y = MAX(ScreenHeight-view.attributes.height+image_y,0);
+  }
+  else mysizehints.y = (ScreenHeight - view.attributes.height)/2;
+
 
   win = XCreateSimpleWindow(dpy,Root,mysizehints.x,mysizehints.y,
 				 mysizehints.width,mysizehints.height,
@@ -242,9 +268,12 @@
       switch(Event.type)
       {
         case ButtonRelease:
-          XDestroyWindow(dpy,win);
-          XSync(dpy,0);
-          exit(0);
+          if (!ignoremouse)
+          {
+            XDestroyWindow(dpy,win);
+            XSync(dpy,0);
+            exit(0);
+          }
         case ClientMessage:
           if (Event.xclient.format==32 && Event.xclient.data.l[0]==wm_del_win)
           {
@@ -339,6 +368,32 @@
 	  }
 	}
         continue;
+      }
+      if (mystrncasecmp (tline,
+			 CatString3 ("*", myName, "X"),
+			 clength + 2) ==0)
+      {
+	image_x = atoi(&tline[clength+2]);
+	image_x_defined = 1;
+	continue;
+      }
+      if (mystrncasecmp (tline,
+			 CatString3 ("*", myName, "Y"),
+			 clength + 2) ==0)
+      {
+	image_y = atoi(&tline[clength+2]);
+	image_y_defined = 1;
+	continue;
+      }
+      if (mystrncasecmp (tline,
+	      		 CatString3 ("*", myName, "Mouse"),
+			 clength + 6) ==0)
+      {
+	 CopyString (&mouseoption, &tline[clength+6]);
+	 if (mystrncasecmp (mouseoption, "Ignore", 7) ==0) {
+	   ignoremouse = 1;
+         }
+	 free (mouseoption);
       }
       if (mystrncasecmp (tline,
 			 CatString3 ("*", myName, "Timeout"),
--- FvwmBanner.man.orig	Sat Aug 24 17:16:58 1996
+++ FvwmBanner.man	Sat Aug 24 18:52:27 1996
@@ -1,6 +1,6 @@
 .\" t
 .\" @(#)FvwmBanner.1	1/12/94
-.TH FvwmBanner 1.20 "Jan 28, 1994"
+.TH FvwmBanner 1.21 "Aug 24, 1996"
 .UC
 .SH NAME
 FvwmBanner \- the FVWM Banner
@@ -8,7 +8,7 @@
 FvwmBanner is intended to be spawned by fvwm.
 
 .SH DESCRIPTION
-The FvwmInitBanner displays an Fvwm Logo in the center of the screen
+FvwmBanner displays an Fvwm Logo in the center of the screen
 for 3 seconds.
 
 .SH COPYRIGHTS
@@ -34,7 +34,22 @@
 .IP "*FvwmBannerTimeout \fIsec\fP"
 Tells the module to display for \fIsec\fP seconds instead of default of 3.
 
+.IP "*FvwmBannerMouse \fIIgnore\fP"
+Tells the module to ignore mouse button presses over the image.
+The default is to exit.
+
+.IP "*FvwmBannerX \fIx\fP"
+Tells the module to put the image \fIx\fP pixels from the left border of the
+screen.  A negative number refers to the right border.  The default is to
+put the image in the center.
+
+.IP "*FvwmBannerY \fIy\fP"
+Tells the module to put the image \fIy\fP pixels from the top border of the
+screen.  A negative number refers to the bottom border.  The default is to
+put the image in the center.
+
 
 .SH AUTHOR
-Robert Nation 
+Robert Nation.
+Mouse ignore and image position added by [email-masked].