X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=plugins%2Fplacement%2Fplacement.c;h=23ffbb5d9a47929b6280df8c3030f9e130c8da4e;hb=04a85677e535e6759ecde14b52e75789d8b8191e;hp=d6011132f12014ff151b05e0a3b6bbda9d21ab41;hpb=dabcb558cd10295f9382607936ead64d8b210b99;p=chaz%2Fopenbox diff --git a/plugins/placement/placement.c b/plugins/placement/placement.c index d6011132..23ffbb5d 100644 --- a/plugins/placement/placement.c +++ b/plugins/placement/placement.c @@ -1,12 +1,32 @@ -#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 "kernel/parse.h" #include "history.h" #include -gboolean history = TRUE; +static gboolean history; + +static void parse_assign(char *name, ParseToken *value) +{ + if (!g_ascii_strcasecmp(name, "remember")) { + if (value->type != TOKEN_BOOL) + yyerror("invalid value"); + else + history = value->data.bool; + } else + yyerror("invalid option"); + parse_free_token(value); +} + +void plugin_setup_config() +{ + history = TRUE; + + parse_reg_section("placement", NULL, parse_assign); +} static void place_random(Client *c) { @@ -14,6 +34,8 @@ static void place_random(Client *c) int x, y; Rect *area; + if (ob_state == State_Starting) return; + area = screen_area(c->desktop); l = area->x; @@ -35,9 +57,10 @@ static void event(ObEvent *e, void *foo) { g_assert(e->type == Event_Client_New); - if (ob_state == State_Starting) return; + /* 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); }