Subject: FVWM: Twm-style Button3 placement patch for 2.0.46

From: Chris Siebenmann <[email-masked]>
Date: Thu, 23 Apr 1998 18:19:44 -0400

The following patch adds twm-style button 3 placement to window
placement. When manually placing a window, you can click Button3 and the
window will be placed where it is and either extended down to the bottom
of the screen or truncated at the bottom of the screen (if its bottom
is off the bottom of the screen). I don't know enough about how fvwm2
keyboard shortcuts are implemented to know if they can be used for this,
or if you'd have to use a real mouse button.

 Comments, feedback, etc is welcome.

	- cks
[apply this patch in any traditional way at the top of your fvwm 2.0.46
 source hierarchy and rebuild fvwm2.]
--- 1.1	1998/03/05 06:54:17
+++ fvwm/add_window.c	1998/03/05 07:25:03
@@ -44,8 +44,10 @@
 #include "fvwm.h"
 #include <X11/Xatom.h>
 #include "misc.h"
 #include "screen.h"
+/* For F_RESIZE, in turn for calling check_allowed_function2	- cks */
+#include	"parse.h"
 #ifdef SHAPE
 #include <X11/extensions/shape.h>
 #include <X11/Xresource.h>
 #endif /* SHAPE */
@@ -102,9 +104,9 @@
   char *decor = NULL;
 #endif
   unsigned long tflag;
   int Desk, border_width, resize_width;
-  extern Bool NeedToResizeToo;
+  extern Bool NeedToResizeToo, NeedToMaximizeToo;
   extern FvwmWindow *colormap_win;
   char *forecolor = NULL, *backcolor = NULL;
   int client_argc;
   char **client_argv = NULL, *str_type;
@@ -112,9 +114,9 @@
   XrmValue rm_value;
   XTextProperty text_prop;
   extern Bool PPosOverride;
 
-  NeedToResizeToo = False;
+  NeedToResizeToo = NeedToMaximizeToo = False;
   /* allocate space for the fvwm window */
   tmp_win = (FvwmWindow *)calloc(1, sizeof(FvwmWindow));
   if (tmp_win == (FvwmWindow *)0)
     {
@@ -709,8 +711,21 @@
       Event.xbutton.subwindow = None;
       Event.xany.window = tmp_win->w;
       resize_window(&Event , tmp_win->w, tmp_win, C_WINDOW, "", 0);
     }
+  if (NeedToMaximizeToo &&
+      (check_allowed_function2(F_RESIZE, tmp_win) != 0))
+    {
+	int	nwidth, nheight;
+	nwidth = tmp_win->frame_width;
+	/* Axiomatically tmp_win->frame_y is less than Scr.MyDisplayHeight.
+	   Or at least I hope so.		- cks */
+	nheight = Scr.MyDisplayHeight - tmp_win->frame_y;
+	ConstrainSize(tmp_win, &nwidth, &nheight);
+        SetupFrame (tmp_win, tmp_win->frame_x, 
+		    tmp_win->frame_y, nwidth, nheight, FALSE);
+    }
+
   InstallWindowColormaps(colormap_win);
   return (tmp_win);
 }
 
--- 1.1	1998/03/05 06:54:17
+++ fvwm/move.c	1998/03/05 06:55:45
@@ -27,8 +27,9 @@
 
 extern XEvent Event;
 extern int menuFromFrameOrWindowOrTitlebar;
 Bool NeedToResizeToo;
+Bool NeedToMaximizeToo;
 
 /****************************************************************************
  *
  * Start a window move operation
@@ -168,8 +169,13 @@
 	    {
 	      NeedToResizeToo = True;
 	      /* Fallthrough to button-release */
 	    }
+          else if (Event.xbutton.button == 3)
+	    {
+	      NeedToMaximizeToo = True;
+	      /* Fallthrough to button-release */
+ 	    }
 	  else
 	    {
 	      done = 1;
 	      break;
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].