Hi,
giving it another try to get this patch applied :)
It adds a new placement mode 'UnderMousePlacement' to fvwm, placing new
windows centered under the current cursor position. I've been using this
for over a year now without problems.
--
Arwed v. Merkatz Source Mage GNU/Linux developer
http://www.sourcemage.org
? patchy
Index: fvwm/fvwm.1.in
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.1.in,v
retrieving revision 1.186
diff -u -r1.186 fvwm.1.in
--- fvwm/fvwm.1.in 9 Feb 2006 12:05:53 -0000 1.186
+++ fvwm/fvwm.1.in 10 Feb 2006 09:05:03 -0000
@@ -6579,7 +6579,7 @@
.IR StickyAcrossDesksIcon " / " !StickyAcrossDesksIcon ,
.IR ManualPlacement " / " CascadePlacement " / " MinOverlapPlacement " / "
.IR MinOverlapPercentPlacement " / " TileManualPlacement " / "
-.IR TileCascadePlacement , " / " CenterPlacement ,
+.IR TileCascadePlacement , " / " CenterPlacement , " / " UnderMousePlacement,
.IR MinOverlapPlacementPenalties ,
.IR MinOverlapPercentPlacementPenalties ,
.IR DecorateTransient " / " NakedTransient ,
@@ -7611,7 +7611,7 @@
Applications can place windows at a particular spot on the screen
either by window manager hints or a geometry specification. When
they do neither, then the window manager steps in to find a place
-for the window. Fvwm knows six ways to deal with this
+for the window. Fvwm knows seven ways to deal with this
situation. The default is
.IR TileCascadePlacement .
@@ -7635,6 +7635,9 @@
.IR ManualPlacement
as the fall-back method.
+.I UnderMousePlacement
+automatically places new windows centered under the current cursor position.
+
.I MinOverlapPlacement
automatically places new windows in a location in which the
overlapping area in pixels of other windows is minimized.
Index: fvwm/fvwm.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.h,v
retrieving revision 1.240
diff -u -r1.240 fvwm.h
--- fvwm/fvwm.h 11 Nov 2005 19:16:22 -0000 1.240
+++ fvwm/fvwm.h 10 Feb 2006 09:05:05 -0000
@@ -488,7 +488,8 @@
#define PLACE_TILECASCADE 0x5
#define PLACE_CASCADE_B 0x6
#define PLACE_MINOVERLAP 0x7
-#define PLACE_CENTER 0x8
+#define PLACE_CENTER 0x8
+#define PLACE_UNDERMOUSE 0x9
#define PLACE_MASK 0xF
unsigned placement_mode : 4;
unsigned ewmh_placement_mode : 2; /* see ewmh.h */
Index: fvwm/placement.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/placement.c,v
retrieving revision 1.139
diff -u -r1.139 placement.c
--- fvwm/placement.c 5 Jul 2005 08:12:22 -0000 1.139
+++ fvwm/placement.c 10 Feb 2006 09:05:08 -0000
@@ -1068,6 +1068,34 @@
fw, sflags, &screen_g, &xl, &yt, pdeltax, pdeltay, 0);
flags.is_smartly_placed = True;
break;
+ case PLACE_UNDERMOUSE:
+ {
+ int mx;
+ int my;
+ FQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild,
+ &mx, &my, &JunkX, &JunkY, &JunkMask);
+ xl = mx - (fw->frame_g.width / 2);
+ yt = my - (fw->frame_g.height / 2);
+ if (xl + fw->frame_g.width > screen_g.x + screen_g.width)
+ {
+ xl = screen_g.x + screen_g.width - fw->frame_g.width;
+ }
+ if (yt + fw->frame_g.height > screen_g.y + screen_g.height)
+ {
+ yt = screen_g.y + screen_g.height - fw->frame_g.height;
+ }
+ if (xl < screen_g.x)
+ {
+ xl = screen_g.x;
+ }
+ if (yt < screen_g.y)
+ {
+ yt = screen_g.y;
+ }
+ attr_g->x = xl;
+ attr_g->y = yt;
+ }
+ break;
default:
/* can't happen */
break;
@@ -1827,6 +1855,9 @@
case PLACE_MINOVERLAP:
a = "MinOverlap";
break;
+ case PLACE_UNDERMOUSE:
+ a = "UnderMouse";
+ break;
default:
a = "bug";
break;
Index: fvwm/style.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/style.c,v
retrieving revision 1.233
diff -u -r1.233 style.c
--- fvwm/style.c 1 Jan 2006 14:22:04 -0000 1.233
+++ fvwm/style.c 10 Feb 2006 09:05:16 -0000
@@ -3760,7 +3760,13 @@
break;
case 'u':
- if (StrEquals(token, "UsePPosition"))
+ if (StrEquals(token, "UnderMousePlacement"))
+ {
+ ps->flags.placement_mode = PLACE_UNDERMOUSE;
+ ps->flag_mask.placement_mode = PLACE_MASK;
+ ps->change_mask.placement_mode = PLACE_MASK;
+ }
+ else if (StrEquals(token, "UsePPosition"))
{
ps->flags.use_no_pposition = !on;
ps->flag_mask.use_no_pposition = 1;