summaryrefslogtreecommitdiff
path: root/openbox/client.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2009-12-09 16:00:32 -0500
committerDana Jansens <danakj@orodu.net>2009-12-09 16:00:32 -0500
commitade3b4dd69cf275bbaf5de663e1b723d6c073eb1 (patch)
tree48182f0c6f78fa109231f1d5f0ae5b4d65a838ef /openbox/client.c
parente0015160f0bc79ef0ad2de1ad7cc9bb389ccddc9 (diff)
Make the edge detection fully include monitor edges.
This fixes the move-to-edge behaviour, when moving past the edge of a monitor, the window will stop with its tail edge against the inside of the monitor's edge.
Diffstat (limited to 'openbox/client.c')
-rw-r--r--openbox/client.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/openbox/client.c b/openbox/client.c
index 030e893a..fcbe7cd9 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -4237,39 +4237,26 @@ void client_find_edge_directional(ObClient *self, ObDirection dir,
gint *dest, gboolean *near_edge)
{
GList *it;
- Rect *a, *mon;
+ Rect *a;
Rect dock_area;
gint edge;
+ guint i;
a = screen_area(self->desktop, SCREEN_AREA_ALL_MONITORS,
&self->frame->area);
- mon = screen_area(self->desktop, SCREEN_AREA_ONE_MONITOR,
- &self->frame->area);
switch (dir) {
case OB_DIRECTION_NORTH:
- if (my_head >= RECT_TOP(*mon) + 1)
- edge = RECT_TOP(*mon) - 1;
- else
- edge = RECT_TOP(*a) - 1;
+ edge = RECT_TOP(*a) - 1;
break;
case OB_DIRECTION_SOUTH:
- if (my_head <= RECT_BOTTOM(*mon) - 1)
- edge = RECT_BOTTOM(*mon) + 1;
- else
- edge = RECT_BOTTOM(*a) + 1;
+ edge = RECT_BOTTOM(*a) + 1;
break;
case OB_DIRECTION_EAST:
- if (my_head <= RECT_RIGHT(*mon) - 1)
- edge = RECT_RIGHT(*mon) + 1;
- else
- edge = RECT_RIGHT(*a) + 1;
+ edge = RECT_RIGHT(*a) + 1;
break;
case OB_DIRECTION_WEST:
- if (my_head >= RECT_LEFT(*mon) + 1)
- edge = RECT_LEFT(*mon) - 1;
- else
- edge = RECT_LEFT(*a) - 1;
+ edge = RECT_LEFT(*a) - 1;
break;
default:
g_assert_not_reached();
@@ -4278,6 +4265,15 @@ void client_find_edge_directional(ObClient *self, ObDirection dir,
*dest = edge;
*near_edge = TRUE;
+ /* search for edges of monitors */
+ for (i = 0; i < screen_num_monitors; ++i) {
+ Rect *area = screen_area(self->desktop, i, NULL);
+ detect_edge(*area, dir, my_head, my_size, my_edge_start,
+ my_edge_size, dest, near_edge);
+ g_free(area);
+ }
+
+ /* search for edges of clients */
for (it = client_list; it; it = g_list_next(it)) {
ObClient *cur = it->data;
@@ -4299,7 +4295,6 @@ void client_find_edge_directional(ObClient *self, ObDirection dir,
detect_edge(dock_area, dir, my_head, my_size, my_edge_start,
my_edge_size, dest, near_edge);
g_free(a);
- g_free(mon);
}
void client_find_move_directional(ObClient *self, ObDirection dir,