Subject: Notification: incoming/858

From: [email-masked]
Date: Tue, 26 Feb 2002 18:37:00 -0600

FVWM Bug Tracking notification

new message incoming/858

Message summary for PR#858
	From: [email-masked]
	Subject: New windows overlap 'system' toolbars
	Date: Tue, 26 Feb 2002 18:36:58 -0600
	0 replies 	0 followups

====> ORIGINAL MESSAGE FOLLOWS <====

>From [email-masked] Tue Feb 26 18:36:59 2002
From: [email-masked]
To: [email-masked]
Subject: New windows overlap 'system' toolbars
Date: Tue, 26 Feb 2002 18:36:58 -0600

Full_Name: Daniel Speyer
Version: 2.4.5
CVS_Date: 
OS: Debian GNU/Linux
X_Server: 4.1
Submission from: (NULL) (129.2.159.61)

I typically run with a toolbar of some sort on one side of the screen
(currently an FvwmButtons on the left, previously a combination of Fvwm
modules and Tcl/Tk scripts on the right, before that a taskbar-ish thing on
the bottom -- you get the idea).  However, when new windows popped up, they
didn't think of these bars as special, and went right over them (or under,
if I was using alwaysontop, but that wasn't much better).  This became
really annoying, because I think of those windows as seperate from my
desktop and I wanted windows to overlap them about as much as I wanted them
to run off the screen.

I've written a patch that makes Fvwm think the same way.  Essentially, it
lets you tell it how far from each edge should be thought of as
'off-screen,' and should only receive windows if they just don't fit
anywhere else.  

I've tested this patch for a while, and it seems quite stable.

--Daniel Speyer

P.S. I submitted the patch earlier to fvwm-workers but it seems to have
been ignored.  It occured to me that some projects prefer patches submitted
through bug tracking, so I'm trying this.

P.P.S Since every feature needs documentation, here's a man entry for it
(apologies for the plain text, I don't know man format)

  PlacementEdgeAvoid left top right bottom
	This command creates a region at each edge to 
	avoid when placing new windows.  This is useful
	for keeping toolbars, taskbars, global 
	menus, etc. from getting covered.  All arguments
	are mandatory.  If you don't have a toolbar on a
	given side, just use 0.

P.P.P.S. There doesn't seem to be an attatchment mechanism here, so I've
appended the patch:
diff -u -r fvwm-2.4.5/fvwm/commands.h fvwm-2.4.5-mine/fvwm/commands.h
--- fvwm-2.4.5/fvwm/commands.h	Wed Sep  5 12:39:56 2001
+++ fvwm-2.4.5-mine/fvwm/commands.h	Sun Feb 24 01:15:37 2002
@@ -119,6 +119,7 @@
 void CMD_PipeRead(F_CMD_ARGS);
 void CMD_PixmapPath(F_CMD_ARGS);
 void CMD_PlaceAgain(F_CMD_ARGS);
+void CMD_PlacementEdgeAvoid(F_CMD_ARGS);
 void CMD_PointerKey(F_CMD_ARGS);
 void CMD_Popup(F_CMD_ARGS);
 void CMD_Prev(F_CMD_ARGS);
diff -u -r fvwm-2.4.5/fvwm/functions.c fvwm-2.4.5-mine/fvwm/functions.c
--- fvwm-2.4.5/fvwm/functions.c	Thu Jan 17 07:32:08 2002
+++ fvwm-2.4.5-mine/fvwm/functions.c	Sun Feb 24 01:19:51 2002
@@ -194,6 +194,7 @@
   CMD_ENTRY("piperead", CMD_PipeRead, F_READ, 0),
   CMD_ENTRY("pixmappath", CMD_PixmapPath, F_PIXMAP_PATH, 0),
   CMD_ENTRY("placeagain", CMD_PlaceAgain, F_PLACEAGAIN,
FUNC_NEEDS_WINDOW),
+  CMD_ENTRY("placementedgeavoid", CMD_PlacementEdgeAvoid,
F_PLACEMENT_EDGE_AVOID, 0),
   CMD_ENTRY("pointerkey", CMD_PointerKey, F_POINTERKEY, 0),
   CMD_ENTRY("popup", CMD_Popup, F_POPUP, 0),
   CMD_ENTRY("prev", CMD_Prev, F_PREV, 0),
diff -u -r fvwm-2.4.5/fvwm/functions.h fvwm-2.4.5-mine/fvwm/functions.h
--- fvwm-2.4.5/fvwm/functions.h	Wed Sep  5 12:39:56 2001
+++ fvwm-2.4.5-mine/fvwm/functions.h	Sun Feb 24 01:20:13 2002
@@ -149,6 +149,7 @@
   F_OPAQUE,
   F_PICK,
   F_PIXMAP_PATH,
+  F_PLACEMENT_EDGE_AVOID,
   F_POINTERKEY,
   F_POPUP,
   F_PREV,
diff -u -r fvwm-2.4.5/fvwm/placement.c fvwm-2.4.5-mine/fvwm/placement.c
--- fvwm-2.4.5/fvwm/placement.c	Sun Dec  9 09:00:08 2001
+++ fvwm-2.4.5-mine/fvwm/placement.c	Sun Feb 24 01:14:56 2002
@@ -54,6 +54,12 @@
 #define MAX(A,B) ((A)>(B)? (A):(B))
 #endif
 
+static int PageEdgeAvoid_left=0;
+static int PageEdgeAvoid_top=0;
+static int PageEdgeAvoid_right=0;
+static int PageEdgeAvoid_bottom=0;
+
+
 static int get_next_x(
   FvwmWindow *t, rectangle *screen_g,
   int x, int y, int pdeltax, int pdeltay, int use_percent);
@@ -66,11 +72,30 @@
   FvwmWindow *t, rectangle *screen_g,
   int *x, int *y, int pdeltax, int pdeltay, int use_percent);
 
+void CMD_PlacementEdgeAvoid(F_CMD_ARGS)
+{
+  int val[4];
+  int n;
+
+  n = GetIntegerArguments(action, NULL, val, 4);
+  if (n != 4)
+  {
+    fvwm_msg(ERR, "PlacementEdgeAvoid",
+	     "PlacementEdgeAvoid require 4 arguments");
+    return;
+  }
+  PageEdgeAvoid_left = val[0];
+  PageEdgeAvoid_top = val[1];
+  PageEdgeAvoid_right = val[2];
+  PageEdgeAvoid_bottom = val[3];
+}
+
+
 static int SmartPlacement(
   FvwmWindow *t, rectangle *screen_g,
   int width, int height, int *x, int *y, int pdeltax, int pdeltay)
 {
-  int PageLeft   = screen_g->x - pdeltax;
+  int PageLeft   = screen_g->x - pdeltax + 50;
   int PageTop    = screen_g->y - pdeltay;
   int PageRight  = PageLeft + screen_g->width;
   int PageBottom = PageTop + screen_g->height;
@@ -586,6 +611,10 @@
   PageTop    = screen_g.y - pdeltay;
   PageRight  = PageLeft + screen_g.width;
   PageBottom = PageTop + screen_g.height;
+  PageLeft   += PageEdgeAvoid_left;
+  PageRight  -= PageEdgeAvoid_right;
+  PageTop    += PageEdgeAvoid_top;
+  PageBottom -= PageEdgeAvoid_bottom;
   yt = PageTop;
 
   /* Don't alter the existing desk location during Capture/Recapture.  */

--
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: Dominik Vogt <[email-masked]>
Date: Wed, 27 Feb 2002 07:36:08 +0100

> I've tested this patch for a while, and it seems quite stable.

I'm sorry that you did all this work for naught, but the 2.5.x
betas already have a method to control placement preferences on a
per-window basis.  It doesn't work with all placement methods
though.  Please check the styles MinOverlapPlacement and
PlacementOverlapPenalties.

> through bug tracking, so I'm trying this.

We prefer them on the mailing list.  I've been on a holiday and
had no time to reply yet.

Bye

Dominik ^_^  ^_^

-- 
Dominik Vogt, email: [email-masked]
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
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]