X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=plugins%2Fplacement%2Fplacement.c;h=a84c41ec4fc0b294874f7fe3b34bb95c673c4937;hb=a46b4ee4341dcf5c86b9182b5b970825f2e11692;hp=2307db2ff4cf36d74c3e2d28789bf326d06cd92e;hpb=80c7f14520694771c08b9564487ba65e7dadd75e;p=chaz%2Fopenbox diff --git a/plugins/placement/placement.c b/plugins/placement/placement.c index 2307db2f..a84c41ec 100644 --- a/plugins/placement/placement.c +++ b/plugins/placement/placement.c @@ -1,26 +1,39 @@ -#include "../../kernel/dispatch.h" -#include "../../kernel/client.h" -#include "../../kernel/frame.h" -#include "../../kernel/screen.h" -#include "../../kernel/openbox.h" +#include "kernel/dispatch.h" +#include "kernel/client.h" +#include "kernel/frame.h" +#include "kernel/screen.h" +#include "kernel/openbox.h" +#include "parser/parse.h" #include "history.h" #include -gboolean history = TRUE; +static gboolean history; + +static void parse_xml(xmlDocPtr doc, xmlNodePtr node, void *d) +{ + xmlNodePtr n; + + if ((n = parse_find_node("remember", node))) + history = parse_bool(doc, n); +} void plugin_setup_config() { + history = TRUE; + + parse_register("placement", parse_xml, NULL); } -static void place_random(Client *c) +static void place_random(ObClient *c) { int l, r, t, b; int x, y; Rect *area; - if (ob_state == State_Starting) return; + if (ob_state == OB_STATE_STARTING) return; - area = screen_area(c->desktop); + area = screen_area_monitor(c->desktop, + g_random_int_range(0, screen_num_monitors)); l = area->x; t = area->y; @@ -33,7 +46,7 @@ static void place_random(Client *c) else y = 0; frame_frame_gravity(c->frame, &x, &y); /* get where the client should be */ - client_configure(c, Corner_TopLeft, x, y, c->area.width, c->area.height, + client_configure(c, OB_CORNER_TOPLEFT, x, y, c->area.width, c->area.height, TRUE, TRUE); } @@ -44,7 +57,7 @@ static void event(ObEvent *e, void *foo) /* requested a position */ if (e->data.c.client->positioned) return; - if (!place_history(e->data.c.client)) + if (!history || !place_history(e->data.c.client)) place_random(e->data.c.client); }