Index: Makefile.am =================================================================== RCS file: /cvs/cvsroot/openbox/Makefile.am,v retrieving revision 1.100 diff -u -r1.100 Makefile.am --- Makefile.am 8 Jun 2006 11:46:34 -0000 1.100 +++ Makefile.am 9 Jun 2006 23:03:05 -0000 @@ -17,7 +17,7 @@ ACLOCAL_AMFLAGS = -I m4 -INCLUDES = -I. +INCLUDES = -I. -I/usr/X11R6/include noinst_PROGRAMS = \ render/rendertest Index: openbox/config.c =================================================================== RCS file: /cvs/cvsroot/openbox/openbox/config.c,v retrieving revision 1.106 diff -u -r1.106 config.c --- openbox/config.c 9 Jun 2006 14:52:06 -0000 1.106 +++ openbox/config.c 9 Jun 2006 23:03:05 -0000 @@ -405,10 +405,19 @@ xmlNodePtr n; node = node->children; - - if ((n = parse_find_node("policy", node))) - if (parse_contains("UnderMouse", doc, n)) + + if ((n = parse_find_node("policy", node))) { + if (parse_contains("SmartTransposed", doc, n)) + config_place_policy = OB_PLACE_POLICY_SMART_TRANSPOSED; + else if (parse_contains("RowSmart", doc, n)) + config_place_policy = OB_PLACE_POLICY_ROW_SMART; + else if (parse_contains("ColSmart", doc, n)) + config_place_policy = OB_PLACE_POLICY_COL_SMART; + else if (parse_contains("UnderMouse", doc, n)) config_place_policy = OB_PLACE_POLICY_MOUSE; + else + config_place_policy = OB_PLACE_POLICY_SMART; + } } static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, Index: openbox/place.c =================================================================== RCS file: /cvs/cvsroot/openbox/openbox/place.c,v retrieving revision 1.38 diff -u -r1.38 place.c --- openbox/place.c 8 Jun 2006 11:45:39 -0000 1.38 +++ openbox/place.c 9 Jun 2006 23:03:06 -0000 @@ -148,6 +148,7 @@ gboolean diffhead = FALSE; guint i; Rect *a; + gint mindiff; for (i = 0; i < screen_num_monitors; ++i) { a = screen_physical_area_monitor(i); @@ -182,8 +183,35 @@ return 1; } - return MIN((a1->width - carea->width), (a1->height - carea->height)) - + mindiff = + MIN((a1->width - carea->width), (a1->height - carea->height)) - MIN((a2->width - carea->width), (a2->height - carea->height)); + + g_assert(FIRST_PLACEMENT_MODE <= config_place_policy); + g_assert(config_place_policy < NPLACEMENT_MODES); + switch (config_place_policy) { + + case OB_PLACE_POLICY_SMART: return mindiff; + + case OB_PLACE_POLICY_SMART_TRANSPOSED: return -mindiff; + + case OB_PLACE_POLICY_ROW_SMART: + if (a1->y < a2->y) return -1; + else if (a1->y > a2->y) return 1; + else if (a1->x < a2->x) return -1; + else if (a1->x > a2->x) return 1; + else return 0; + + case OB_PLACE_POLICY_COL_SMART: + if (a1->x < a2->x) return -1; + else if (a1->x > a2->x) return 1; + else if (a1->y < a2->y) return -1; + else if (a1->y > a2->y) return 1; + else return 0; + + default: + g_assert_not_reached(); + } } typedef enum @@ -418,10 +446,12 @@ place_per_app_setting(client, x, y, settings) || ((config_place_policy == OB_PLACE_POLICY_MOUSE) ? place_under_mouse(client, x, y) : - place_smart(client, x, y, SMART_FULL) || - place_smart(client, x, y, SMART_GROUP) || - place_smart(client, x, y, SMART_FOCUSED) || - place_random(client, x, y))) + (g_assert(config_place_policy >= OB_POLICY_FIRST_SMART), + g_assert(config_place_policy < OB_POLICY_N_SMART), + place_smart(client, x, y, SMART_FULL) || + place_smart(client, x, y, SMART_GROUP) || + place_smart(client, x, y, SMART_FOCUSED) || + place_random(client, x, y)))) { /* get where the client should be */ frame_frame_gravity(client->frame, x, y); Index: openbox/place.h =================================================================== RCS file: /cvs/cvsroot/openbox/openbox/place.h,v retrieving revision 1.6 diff -u -r1.6 place.h --- openbox/place.h 8 Jun 2006 11:40:40 -0000 1.6 +++ openbox/place.h 9 Jun 2006 23:03:06 -0000 @@ -27,7 +27,12 @@ typedef enum { OB_PLACE_POLICY_SMART, - OB_PLACE_POLICY_MOUSE + OB_PLACE_POLICY_SMART_TRANSPOSED, + OB_PLACE_POLICY_ROW_SMART, + OB_PLACE_POLICY_COL_SMART, + OB_PLACE_POLICY_MOUSE, + OB_PLACE_POLICY_FIRST_SMART = OB_PLACE_POLICY_SMART, + OB_PLACE_POLICY_N_SMART = OB_PLACE_POLICY_COL_SMART + 1, } ObPlacePolicy; void place_client(struct _ObClient *client, gint *x, gint *y, struct _ObAppSettings *settings);