diff -ur fluxbox-0.1.14/src/Screen.cc fluxbox-0.1.14-devel/src/Screen.cc --- fluxbox-0.1.14/src/Screen.cc 2002-12-08 09:06:29.000000000 -0500 +++ fluxbox-0.1.14-devel/src/Screen.cc 2003-09-01 12:20:09.000000000 -0400 @@ -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 -ur fluxbox-0.1.14/src/Screen.hh fluxbox-0.1.14-devel/src/Screen.hh --- fluxbox-0.1.14/src/Screen.hh 2002-12-07 09:15:25.000000000 -0500 +++ fluxbox-0.1.14-devel/src/Screen.hh 2003-09-01 12:24:40.000000000 -0400 @@ -147,7 +147,8 @@ 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 -ur fluxbox-0.1.14/src/Window.cc fluxbox-0.1.14-devel/src/Window.cc --- fluxbox-0.1.14/src/Window.cc 2002-12-07 15:04:24.000000000 -0500 +++ fluxbox-0.1.14-devel/src/Window.cc 2003-09-01 12:28:29.000000000 -0400 @@ -2987,6 +2987,64 @@ else if (dby > 0 && dby < screen->getEdgeSnapThreshold()) dy = dbby - frame.snap_h; } + 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; + } + // Warp to next or previous workspace?, must have moved sideways some int moved_x=me->x_root - frame.resize_x; // save last event point