}
-void BScreen::saveWindowToWindowSnap(bool s) {
- resource.window_to_window_snap = s;
- config->setValue(screenstr + "windowToWindowSnap",
- resource.window_to_window_snap);
+void BScreen::saveWindowToEdgeSnap(int s) {
+ resource.snap_to_edges = s;
+
+ const char *snap;
+ switch (resource.snap_to_edges) {
+ case WindowNoSnap: snap = "NoSnap"; break;
+ case WindowResistance: snap = "Resistance"; break;
+ case WindowSnap: default: snap = "Snap"; break;
+ }
+ config->setValue(screenstr + "windowToEdgeSnap", snap);
+}
+
+
+void BScreen::saveWindowToWindowSnap(int s) {
+ resource.snap_to_windows = s;
+
+ const char *snap;
+ switch (resource.snap_to_edges) {
+ case WindowNoSnap: snap = "NoSnap"; break;
+ case WindowResistance: snap = "Resistance"; break;
+ case WindowSnap: default: snap = "Snap"; break;
+ }
+ config->setValue(screenstr + "windowToWindowSnap", snap);
}
}
-void BScreen::saveEdgeSnapThreshold(int t) {
- resource.edge_snap_threshold = t;
+void BScreen::saveResistanceSize(int s) {
+ resource.resistance_size = s;
+ config->setValue(screenstr + "resistanceSize",
+ resource.resistance_size);
+}
+
+
+void BScreen::saveSnapThreshold(int t) {
+ resource.snap_threshold = t;
config->setValue(screenstr + "edgeSnapThreshold",
- resource.edge_snap_threshold);
+ resource.snap_threshold);
}
saveFocusNew(resource.focus_new);
saveFocusLast(resource.focus_last);
saveHideToolbar(resource.hide_toolbar);
- saveWindowToWindowSnap(resource.window_to_window_snap);
+ saveWindowToWindowSnap(resource.snap_to_windows);
+ saveWindowToEdgeSnap(resource.snap_to_edges);
saveWindowCornerSnap(resource.window_corner_snap);
saveWorkspaces(resource.workspaces);
savePlacementPolicy(resource.placement_policy);
- saveEdgeSnapThreshold(resource.edge_snap_threshold);
+ saveSnapThreshold(resource.snap_threshold);
+ saveResistanceSize(resource.resistance_size);
saveRowPlacementDirection(resource.row_direction);
saveColPlacementDirection(resource.col_direction);
#ifdef HAVE_STRFTIME
if (! config->getValue(screenstr + "hideToolbar", resource.hide_toolbar))
resource.hide_toolbar = false;
- if (! config->getValue(screenstr + "windowToWindowSnap",
- resource.window_to_window_snap))
- resource.window_to_window_snap = true;
+ resource.snap_to_windows = WindowResistance;
+ if (config->getValue(screenstr + "windowToWindowSnap", s)) {
+ if (s == "NoSnap")
+ resource.snap_to_windows = WindowNoSnap;
+ else if (s == "Snap")
+ resource.snap_to_windows = WindowSnap;
+ }
+
+ resource.snap_to_edges = WindowResistance;
+ if (config->getValue(screenstr + "windowToEdgeSnap", s)) {
+ if (s == "NoSnap")
+ resource.snap_to_edges = WindowNoSnap;
+ else if (s == "Snap")
+ resource.snap_to_edges = WindowSnap;
+ }
if (! config->getValue(screenstr + "windowCornerSnap",
resource.window_corner_snap))
image_control->setDither(b);
if (! config->getValue(screenstr + "edgeSnapThreshold",
- resource.edge_snap_threshold))
- resource.edge_snap_threshold = 4;
+ resource.snap_threshold))
+ resource.snap_threshold = 4;
+
+ if (! config->getValue(screenstr + "resistanceSize",
+ resource.resistance_size))
+ resource.resistance_size = 12;
if (config->getValue(screenstr + "rowPlacementDirection", s) &&
s == "RightToLeft")
bool sloppy_focus, auto_raise, auto_edge_balance, ordered_dither,
opaque_move, full_max, focus_new, focus_last, click_raise,
- allow_scroll_lock, hide_toolbar, window_to_window_snap,
- window_corner_snap, aa_fonts, ignore_shaded, ignore_maximized,
- workspace_warping;
+ allow_scroll_lock, hide_toolbar, window_corner_snap, aa_fonts,
+ ignore_shaded, ignore_maximized, workspace_warping;
+
+ int snap_to_windows, snap_to_edges;
+
BColor border_color;
unsigned int workspaces;
int toolbar_placement, toolbar_width_percent, placement_policy,
- edge_snap_threshold, row_direction, col_direction, root_scroll;
+ snap_threshold, row_direction, col_direction, root_scroll,
+ resistance_size;
unsigned int handle_width, bevel_width, frame_width, border_width,
resize_zones;
inline bool doFocusNew(void) const { return resource.focus_new; }
inline bool doFocusLast(void) const { return resource.focus_last; }
inline bool doHideToolbar(void) const { return resource.hide_toolbar; }
- inline bool getWindowToWindowSnap(void) const
- { return resource.window_to_window_snap; }
+ inline int getWindowToWindowSnap(void) const
+ { return resource.snap_to_windows; }
+ inline int getWindowToEdgeSnap(void) const
+ { return resource.snap_to_edges; }
inline bool getWindowCornerSnap(void) const
{ return resource.window_corner_snap; }
inline bool allowScrollLock(void) const { return resource.allow_scroll_lock; }
{ return resource.workspaces; }
inline int getPlacementPolicy(void) const
{ return resource.placement_policy; }
- inline int getEdgeSnapThreshold(void) const
- { return resource.edge_snap_threshold; }
+ inline int getSnapThreshold(void) const
+ { return resource.snap_threshold; }
+ inline int getResistanceSize(void) const
+ { return resource.resistance_size; }
inline int getRowPlacementDirection(void) const
{ return resource.row_direction; }
inline int getColPlacementDirection(void) const
void savePlacementPolicy(int p);
void saveRowPlacementDirection(int d);
void saveColPlacementDirection(int d);
- void saveEdgeSnapThreshold(int t);
+ void saveSnapThreshold(int t);
+ void saveResistanceSize(int s);
void saveImageDither(bool d);
void saveAAFonts(bool f);
void saveOpaqueMove(bool o);
void saveFocusNew(bool f);
void saveFocusLast(bool f);
void saveHideToolbar(bool h);
- void saveWindowToWindowSnap(bool s);
+ void saveWindowToEdgeSnap(int s);
+ void saveWindowToWindowSnap(int s);
void saveWindowCornerSnap(bool s);
void saveResizeZones(unsigned int z);
void savePlaceIgnoreShaded(bool i);
void BlackboxWindow::doWindowSnapping(int &dx, int &dy) {
// how much resistance to edges to provide
- const int resistance_size = screen->getEdgeSnapThreshold();
+ const int resistance_size = screen->getResistanceSize();
// how far away to snap
- const int snap_distance = screen->getEdgeSnapThreshold();
+ const int snap_distance = screen->getSnapThreshold();
// how to snap windows
- const int snap_to_windows = BScreen::WindowResistance;
- const int snap_to_edges = BScreen::WindowResistance;
+ 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 = screen->getEdgeSnapThreshold();
+// const int snap_offset = screen->getSnapThreshold();
// find the geomeetery where the moving window currently is
const Rect &moving = screen->doOpaqueMove() ? frame.rect : frame.changing;