diff --git a/settings-dialogs/tweaks-settings.c b/settings-dialogs/tweaks-settings.c
index 6fe028e..59be80f 100644
--- a/settings-dialogs/tweaks-settings.c
+++ b/settings-dialogs/tweaks-settings.c
@@ -189,6 +189,7 @@ wm_tweaks_dialog_configure_widgets (GladeXML *gxml)
GtkWidget *placement_ratio_scale = (GtkWidget *)gtk_range_get_adjustment (GTK_RANGE (glade_xml_get_widget (gxml, "placement_ratio_scale")));
GtkWidget *placement_center_option = glade_xml_get_widget (gxml, "placement_center_option");
GtkWidget *placement_mouse_option = glade_xml_get_widget (gxml, "placement_mouse_option");
+ GtkWidget *placement_grid_scale = (GtkWidget *)gtk_range_get_adjustment (GTK_RANGE (glade_xml_get_widget (gxml, "placement_grid_scale")));
/* Compositing tab */
GtkWidget *use_compositing_check = glade_xml_get_widget (gxml, "use_compositing_check");
@@ -366,6 +367,10 @@ wm_tweaks_dialog_configure_widgets (GladeXML *gxml)
"/general/placement_ratio",
G_TYPE_INT,
(GObject *)placement_ratio_scale, "value");
+ xfconf_g_property_bind (xfwm4_channel,
+ "/general/placement_grid",
+ G_TYPE_INT,
+ (GObject *)placement_grid_scale, "value");
/* Compositing tab */
xfconf_g_property_bind (xfwm4_channel,
diff --git a/settings-dialogs/xfwm4-tweaks-dialog.glade b/settings-dialogs/xfwm4-tweaks-dialog.glade
index 2e2b9ff..c25b4ec 100644
--- a/settings-dialogs/xfwm4-tweaks-dialog.glade
+++ b/settings-dialogs/xfwm4-tweaks-dialog.glade
@@ -581,6 +581,72 @@ when switching via keyboard shortcuts
2
+
+
+ True
+ 0
+ _Grid size to align windows on when using smart placement:
+ True
+ placement_grid_scale
+
+
+ False
+ False
+ 3
+
+
+
+
+ True
+ 6
+ 12
+
+
+ True
+
+
+ True
+ Size|<i>Small</i>
+ True
+
+
+ False
+ False
+ 0
+
+
+
+
+ True
+ True
+ 8 1 50 1 10 0
+ False
+ False
+
+
+ 1
+
+
+
+
+ True
+ Size|<i>Large</i>
+ True
+
+
+ False
+ 2
+
+
+
+
+
+
+ False
+ False
+ 4
+
+
4
diff --git a/src/placement.c b/src/placement.c
index f66f177..75ebf58 100644
--- a/src/placement.c
+++ b/src/placement.c
@@ -545,6 +545,7 @@ smartPlacement (Client * c, int full_x, int full_y, int full_w, int full_h)
gint test_x, test_y, xmax, ymax, best_x, best_y;
gint frame_x, frame_y, frame_height, frame_width, frame_left, frame_top;
gboolean first;
+ gint placement_grid;
g_return_if_fail (c != NULL);
TRACE ("entering smartPlacement");
@@ -560,6 +561,7 @@ smartPlacement (Client * c, int full_x, int full_y, int full_w, int full_h)
test_y = 0;
best_overlaps = 0.0;
first = TRUE;
+ placement_grid = screen_info->params->placement_grid;
xmax = full_x + full_w - c->width - frameRight (c);
ymax = full_y + full_h - c->height - frameBottom (c);
@@ -608,10 +610,10 @@ smartPlacement (Client * c, int full_x, int full_y, int full_w, int full_h)
{
first = FALSE;
}
- test_x += 8;
+ test_x += placement_grid;
}
while (test_x <= xmax);
- test_y += 8;
+ test_y += placement_grid;
}
while (test_y <= ymax);
diff --git a/src/settings.c b/src/settings.c
index 0969faf..e380825 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -684,6 +684,7 @@ loadSettings (ScreenInfo *screen_info)
{"move_opacity", NULL, G_TYPE_INT, TRUE},
{"placement_ratio", NULL, G_TYPE_INT, TRUE},
{"placement_mode", NULL, G_TYPE_STRING, TRUE},
+ {"placement_grid", NULL, G_TYPE_INT, TRUE},
{"popup_opacity", NULL, G_TYPE_INT, TRUE},
{"prevent_focus_stealing", NULL, G_TYPE_BOOLEAN, TRUE},
{"raise_delay", NULL, G_TYPE_INT, TRUE},
@@ -789,6 +790,8 @@ loadSettings (ScreenInfo *screen_info)
CLAMP (getIntValue ("popup_opacity", rc), 0, 100);
screen_info->params->placement_ratio =
CLAMP (getIntValue ("placement_ratio", rc), 0, 100);
+ screen_info->params->placement_grid =
+ CLAMP (getIntValue ("placement_grid", rc), 1, 50);
screen_info->params->shadow_opacity =
CLAMP (getIntValue ("shadow_opacity", rc), 0, 100);
screen_info->params->show_app_icon =
@@ -1171,6 +1174,10 @@ cb_xfwm4_channel_property_changed(XfconfChannel *channel, const gchar *property_
{
screen_info->params->placement_ratio = CLAMP (g_value_get_int(value), 0, 100);
}
+ else if (!strcmp (name, "placement_grid"))
+ {
+ screen_info->params->placement_grid = CLAMP (g_value_get_int(value), 1, 50);
+ }
else if ((!strcmp (name, "button_offset"))
|| (!strcmp (name, "button_spacing"))
|| (!strcmp (name, "dbl_click_time"))
diff --git a/src/settings.h b/src/settings.h
index a73383b..e33b547 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -178,6 +178,7 @@ struct _XfwmParams
int move_opacity;
int placement_mode;
int placement_ratio;
+ int placement_grid;
int popup_opacity;
int raise_delay;
int resize_opacity;