add the resource for the window snapping offset
authorDana Jansens <danakj@orodu.net>
Fri, 2 Aug 2002 21:07:17 +0000 (21:07 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 2 Aug 2002 21:07:17 +0000 (21:07 +0000)
src/Screen.cc
src/Screen.hh
src/Window.cc

index 8512b3d..447a7ad 100644 (file)
@@ -490,6 +490,13 @@ void BScreen::saveSnapThreshold(int t) {
 }
 
 
+void BScreen::saveSnapOffset(int t) {
+  resource.snap_offset = t;
+  config->setValue(screenstr + "edgeSnapOffset",
+                   resource.snap_offset);
+}
+
+
 void BScreen::saveRowPlacementDirection(int d) {
   resource.row_direction = d;
   config->setValue(screenstr + "rowPlacementDirection",
@@ -599,6 +606,7 @@ void BScreen::save_rc(void) {
   saveWorkspaces(resource.workspaces);
   savePlacementPolicy(resource.placement_policy);
   saveSnapThreshold(resource.snap_threshold);
+  saveSnapOffset(resource.snap_offset);
   saveResistanceSize(resource.resistance_size);
   saveRowPlacementDirection(resource.row_direction);
   saveColPlacementDirection(resource.col_direction);
@@ -673,6 +681,10 @@ void BScreen::load_rc(void) {
     b = true;
   image_control->setDither(b);
 
+  if (! config->getValue(screenstr + "edgeSnapOffset",
+                        resource.snap_offset))
+    resource.snap_offset = 0;
+  
   if (! config->getValue(screenstr + "edgeSnapThreshold",
                         resource.snap_threshold))
     resource.snap_threshold = 4;
index ca8194c..71a012d 100644 (file)
@@ -151,6 +151,7 @@ private:
       ignore_shaded, ignore_maximized, workspace_warping;
 
     int snap_to_windows, snap_to_edges;
+    unsigned int snap_offset;
 
     BColor border_color;
 
@@ -270,6 +271,8 @@ public:
   { return resource.workspaces; }
   inline int getPlacementPolicy(void) const
   { return resource.placement_policy; }
+  inline int getSnapOffset(void) const
+  { return resource.snap_offset; }
   inline int getSnapThreshold(void) const
   { return resource.snap_threshold; }
   inline int getResistanceSize(void) const
@@ -290,6 +293,7 @@ public:
   void saveRowPlacementDirection(int d);
   void saveColPlacementDirection(int d);
   void saveSnapThreshold(int t);
+  void saveSnapOffset(int o);
   void saveResistanceSize(int s);
   void saveImageDither(bool d);
   void saveAAFonts(bool f);
index 98ac82f..dc09a65 100644 (file)
@@ -3124,7 +3124,7 @@ void BlackboxWindow::doWindowSnapping(int &dx, int &dy) {
   const int snap_to_windows = screen->getWindowToWindowSnap();
   const int snap_to_edges = screen->getWindowToEdgeSnap();
   // the amount of space away from the edge to provide resistance/snap
-  const int snap_offset = 0;
+  const int snap_offset = screen->getSnapOffset();
 
   // find the geomeetery where the moving window currently is
   const Rect &moving = screen->doOpaqueMove() ? frame.rect : frame.changing;