--- src/moveres.c.orig	Fri Dec  4 23:14:49 1998
+++ src/moveres.c	Fri Dec  4 23:16:02 1998
@@ -33,6 +33,7 @@
 #include "window.h"
 #include "client.h"
 #include "icon.h"
+#include "dock.h"
 #include "funcs.h"
 #include "actions.h"
 #include "workspace.h"
@@ -404,27 +405,39 @@
 static void
 checkEdgeResistance(WWindow *wwin, int *winx, int *winy, int off_x, int off_y)
 {
-    int scr_width = wwin->screen_ptr->scr_width;
+    WScreen *scr = wwin->screen_ptr;
+    int scr_width = wwin->screen_ptr->scr_width - 3;
     int scr_height = wwin->screen_ptr->scr_height;
     int x = *winx;
     int y = *winy;
     int edge_resistance = wPreferences.edge_resistance;
+    int right_side = scr_width;
+    int left_side = 0; 
+    int isize = wPreferences.icon_size;
 
     x -= off_x;
     y -= off_y;
 
-    if ((x + wwin->frame->core->width) >= (scr_width - 2)) {
-      if ((x + wwin->frame->core->width) < ((scr_width - 2) 
+    if (scr->dock)
+    {
+      if (scr->dock->on_right_side)
+	right_side -= isize + DOCK_EXTRA_SPACE;
+      else
+	left_side += isize + DOCK_EXTRA_SPACE;
+    }
+
+    if ((x + wwin->frame->core->width) >= right_side) {
+      if ((x + wwin->frame->core->width) < (right_side 
           + edge_resistance)) {
-        x = scr_width - wwin->frame->core->width - 2;
+        x = right_side - wwin->frame->core->width;
       } else {
         x -= edge_resistance;
       }
     }
 
-    if (x <= 0) {
-      if (x > -edge_resistance) {
-        x = 0;
+    if (x <= left_side) {
+      if (x > (left_side - edge_resistance)) {
+        x = left_side;
       } else {
         x += edge_resistance;
       }
