PATCH: New style, CenterPlacement. This patch is as complete as I can make it.

2004-05-27 Thread Francis Litterio
Per Dan's request that I submit a complete patch, I've updated my recent
CenterPlacement patch to be as complete as I can make it.  The attached
file contains changes to these files:

AUTHORS
ChangeLog
NEWS
fvwm/fvwm.1.in
fvwm/fvwm.h
fvwm/placement.c
fvwm/style.c
sample.fvwmrc/system.fvwm2rc-sample-1

I was unable to figure out how to write a test for the CenterPlacement
style, so I didn't change tests/purify/purify.fvwm2rc.

I hope the FVWM developers find this functionality useful.
--
Francis Litterio
[EMAIL PROTECTED]
http://world.std.com/~franl/
GPG and PGP public keys available on keyservers.

Index: AUTHORS
===
RCS file: /home/cvs/fvwm/fvwm/AUTHORS,v
retrieving revision 1.93
diff -u -r1.93 AUTHORS
--- AUTHORS 23 May 2004 16:20:23 -  1.93
+++ AUTHORS 27 May 2004 16:35:41 -
@@ -25,7 +25,7 @@
 command.
 
 Francis Litterio:
-Fixed building FvwmScript under cygwin.
+Fixed building FvwmScript under cygwin.  Added CenterPlacement style.
 
 David Fries:
 Fixed the GNOME1 patch. WindowList class name sorting.
Index: ChangeLog
===
RCS file: /home/cvs/fvwm/fvwm/ChangeLog,v
retrieving revision 1.2491
diff -u -r1.2491 ChangeLog
--- ChangeLog   26 May 2004 08:25:24 -  1.2491
+++ ChangeLog   27 May 2004 16:35:50 -
@@ -1,3 +1,11 @@
+2004-05-26  Francis Litterio  [EMAIL PROTECTED]
+
+   * fvwm/fvwm.1.in
+   * fvmw/fvwm.h
+   * fvwm/placement.c (__place_get_wm_pos)
+   * fvwm/style.c (style_parse_one_style_option)
+   Added support for new CenterPlacement style (cf. macro PLACE_CENTER).
+   
 2004-05-26  Dominik Vogt  [EMAIL PROTECTED]
 
* fvwm/placement.c (__place_get_wm_pos):
Index: NEWS
===
RCS file: /home/cvs/fvwm/fvwm/NEWS,v
retrieving revision 1.520
diff -u -r1.520 NEWS
--- NEWS21 Apr 2004 23:04:49 -  1.520
+++ NEWS27 May 2004 16:35:52 -
@@ -16,6 +16,8 @@
 
 * New Style option State.
 
+* New Style option CenterPlacement.
+
 ---
 
 Changes in alpha release 2.5.10 (19-Mar-2004)
Index: fvwm/fvwm.1.in
===
RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.1.in,v
retrieving revision 1.134
diff -u -r1.134 fvwm.1.in
--- fvwm/fvwm.1.in  9 May 2004 12:59:55 -   1.134
+++ fvwm/fvwm.1.in  27 May 2004 16:35:59 -
@@ -6256,7 +6256,7 @@
 .IR StickyAcrossDesksIcon  /  !StickyAcrossDesksIcon ,
 .IR ManualPlacement  /  CascadePlacement  /  MinOverlapPlacement  / 
 .IR MinOverlapPercentPlacement  /  TileManualPlacement  / 
-.IR TileCascadePlacement ,
+.IR TileCascadePlacement ,  /  CenterPlacement ,
 .IR MinOverlapPlacementPenalties ,
 .IR MinOverlapPercentPlacementPenalties ,
 .IR DecorateTransient  /  NakedTransient ,
@@ -7295,6 +7295,9 @@
 situation. The default is
 .IR TileCascadePlacement .
 
+.I CenterPlacement
+automatically places new windows in the center of the display.
+
 .I CascadePlacement
 automatically place new windows in a cascading fashion.
 
Index: fvwm/fvwm.h
===
RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.h,v
retrieving revision 1.230
diff -u -r1.230 fvwm.h
--- fvwm/fvwm.h 2 Apr 2004 12:09:33 -   1.230
+++ fvwm/fvwm.h 27 May 2004 16:36:01 -
@@ -467,8 +467,9 @@
 #define PLACE_TILECASCADE   0x5
 #define PLACE_CASCADE_B 0x6
 #define PLACE_MINOVERLAP0x7
-#define PLACE_MASK  0x7
-   unsigned placement_mode : 3;
+#define PLACE_CENTER   0x8
+#define PLACE_MASK  0xF
+   unsigned placement_mode : 4;
unsigned ewmh_placement_mode : 2; /* see ewmh.h */
 #define WS_CR_MOTION_METHOD_AUTO CR_MOTION_METHOD_AUTO
 #define WS_CR_MOTION_METHOD_USE_GRAV CR_MOTION_METHOD_USE_GRAV
Index: fvwm/placement.c
===
RCS file: /home/cvs/fvwm/fvwm/fvwm/placement.c,v
retrieving revision 1.135
diff -u -r1.135 placement.c
--- fvwm/placement.c26 May 2004 08:25:24 -  1.135
+++ fvwm/placement.c27 May 2004 16:36:02 -
@@ -898,6 +898,20 @@
reason-pos.algo = placement_mode;
switch (placement_mode)
{
+   case PLACE_CENTER:
+   attr_g-x = (screen_g.width - fw-frame_g.width) / 2;
+   attr_g-y = ((screen_g.height - fw-frame_g.height) / 2) + 
fw-title_thickness;
+
+   /* Don't let the upper left corner be offscreen. */
+   if (attr_g-x  PageLeft)
+   {
+   attr_g-x = PageLeft;
+   }
+   if (attr_g-y  PageTop)
+   {
+   attr_g-y = PageTop;
+   }
+   break;
case 

Re: PATCH: New style, CenterPlacement. This patch is as complete as I can make it.

2004-05-27 Thread Dan Espen
Francis Litterio [EMAIL PROTECTED] writes:
 
 --=-=-=
 
 Per Dan's request that I submit a complete patch, I've updated my recent
 CenterPlacement patch to be as complete as I can make it.  The attached
 file contains changes to these files:
 
   AUTHORS
   ChangeLog
   NEWS
   fvwm/fvwm.1.in
   fvwm/fvwm.h
   fvwm/placement.c
   fvwm/style.c
   sample.fvwmrc/system.fvwm2rc-sample-1
 
 I was unable to figure out how to write a test for the CenterPlacement
 style, so I didn't change tests/purify/purify.fvwm2rc.


I'll take a close look at the patch, probably this weekend.
For the purify.fvm2rc, all that is needed is an invocation of
the command.  We run that file under a debugger that checks
for memory leaks and uninitialized variables.  No need to resubmit
for that, I'll take care of it.

I've been wondering if CenterPlacement isn't a special case of something
else, like TopCenterPlacement or UpperRightCornerPlacement but so far,
no useful insight has come to me so I think this is OK.


-- 
Dan Espen   E-mail: [EMAIL PROTECTED]
--
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 PROTECTED]
To report problems, send mail to [EMAIL PROTECTED]