From: Dana Jansens Date: Sun, 23 Mar 2003 22:39:06 +0000 (+0000) Subject: make history placement optional X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=22f38541c5af082805bf08bff1e04aff8fa430dd;p=chaz%2Fopenbox make history placement optional --- diff --git a/plugins/placement/placement.c b/plugins/placement/placement.c index 2307db2f..6d025567 100644 --- a/plugins/placement/placement.c +++ b/plugins/placement/placement.c @@ -3,6 +3,7 @@ #include "../../kernel/frame.h" #include "../../kernel/screen.h" #include "../../kernel/openbox.h" +#include "../../kernel/config.h" #include "history.h" #include @@ -10,6 +11,14 @@ gboolean history = TRUE; void plugin_setup_config() { + ConfigValue val; + + config_def_set(config_def_new("placement.remember", Config_Bool, + "Remember Window Positions", + "Place windows where they last were " + "positioned.")); + val.bool = TRUE; + config_set("placement.remember", Config_Bool, val); } static void place_random(Client *c) @@ -39,12 +48,18 @@ static void place_random(Client *c) static void event(ObEvent *e, void *foo) { + ConfigValue remember; + gboolean r; + g_assert(e->type == Event_Client_New); /* requested a position */ if (e->data.c.client->positioned) return; - if (!place_history(e->data.c.client)) + r = config_get("placement.remember", Config_Bool, &remember); + g_assert(r); + + if (!remember.bool || !place_history(e->data.c.client)) place_random(e->data.c.client); }