diff -ruN fluxbox-orig/files/fluxbox-0.1.14-windowsnap.patch fluxbox-winsnap/files/fluxbox-0.1.14-windowsnap.patch --- fluxbox-orig/files/fluxbox-0.1.14-windowsnap.patch 1969-12-31 19:00:00.000000000 -0500 +++ fluxbox-winsnap/files/fluxbox-0.1.14-windowsnap.patch 2003-11-22 15:57:09.000000000 -0500 @@ -0,0 +1,108 @@ +diff -ru fluxbox-orig/src/Screen.cc fluxbox-winsnap/src/Screen.cc +--- fluxbox-orig/src/Screen.cc 2002-12-08 09:06:29.000000000 -0500 ++++ fluxbox-winsnap/src/Screen.cc 2003-11-22 15:29:19.000000000 -0500 +@@ -223,6 +223,7 @@ + workspaces(rm, 1, scrname+".workspaces", altscrname+".Workspaces"), + toolbar_width_percent(rm, 65, scrname+".toolbar.widthPercent", altscrname+".Toolbar.WidthPercent"), + edge_snap_threshold(rm, 0, scrname+".edgeSnapThreshold", altscrname+".EdgeSnapThreshold"), ++window_snap_threshold(rm, 0, scrname+".windowSnapThreshold", altscrname+".WindowSnapThreshold"), /*SHAWN WAS HERE */ + tab_width(rm, 64, scrname+".tab.width", altscrname+".Tab.Width"), + tab_height(rm, 16, scrname+".tab.height", altscrname+".Tab.Height"), + tab_placement(rm, Tab::PTOP, scrname+".tab.placement", altscrname+".Tab.Placement"), +diff -ru fluxbox-orig/src/Screen.hh fluxbox-winsnap/src/Screen.hh +--- fluxbox-orig/src/Screen.hh 2002-12-07 09:15:25.000000000 -0500 ++++ fluxbox-winsnap/src/Screen.hh 2003-11-22 15:29:19.000000000 -0500 +@@ -148,6 +148,7 @@ + inline int getToolbarWidthPercent() const { return *resource.toolbar_width_percent; } + inline int getPlacementPolicy() const { return resource.placement_policy; } + inline int getEdgeSnapThreshold() const { return *resource.edge_snap_threshold; } ++ inline int getWindowSnapThreshold(void) const { return *resource.window_snap_threshold; } /* SHAWN WAS HERE */ + inline int getRowPlacementDirection() const { return resource.row_direction; } + inline int getColPlacementDirection() const { return resource.col_direction; } + inline unsigned int getTabWidth() const { return *resource.tab_width; } +@@ -173,6 +174,7 @@ + inline void saveRowPlacementDirection(int d) { resource.row_direction = d; } + inline void saveColPlacementDirection(int d) { resource.col_direction = d; } + inline void saveEdgeSnapThreshold(int t) { resource.edge_snap_threshold = t; } ++ inline void saveWindowSnapThreshold(int t) { resource.window_snap_threshold = t; } /* SHAWN WAS HERE */ + inline void saveImageDither(bool d) { resource.image_dither = d; } + inline void saveMaxOverSlit(bool m) { resource.max_over_slit = m; } + inline void saveOpaqueMove(bool o) { resource.opaque_move = o; } +@@ -337,7 +339,7 @@ + bool auto_raise, sloppy_focus, semi_sloppy_focus, + ordered_dither; + Resource workspaces, toolbar_width_percent, edge_snap_threshold, +- tab_width, tab_height; ++ window_snap_threshold, /*SHAWN WAS HERE*/tab_width, tab_height; + int placement_policy, row_direction, col_direction; + + Resource tab_placement; +diff -ru fluxbox-orig/src/Window.cc fluxbox-winsnap/src/Window.cc +--- fluxbox-orig/src/Window.cc 2003-11-22 15:35:32.000000000 -0500 ++++ fluxbox-winsnap/src/Window.cc 2003-11-22 15:30:41.000000000 -0500 +@@ -3021,7 +3021,64 @@ + } + } + +- ++ if (screen->getWindowSnapThreshold()) { ++ int height = (isShaded() ? getTitleHeight() : getHeight()); // height of the window that is moving ++ int mindistx=screen->getWindowSnapThreshold(), ++ mindisty=screen->getWindowSnapThreshold(), ++ newdx=dx, ++ newdy=dy; ++ Workspace::Windows winlist = ++ getScreen()->getWorkspace(getWorkspaceNumber())->getWindowList(); ++ ++ ++ int x1,y1,x2,y2; ++ for (unsigned int i=0; igetXFrame(); ++ y1 = (int) winlist[i]->getYFrame(); ++ x2 = (int)winlist[i]->getXFrame() ++ +(int)winlist[i]->getWidth(); ++ if (winlist[i]->isShaded()) ++ y2 = y1+getTitleHeight(); ++ else ++ y2 = (int)winlist[i]->getYFrame() ++ +(int)winlist[i]->getHeight(); ++ ++ // check right edge of window with left edge of other windows ++ if ((dy < y2) && (dy+height > y1) && ++ (abs(x1-dx-(int)getWidth()) < mindistx)) { ++ mindistx = abs(x1-dx-(int)getWidth()); ++ newdx = x1-1-getWidth(); ++ } ++ ++ // check left edge of window with right edge of other windows ++ if ((dyy1) && ++ (abs(dx-x2) < mindistx)) { ++ mindistx = abs(dx-x2); ++ newdx = x2+1; ++ } ++ ++ // check bottom edge of window with top edge of other windows ++ if ((dx < x2) && (dx+(int)getWidth() > x1) && ++ (abs(y1-dy-height) < mindisty)) { ++ mindisty = abs(y1-dy-height); ++ newdy = y1-1-height; ++ } ++ ++ // check top edge of window with bottom edge of other windows ++ if ((dx < x2) && (dx+(int)getWidth() > x1) && ++ (abs(dy-y2) < mindisty)) { ++ mindisty = abs(dy-y2); ++ newdy = y2+1; ++ } ++ } ++ ++ dx = newdx; ++ dy = newdy; ++ } ++ + if (! screen->doOpaqueMove()) { + XDrawRectangle(display, screen->getRootWindow(), screen->getOpGC(), + frame.move_x, frame.move_y, frame.resize_w, frame.resize_h); diff -ruN fluxbox-orig/fluxbox-0.1.14-r2.ebuild fluxbox-winsnap/fluxbox-0.1.14-r2.ebuild --- fluxbox-orig/fluxbox-0.1.14-r2.ebuild 2003-11-22 15:51:34.000000000 -0500 +++ fluxbox-winsnap/fluxbox-0.1.14-r2.ebuild 2003-11-22 15:57:09.000000000 -0500 @@ -37,6 +37,8 @@ epatch ${FILESDIR}/${PN}-vano-gentoo.patch # gcc 3.3 fixes epatch ${FILESDIR}/${P}-gcc33.patch + # Shawn Singh's window snapping patch + epatch ${FILESDIR}/${P}-windowsnap.patch if [ `use cjk` ]; then epatch ${FILESDIR}/${P}-ja.patch