On Thursday, 30. July 2009, Christoph Fritz wrote: > I'll send an updated version later this week. >
voila
Index: AUTHORS =================================================================== RCS file: /home/cvs/fvwm/fvwm/AUTHORS,v retrieving revision 1.132 diff -u -r1.132 AUTHORS --- AUTHORS 21 Feb 2009 22:18:09 -0000 1.132 +++ AUTHORS 2 Aug 2009 08:51:33 -0000 @@ -2,6 +2,11 @@ Maintainers of GNU Software" (maintain.texi), the section called "Recording Changes". +Christoph Fritz: +SnapAttraction bugfix "SameType" and "Screen" behaviour. +Implement options None/ScreenWindows/ScreenIcons/ScreenAll for +differentiated screen edge snapping. + Julio José Teca Nemesio: ChangeWindowTitle and ChangeWindowTitleFromArg FvwmScript instructions. ChangeWindowTitle FvwmScript command. Index: ChangeLog =================================================================== RCS file: /home/cvs/fvwm/fvwm/ChangeLog,v retrieving revision 1.3084 diff -u -r1.3084 ChangeLog --- ChangeLog 10 Jul 2009 09:34:48 -0000 1.3084 +++ ChangeLog 2 Aug 2009 08:51:45 -0000 @@ -1,3 +1,18 @@ +2009-07-31 Christoph Fritz <chris_honschu(at)gmx.de> + * fvwm/style.h: + * fvwm/fvwm.h: + * fvwm/add_window.c (setup_numeric_vals): + add "typedef struct snap_attraction_t" + * fvwm/style.c (style_parse_one_style_option): + add new SnapAttraction options "None", "ScreenWindows", + "ScreenIcons" and "ScreenAll" + * fvwm/move_resize.c (DoSnapAttract): + Bugfix, option SameType/Icons/Windows did falsely not affect + conditions of option "Screen" and option "SameType" snapped + falsely icons and windows together. Implement options + None/ScreenWindows/ScreenIcons/ScreenAll for differentiated + screen edge snapping. + 2009-07-10 Thomas Adam <[email protected]> * fvwm/add_window.c (setup_window_name_count): * fvwm/add_window.c (setup_icon_name_count): Index: NEWS =================================================================== RCS file: /home/cvs/fvwm/fvwm/NEWS,v retrieving revision 1.782 diff -u -r1.782 NEWS --- NEWS 10 Jul 2009 09:08:01 -0000 1.782 +++ NEWS 2 Aug 2009 08:51:46 -0000 @@ -5,6 +5,12 @@ Changes in beta release 2.5.28 (not released yet) +* New features: + + - New differentiated options for SnapAttraction when snapping + against screen edges: + "None", "ScreenWindows", "ScreenIcons", "ScreenAll" + * Bug fixes: - Fixed non-visible QT windows after a QT deferred map (e.g. @@ -18,7 +24,9 @@ and the utf8 name converted to the default charset match the old WM_NAME. - Fixed the options RPlayVolume and RPlayPriority in FvwmEvent. - + - Fixed SnapAttraction: Option SameType/Icons/Windows did + falsely not affect conditions of option "Screen" and option + "SameType" snapped falsely icons and windows together. ------------------------------------------------------------------- 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 2 Aug 2009 08:51:48 -0000 @@ -1291,20 +1291,30 @@ behavior. Please refer also to the <fvwmref cmd="SnapGrid"/> command.</para> -<para>The second argument determines is optional -and may be set to one of the four 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 -<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 second argument determined is optional 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 windows snap only to windows, and +icons snap only to icons. With <replaceable>Windows</replaceable> windows snap +only to other windows. Similarly with <replaceable>Icons</replaceable> icons +snap only to other icons. With <replaceable>None</replaceable> noting snaps to +each other. This option can be useful in conjunction with the following +argument if you only want to snap against the screen edges. The default +behavior is <emphasis remap='I'>All</emphasis>.</para> + +<para>The third and last optional argument may be set to one of the +four following values: +<itemizedlist> +<listitem><para>With <replaceable>Screen</replaceable> the +already snapping icons or windows, which is controlled by the second +argument, will snap now also to the screen edges.</para></listitem> +<listitem><para><replaceable>ScreenWindows</replaceable> snaps +only windows to the screen edges.</para></listitem> +<listitem><para><replaceable>ScreenIcons</replaceable> snaps +only icons to the screen edges.</para></listitem> +<listitem><para><replaceable>ScreenAll</replaceable> snaps +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/add_window.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/fvwm/add_window.c,v retrieving revision 1.400 diff -u -r1.400 add_window.c --- fvwm/add_window.c 10 Jul 2009 09:34:48 -0000 1.400 +++ fvwm/add_window.c 2 Aug 2009 08:51:50 -0000 @@ -784,8 +784,8 @@ fw->shade_anim_steps = pstyle->shade_anim_steps; /****** snapattraction, snapgrid, paging ******/ - fw->snap_proximity = pstyle->snap_proximity; - fw->snap_mode = pstyle->snap_mode; + fw->snap_attraction.proximity = pstyle->snap_attraction.proximity; + fw->snap_attraction.mode = pstyle->snap_attraction.mode; fw->snap_grid_x = pstyle->snap_grid_x; fw->snap_grid_y = pstyle->snap_grid_y; if (pstyle->flags.has_edge_delay_ms_move) Index: fvwm/fvwm.h =================================================================== RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.h,v retrieving revision 1.260 diff -u -r1.260 fvwm.h --- fvwm/fvwm.h 8 Feb 2009 11:01:45 -0000 1.260 +++ fvwm/fvwm.h 2 Aug 2009 08:51:50 -0000 @@ -608,6 +608,25 @@ } flags; } style_id_t; +typedef struct snap_attraction_t +{ + /* attractiveness of window edges */ + int proximity; + /* mode of snap attraction */ + int mode; + /* mode flags to do bit manipulation */ + enum + { + SNAP_NONE = 0x00, + SNAP_WINDOWS = 0x01, + SNAP_ICONS = 0x02, + SNAP_SAME = 0x04, + SNAP_SCREEN = 0x08, + SNAP_SCREEN_WINDOWS = 0x10, + SNAP_SCREEN_ICONS = 0x20, + SNAP_SCREEN_ALL = 0x40, + } types; +} snap_attraction_t; /* only style.c and add_window.c are allowed to access this struct! */ typedef struct window_style @@ -663,10 +682,7 @@ int max_window_height; int shade_anim_steps; #if 1 /*!!!*/ - /* attractiveness of window edges */ - int snap_proximity; - /* mode of snap attraction */ - int snap_mode; + snap_attraction_t snap_attraction; /* snap grid size */ int snap_grid_x; int snap_grid_y; @@ -896,10 +912,7 @@ int shade_anim_steps; unsigned char grabbed_buttons; #if 1 /*!!!*/ - /* attractiveness of window edges */ - int snap_proximity; - /* mode of snap attraction */ - int snap_mode; + snap_attraction_t snap_attraction; /* snap grid size */ int snap_grid_x; int snap_grid_y; 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 2 Aug 2009 08:51:53 -0000 @@ -1871,7 +1871,7 @@ return; } -/* This function does the SnapAttraction stuff. If takes x and y coordinates +/* This function does the SnapAttraction stuff. It takes x and y coordinates * (*px and *py) and returns the snapped values. */ static void DoSnapAttract( FvwmWindow *fw, int Width, int Height, int *px, int *py) @@ -1880,10 +1880,10 @@ rectangle self; /* resist based on window edges */ - closestTop = fw->snap_proximity; - closestBottom = fw->snap_proximity; - closestRight = fw->snap_proximity; - closestLeft = fw->snap_proximity; + closestTop = fw->snap_attraction.proximity; + closestBottom = fw->snap_attraction.proximity; + closestRight = fw->snap_attraction.proximity; + closestLeft = fw->snap_attraction.proximity; nxl = -99999; nyt = -99999; self.x = *px; @@ -1926,11 +1926,13 @@ /* * snap attraction */ - /* snap to other windows */ - if ((fw->snap_mode & (SNAP_ICONS | SNAP_WINDOWS | SNAP_SAME)) && - fw->snap_proximity > 0) + /* snap to other windows or icons*/ + if (fw->snap_attraction.proximity > 0 && + (fw->snap_attraction.mode & (SNAP_ICONS | SNAP_WINDOWS | SNAP_SAME))) { FvwmWindow *tmp; + int maskout = (SNAP_SCREEN | SNAP_SCREEN_WINDOWS | + SNAP_SCREEN_ICONS | SNAP_SCREEN_ALL); for (tmp = Scr.FvwmRoot.next; tmp; tmp = tmp->next) { @@ -1941,29 +1943,27 @@ continue; } /* check snapping type */ - switch (fw->snap_mode) + switch (fw->snap_attraction.mode & ~(maskout)) { - 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; } @@ -1972,21 +1972,21 @@ /* prevent that window snaps off screen */ if (other.x <= 0) { - other.x -= fw->snap_proximity + 10000; - other.width += fw->snap_proximity + 10000; + other.x -= fw->snap_attraction.proximity + 10000; + other.width += fw->snap_attraction.proximity + 10000; } if (other.y <= 0) { - other.y -= fw->snap_proximity + 10000; - other.height += fw->snap_proximity + 10000; + other.y -= fw->snap_attraction.proximity + 10000; + other.height += fw->snap_attraction.proximity + 10000; } if (other.x + other.width >= Scr.MyDisplayWidth) { - other.width += fw->snap_proximity + 10000; + other.width += fw->snap_attraction.proximity + 10000; } if (other.y + other.height >= Scr.MyDisplayHeight) { - other.height += fw->snap_proximity + 10000; + other.height += fw->snap_attraction.proximity + 10000; } /* snap horizontally */ @@ -2000,12 +2000,12 @@ closestRight = dist; if (*px + self.width >= other.x && *px + self.width < - other.x + fw->snap_proximity) + other.x + fw->snap_attraction.proximity) { nxl = other.x - self.width; } if (*px + self.width >= - other.x - fw->snap_proximity && + other.x - fw->snap_attraction.proximity && *px + self.width < other.x) { nxl = other.x - self.width; @@ -2017,12 +2017,12 @@ closestLeft = dist; if (*px <= other.x + other.width && *px > other.x + other.width - - fw->snap_proximity) + fw->snap_attraction.proximity) { nxl = other.x + other.width; } if (*px <= other.x + other.width + - fw->snap_proximity && + fw->snap_attraction.proximity && *px > other.x + other.width) { nxl = other.x + other.width; @@ -2040,12 +2040,12 @@ closestBottom = dist; if (*py + self.height >= other.y && *py + self.height < other.y + - fw->snap_proximity) + fw->snap_attraction.proximity) { nyt = other.y - self.height; } if (*py + self.height >= - other.y - fw->snap_proximity && + other.y - fw->snap_attraction.proximity && *py + self.height < other.y) { nyt = other.y - self.height; @@ -2058,12 +2058,12 @@ if (*py <= other.y + other.height && *py > other.y + other.height - - fw->snap_proximity) + fw->snap_attraction.proximity) { nyt = other.y + other.height; } if (*py <= other.y + other.height + - fw->snap_proximity && + fw->snap_attraction.proximity && *py > other.y + other.height) { nyt = other.y + other.height; @@ -2074,8 +2074,19 @@ } /* snap to other windows */ /* snap to screen egdes */ - if ((fw->snap_mode & SNAP_SCREEN) && fw->snap_proximity > 0) - { + if (fw->snap_attraction.proximity > 0 && ( + ( fw->snap_attraction.mode & SNAP_SCREEN && ( + fw->snap_attraction.mode & SNAP_SAME || + ( IS_ICONIFIED(fw) && + fw->snap_attraction.mode & SNAP_ICONS ) || + ( !IS_ICONIFIED(fw) && + fw->snap_attraction.mode & SNAP_WINDOWS ))) || + ( !IS_ICONIFIED(fw) && + fw->snap_attraction.mode & SNAP_SCREEN_WINDOWS ) || + ( IS_ICONIFIED(fw) && + fw->snap_attraction.mode & SNAP_SCREEN_ICONS ) || + fw->snap_attraction.mode & SNAP_SCREEN_ALL )) + { /* horizontally */ if (!(Scr.MyDisplayWidth < (*px) || (*px + self.width) < 0)) @@ -2087,13 +2098,13 @@ if (*py + self.height >= Scr.MyDisplayHeight && *py + self.height < - Scr.MyDisplayHeight + fw->snap_proximity) + Scr.MyDisplayHeight + fw->snap_attraction.proximity) { nyt = Scr.MyDisplayHeight - self.height; } if (*py + self.height >= - Scr.MyDisplayHeight - fw->snap_proximity && + Scr.MyDisplayHeight - fw->snap_attraction.proximity && *py + self.height < Scr.MyDisplayHeight) { nyt = Scr.MyDisplayHeight - @@ -2104,11 +2115,11 @@ if (dist < closestTop) { closestTop = dist; - if ((*py <= 0)&&(*py > - fw->snap_proximity)) + if ((*py <= 0)&&(*py > - fw->snap_attraction.proximity)) { nyt = 0; } - if ((*py <= fw->snap_proximity)&&(*py > 0)) + if ((*py <= fw->snap_attraction.proximity)&&(*py > 0)) { nyt = 0; } @@ -2126,13 +2137,13 @@ if (*px + self.width >= Scr.MyDisplayWidth && *px + self.width < - Scr.MyDisplayWidth + fw->snap_proximity) + Scr.MyDisplayWidth + fw->snap_attraction.proximity) { nxl = Scr.MyDisplayWidth - self.width; } if (*px + self.width >= - Scr.MyDisplayWidth - fw->snap_proximity && + Scr.MyDisplayWidth - fw->snap_attraction.proximity && *px + self.width < Scr.MyDisplayWidth) { nxl = Scr.MyDisplayWidth - self.width; @@ -2144,11 +2155,11 @@ closestLeft = dist; if ((*px <= 0) && - (*px > - fw->snap_proximity)) + (*px > - fw->snap_attraction.proximity)) { nxl = 0; } - if ((*px <= fw->snap_proximity) && + if ((*px <= fw->snap_attraction.proximity) && (*px > 0)) { nxl = 0; 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 2 Aug 2009 08:51:57 -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 2 Aug 2009 08:51:57 -0000 @@ -3,12 +3,6 @@ #ifndef _STYLE_ #define _STYLE_ -#define SNAP_NONE 0x00 -#define SNAP_WINDOWS 0x01 -#define SNAP_ICONS 0x02 -#define SNAP_SAME 0x04 -#define SNAP_SCREEN 0x08 - /* access to the special flags of a style */ /* call these with a pointer to a style_flags struct */ #define SDO_DECORATE_TRANSIENT(sf) \ @@ -574,13 +568,13 @@ #define SSET_WINDOW_SHADE_STEPS(s,x) \ ((s).shade_anim_steps = (x)) #define SGET_SNAP_PROXIMITY(s) \ - ((s).snap_proximity) + ((s).snap_attraction.proximity) #define SSET_SNAP_PROXIMITY(s,x) \ - ((s).snap_proximity = (x)) + ((s).snap_attraction.proximity = (x)) #define SGET_SNAP_MODE(s) \ - ((s).snap_mode) + ((s).snap_attraction.mode) #define SSET_SNAP_MODE(s,x) \ - ((s).snap_mode = (x)) + ((s).snap_attraction.mode = (x)) #define SGET_SNAP_GRID_X(s) \ ((s).snap_grid_x) #define SSET_SNAP_GRID_X(s,x) \ 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 2 Aug 2009 08:51:57 -0000 @@ -248,8 +248,8 @@ /*** 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 0 /* snap nothing */ +#define DEFAULT_SNAP_ATTRACTION_MODE 0x3 /* 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.
