Index: openbox/client.c =================================================================== RCS file: /cvs/cvsroot/openbox/openbox/client.c,v retrieving revision 1.312 diff -u -r1.312 client.c --- openbox/client.c 22 Dec 2003 17:24:51 -0000 1.312 +++ openbox/client.c 21 Jan 2004 03:06:59 -0000 @@ -3098,15 +3098,16 @@ */ gint client_directional_edge_search(ObClient *c, ObDirection dir) { - gint dest; + gint dest, monitor_dest; gint my_edge_start, my_edge_end, my_offset; GList *it; - Rect *a; + Rect *a, *monitor; if(!client_list) return -1; a = screen_area(c->desktop); + monitor = screen_area_monitor(c->desktop, client_monitor(c)); switch(dir) { case OB_DIRECTION_NORTH: @@ -3116,8 +3117,13 @@ /* default: top of screen */ dest = a->y; + monitor_dest = monitor->y; + //if the monitor edge comes before the screen edge, + //use that as the destination instead. (For xinerama) + if (monitor_dest != dest && my_offset > monitor_dest) + dest = monitor_dest; - for(it = client_list; it; it = g_list_next(it)) { + for(it = client_list; it && my_offset != dest; it = g_list_next(it)) { gint his_edge_start, his_edge_end, his_offset; ObClient *cur = it->data; @@ -3157,8 +3163,13 @@ /* default: bottom of screen */ dest = a->y + a->height; + monitor_dest = monitor->y + monitor->height; + //if the monitor edge comes before the screen edge, + //use that as the destination instead. (For xinerama) + if (monitor_dest != dest && my_offset < monitor_dest) + dest = monitor_dest; - for(it = client_list; it; it = g_list_next(it)) { + for(it = client_list; it && my_offset != dest; it = g_list_next(it)) { gint his_edge_start, his_edge_end, his_offset; ObClient *cur = it->data; @@ -3199,8 +3210,13 @@ /* default: leftmost egde of screen */ dest = a->x; + monitor_dest = monitor->x; + //if the monitor edge comes before the screen edge, + //use that as the destination instead. (For xinerama) + if (monitor_dest != dest && my_offset > monitor_dest) + dest = monitor_dest; - for(it = client_list; it; it = g_list_next(it)) { + for(it = client_list; it && my_offset != dest; it = g_list_next(it)) { gint his_edge_start, his_edge_end, his_offset; ObClient *cur = it->data; @@ -3241,11 +3257,15 @@ /* default: rightmost edge of screen */ dest = a->x + a->width; + monitor_dest = monitor->x + monitor->width; + //if the monitor edge comes before the screen edge, + //use that as the destination instead. (For xinerama) + if (monitor_dest != dest && my_offset < monitor_dest) + dest = monitor_dest; - for(it = client_list; it; it = g_list_next(it)) { + for(it = client_list; it && my_offset != dest; it = g_list_next(it)) { gint his_edge_start, his_edge_end, his_offset; ObClient *cur = it->data; - if(cur == c) continue; if(!client_normal(cur))