Hi, with this patch it's now possible to do things like:
Style * SnapAttraction 15 Icons ScreenWindows Which means: - only icons snap at eatch other - windows only snap at the edges of the screen best regards
? .cproject
? .project
? fvwm_installed
Index: doc/commands/Style.xml
===================================================================
RCS file: /home/cvs/fvwm/fvwm/doc/commands/Style.xml,v
retrieving revision 1.11
diff -u -r1.11 Style.xml
--- doc/commands/Style.xml 19 Feb 2009 21:06:02 -0000 1.11
+++ doc/commands/Style.xml 30 Jul 2009 00:30:39 -0000
@@ -1292,19 +1292,32 @@
command.</para>
<para>The second argument determines is optional
-and may be set to one of the four following values: With
+and may be set to one of the five following values: With
<replaceable>All</replaceable> both icons and windows snap to
other windows and other icons. <replaceable>SameType</replaceable>
lets snap windows only to other windows and icons only to other
icons. With <replaceable>Windows</replaceable> windows snap only
to other windows. Icons do not snap. Similarly with
<replaceable>Icons</replaceable> icons snap to only other icons
-and windows do not snap. The default behavior is
+and windows do not snap. With <replaceable>None</replaceable>,
+noting snaps at each other. This option can be useful in conjunction
+with the following third argument if you only want to snap against
+the screen edges. The default behavior is
<emphasis remap='I'>All</emphasis>.</para>
-<para>If the option "Screen" option is added to at the last
-argument, windows and or icons snapp to the screen edges
-too.</para>
+<para>The third optional argument may be set to one of the four
+following values:
+<itemizedlist>
+<listitem><para>With <replaceable>Screen</replaceable>, the
+before defined (from second argument) icons and/or windows
+snap to the screen edges too.</para></listitem>
+<listitem><para><replaceable>ScreenWindows</replaceable> snap
+only windows to the screen edges.</para></listitem>
+<listitem><para><replaceable>ScreenIcons</replaceable> snap
+only icons to the screen edges.</para></listitem>
+<listitem><para><replaceable>ScreenAll</replaceable> snap
+windows and icons to the screen edges.</para></listitem>
+</itemizedlist></para>
<para>The option <fvwmopt cmd="Style" opt="SnapGrid"/> defines an
invisible grid on the screen. During an interactive move a window
Index: fvwm/move_resize.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/move_resize.c,v
retrieving revision 1.304
diff -u -r1.304 move_resize.c
--- fvwm/move_resize.c 7 Dec 2007 18:52:21 -0000 1.304
+++ fvwm/move_resize.c 30 Jul 2009 00:30:41 -0000
@@ -1926,7 +1926,7 @@
/*
* snap attraction
*/
- /* snap to other windows */
+ /* snap to other windows or icons*/
if ((fw->snap_mode & (SNAP_ICONS | SNAP_WINDOWS | SNAP_SAME)) &&
fw->snap_proximity > 0)
{
@@ -1941,29 +1941,29 @@
continue;
}
/* check snapping type */
- switch (fw->snap_mode)
+ switch (fw->snap_mode & ~(SNAP_SCREEN +
+ SNAP_SCREEN_WINDOWS + SNAP_SCREEN_ICONS +
+ + SNAP_SCREEN_ALL))
{
- case 1: /* SameType */
- if (IS_ICONIFIED(tmp) != IS_ICONIFIED(fw))
+ case SNAP_WINDOWS: /* we only snap Windows */
+ if (IS_ICONIFIED(tmp) || IS_ICONIFIED(fw))
{
continue;
}
break;
- case 2: /* Icons */
- if (!IS_ICONIFIED(tmp) ||
- !IS_ICONIFIED(fw))
+ case SNAP_ICONS: /* we only snap Icons */
+ if (!IS_ICONIFIED(tmp) || !IS_ICONIFIED(fw))
{
continue;
}
break;
- case 3: /* Windows */
- if (IS_ICONIFIED(tmp) || IS_ICONIFIED(fw))
+ case SNAP_SAME: /* we don't snap unequal */
+ if (IS_ICONIFIED(tmp) != IS_ICONIFIED(fw))
{
continue;
}
break;
- case 0: /* All */
- default:
+ default: /* All */
/* NOOP */
break;
}
@@ -2074,7 +2074,14 @@
} /* snap to other windows */
/* snap to screen egdes */
- if ((fw->snap_mode & SNAP_SCREEN) && fw->snap_proximity > 0)
+ if (fw->snap_proximity > 0 &&
+ ((fw->snap_mode & SNAP_SCREEN && !SNAP_NONE &&
+ ((SNAP_NONE | SNAP_SAME) ||
+ (IS_ICONIFIED(fw) && (fw->snap_mode & SNAP_ICONS)) ||
+ (!IS_ICONIFIED(fw) && (fw->snap_mode & SNAP_WINDOWS)))) ||
+ (!IS_ICONIFIED(fw) && (fw->snap_mode & SNAP_SCREEN_WINDOWS)) ||
+ (IS_ICONIFIED(fw) && (fw->snap_mode & SNAP_SCREEN_ICONS)) ||
+ (fw->snap_mode & SNAP_SCREEN_ALL)))
{
/* horizontally */
if (!(Scr.MyDisplayWidth < (*px) ||
Index: fvwm/style.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/style.c,v
retrieving revision 1.262
diff -u -r1.262 style.c
--- fvwm/style.c 6 Jul 2009 11:01:12 -0000 1.262
+++ fvwm/style.c 30 Jul 2009 00:30:44 -0000
@@ -4053,6 +4053,11 @@
snap_mode = SNAP_ICONS | SNAP_WINDOWS;
token = PeekToken(rest, &rest);
}
+ else if (StrEquals(token, "None"))
+ {
+ snap_mode = SNAP_NONE;
+ token = PeekToken(rest, &rest);
+ }
else if (StrEquals(token, "SameType"))
{
snap_mode = SNAP_SAME;
@@ -4076,6 +4081,18 @@
{
snap_mode |= SNAP_SCREEN;
}
+ else if (StrEquals(token, "ScreenWindows"))
+ {
+ snap_mode |= SNAP_SCREEN_WINDOWS;
+ }
+ else if (StrEquals(token, "ScreenIcons"))
+ {
+ snap_mode |= SNAP_SCREEN_ICONS;
+ }
+ else if (StrEquals(token, "ScreenAll"))
+ {
+ snap_mode |= SNAP_SCREEN_ALL;
+ }
} while (0);
ps->flags.has_snap_attraction = 1;
ps->flag_mask.has_snap_attraction = 1;
Index: fvwm/style.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/style.h,v
retrieving revision 1.90
diff -u -r1.90 style.h
--- fvwm/style.h 8 Feb 2009 11:01:45 -0000 1.90
+++ fvwm/style.h 30 Jul 2009 00:30:45 -0000
@@ -3,11 +3,14 @@
#ifndef _STYLE_
#define _STYLE_
-#define SNAP_NONE 0x00
-#define SNAP_WINDOWS 0x01
-#define SNAP_ICONS 0x02
-#define SNAP_SAME 0x04
-#define SNAP_SCREEN 0x08
+#define SNAP_NONE 0x01
+#define SNAP_WINDOWS 0x02
+#define SNAP_ICONS 0x04
+#define SNAP_SAME 0x08
+#define SNAP_SCREEN 0x10
+#define SNAP_SCREEN_WINDOWS 0x20
+#define SNAP_SCREEN_ICONS 0x40
+#define SNAP_SCREEN_ALL 0x80
/* access to the special flags of a style */
/* call these with a pointer to a style_flags struct */
Index: libs/defaults.h
===================================================================
RCS file: /home/cvs/fvwm/fvwm/libs/defaults.h,v
retrieving revision 1.82
diff -u -r1.82 defaults.h
--- libs/defaults.h 14 Mar 2008 17:22:42 -0000 1.82
+++ libs/defaults.h 30 Jul 2009 00:30:46 -0000
@@ -249,7 +249,7 @@
/*** movement ***/
#define DEFAULT_OPAQUE_MOVE_SIZE 5 /* percent of window area */
#define DEFAULT_SNAP_ATTRACTION 0
-#define DEFAULT_SNAP_ATTRACTION_MODE 0x3
+#define DEFAULT_SNAP_ATTRACTION_MODE 0x06 /* snap all */
#define DEFAULT_SNAP_GRID_X 1 /* pixels */
#define DEFAULT_SNAP_GRID_Y 1 /* pixels */
signature.asc
Description: This is a digitally signed message part.
