summaryrefslogtreecommitdiff
path: root/plugins/placement/placement.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-04-05 20:27:03 +0000
committerDana Jansens <danakj@orodu.net>2003-04-05 20:27:03 +0000
commitcbbf90a718ecc6836ef7a77b9040aebb9da348b8 (patch)
treea53bcdc993f850bc0500daaebd5b1bd0b7b50ee1 /plugins/placement/placement.c
parent88f8ebada97c4c82252badeb57b7e71a2940600b (diff)
change how rc parsing will work. a=b will be parsed in any [section] and given to a separate parsing callback. no more general config infrastructure needed/
Diffstat (limited to 'plugins/placement/placement.c')
-rw-r--r--plugins/placement/placement.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/plugins/placement/placement.c b/plugins/placement/placement.c
index 76b45525..23ffbb5d 100644
--- a/plugins/placement/placement.c
+++ b/plugins/placement/placement.c
@@ -1,24 +1,31 @@
-#include "../../kernel/dispatch.h"
-#include "../../kernel/client.h"
-#include "../../kernel/frame.h"
-#include "../../kernel/screen.h"
-#include "../../kernel/openbox.h"
-#include "../../kernel/config.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 <glib.h>
-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()
{
- 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);
+ history = TRUE;
+
+ parse_reg_section("placement", NULL, parse_assign);
}
static void place_random(Client *c)
@@ -48,17 +55,12 @@ static void place_random(Client *c)
static void event(ObEvent *e, void *foo)
{
- ConfigValue remember;
-
g_assert(e->type == Event_Client_New);
/* requested a position */
if (e->data.c.client->positioned) return;
- if (!config_get("placement.remember", Config_Bool, &remember))
- g_assert_not_reached();
-
- if (!remember.bool || !place_history(e->data.c.client))
+ if (!history || !place_history(e->data.c.client))
place_random(e->data.c.client);
}