]> Dogcows Code - chaz/openbox/commitdiff
Merge branch 'backport' into work
authorDana Jansens <danakj@orodu.net>
Thu, 21 Feb 2008 18:24:19 +0000 (13:24 -0500)
committerDana Jansens <danakj@orodu.net>
Thu, 21 Feb 2008 18:24:19 +0000 (13:24 -0500)
Conflicts:

openbox/openbox.c
openbox/session.c

1  2 
openbox/actions.c
openbox/actions/execute.c
openbox/actions/moveresizeto.c
openbox/config.c
openbox/menu.c
openbox/mouse.c
openbox/openbox.c
openbox/session.c
openbox/translate.c

diff --combined openbox/actions.c
index 5bd70139d735aed9738c7af26c55e69e2f1ec14d,d43896d761cb429e70909f0807bb2c515232746b..8f72714e9403026b55ddb5394b381ae941fd3fc6
@@@ -147,7 -147,7 +147,7 @@@ static ObActionsAct* actions_build_act_
          actions_definition_ref(act->def);
          act->options = NULL;
      } else
-         g_message(_("Invalid action '%s' requested. No such action exists."),
+         g_message(_("Invalid action \"%s\" requested. No such action exists."),
                    name);
  
      return act;
@@@ -159,21 -159,23 +159,21 @@@ ObActionsAct* actions_parse_string(cons
  
      if ((act = actions_build_act_from_string(name)))
          if (act->def->setup)
 -            act->options = act->def->setup(NULL, NULL, NULL);
 +            act->options = act->def->setup(NULL);
  
      return act;
  }
  
 -ObActionsAct* actions_parse(ObParseInst *i,
 -                            xmlDocPtr doc,
 -                            xmlNodePtr node)
 +ObActionsAct* actions_parse(xmlNodePtr node)
  {
      gchar *name;
      ObActionsAct *act = NULL;
  
 -    if (parse_attr_string("name", node, &name)) {
 +    if (obt_parse_attr_string(node, "name", &name)) {
          if ((act = actions_build_act_from_string(name)))
              /* there is more stuff to parse here */
              if (act->def->setup)
 -                act->options = act->def->setup(i, doc, node->xmlChildrenNode);
 +                act->options = act->def->setup(node->children);
  
          g_free(name);
      }
index c534ba8b3de5b5fc629658b592a8c1aee161e7dc,24717b56042e7d71fbbdd0a833e02fd4e4d9b855..ff73bf2bce288eb13e5804372f48b44f286c6669
@@@ -2,7 -2,6 +2,7 @@@
  #include "openbox/event.h"
  #include "openbox/startupnotify.h"
  #include "openbox/screen.h"
 +#include "obt/paths.h"
  #include "gettext.h"
  
  #ifdef HAVE_STDLIB_H
@@@ -17,7 -16,7 +17,7 @@@ typedef struct 
      gchar   *sn_wmclass;
  } Options;
  
 -static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
 +static gpointer setup_func(xmlNodePtr node);
  static void     free_func(gpointer options);
  static gboolean run_func(ObActionsData *data, gpointer options);
  /*
@@@ -30,34 -29,38 +30,34 @@@ static void     i_cancel_func(gpointer 
  
  void action_execute_startup(void)
  {
 -    actions_register("Execute",
 -                     setup_func,
 -                     free_func,
 -                     run_func,
 -                     NULL, NULL);
 +    actions_register("Execute", setup_func, free_func, run_func, NULL, NULL);
  }
  
 -static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
 +static gpointer setup_func(xmlNodePtr node)
  {
      xmlNodePtr n;
      Options *o;
  
      o = g_new0(Options, 1);
  
 -    if ((n = parse_find_node("command", node)) ||
 -        (n = parse_find_node("execute", node)))
 +    if ((n = obt_parse_find_node(node, "command")) ||
 +        (n = obt_parse_find_node(node, "execute")))
      {
 -        gchar *s = parse_string(doc, n);
 -        o->cmd = parse_expand_tilde(s);
 +        gchar *s = obt_parse_node_string(n);
 +        o->cmd = obt_paths_expand_tilde(s);
          g_free(s);
      }
  
 -    if ((n = parse_find_node("startupnotify", node))) {
 +    if ((n = obt_parse_find_node(node, "startupnotify"))) {
          xmlNodePtr m;
 -        if ((m = parse_find_node("enabled", n->xmlChildrenNode)))
 -            o->sn = parse_bool(doc, m);
 -        if ((m = parse_find_node("name", n->xmlChildrenNode)))
 -            o->sn_name = parse_string(doc, m);
 -        if ((m = parse_find_node("icon", n->xmlChildrenNode)))
 -            o->sn_icon = parse_string(doc, m);
 -        if ((m = parse_find_node("wmclass", n->xmlChildrenNode)))
 -            o->sn_wmclass = parse_string(doc, m);
 +        if ((m = obt_parse_find_node(n->children, "enabled")))
 +            o->sn = obt_parse_node_bool(m);
 +        if ((m = obt_parse_find_node(n->children, "name")))
 +            o->sn_name = obt_parse_node_string(m);
 +        if ((m = obt_parse_find_node(n->children, "icon")))
 +            o->sn_icon = obt_parse_node_string(m);
 +        if ((m = obt_parse_find_node(n->children, "wmclass")))
 +            o->sn_wmclass = obt_parse_node_string(m);
      }
      return o;
  }
@@@ -86,7 -89,7 +86,7 @@@ static gboolean run_func(ObActionsData 
      if (!o->cmd) return FALSE;
      cmd = g_filename_from_utf8(o->cmd, -1, NULL, NULL, NULL);
      if (!cmd) {
-         g_message(_("Failed to convert the path '%s' from utf8"), o->cmd);
+         g_message(_("Failed to convert the path \"%s\" from utf8"), o->cmd);
          return FALSE;
      }
  
@@@ -95,7 -98,7 +95,7 @@@
      event_cancel_all_key_grabs();
  
      if (!g_shell_parse_argv(cmd, NULL, &argv, &e)) {
-         g_message(_("Failed to execute '%s': %s"), o->cmd, e->message);
+         g_message(_("Failed to execute \"%s\": %s"), o->cmd, e->message);
          g_error_free(e);
      }
      else {
                             G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
                             NULL, NULL, NULL, &e))
          {
-             g_message(_("Failed to execute '%s': %s"), o->cmd, e->message);
+             g_message(_("Failed to execute \"%s\": %s"), o->cmd, e->message);
              g_error_free(e);
  
              if (o->sn)
index d355dafdc5c30ea0535c1b239a2a62275899e364,cdd772ad735e8d96cb1ad436b85c769bdfaaa4b7..357c7315d87b84c01e1de9b2a21197d4dcf4c933
@@@ -21,18 -21,23 +21,18 @@@ typedef struct 
      gint monitor;
  } Options;
  
 -static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node);
 -static void     free_func(gpointer options);
 +static gpointer setup_func(xmlNodePtr node);
  static gboolean run_func(ObActionsData *data, gpointer options);
  
  void action_moveresizeto_startup(void)
  {
 -    actions_register("MoveResizeTo",
 -                     setup_func,
 -                     free_func,
 -                     run_func,
 -                     NULL, NULL);
 +    actions_register("MoveResizeTo", setup_func, g_free, run_func, NULL, NULL);
  }
  
 -static void parse_coord(xmlDocPtr doc, xmlNodePtr n, gint *pos,
 +static void parse_coord(xmlNodePtr n, gint *pos,
                          gboolean *opposite, gboolean *center)
  {
 -    gchar *s = parse_string(doc, n);
 +    gchar *s = obt_parse_node_string(n);
      if (g_ascii_strcasecmp(s, "current") != 0) {
          if (!g_ascii_strcasecmp(s, "center"))
              *center = TRUE;
@@@ -48,7 -53,7 +48,7 @@@
      g_free(s);
  }
  
 -static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node)
 +static gpointer setup_func(xmlNodePtr node)
  {
      xmlNodePtr n;
      Options *o;
      o->h = G_MININT;
      o->monitor = CURRENT_MONITOR;
  
 -    if ((n = parse_find_node("x", node)))
 -        parse_coord(doc, n, &o->x, &o->xopposite, &o->xcenter);
 +    if ((n = obt_parse_find_node(node, "x")))
 +        parse_coord(n, &o->x, &o->xopposite, &o->xcenter);
  
 -    if ((n = parse_find_node("y", node)))
 -        parse_coord(doc, n, &o->y, &o->yopposite, &o->ycenter);
 +    if ((n = obt_parse_find_node(node, "y")))
 +        parse_coord(n, &o->y, &o->yopposite, &o->ycenter);
  
 -    if ((n = parse_find_node("width", node))) {
 -        gchar *s = parse_string(doc, n);
 +    if ((n = obt_parse_find_node(node, "width"))) {
 +        gchar *s = obt_parse_node_string(n);
          if (g_ascii_strcasecmp(s, "current") != 0)
 -            o->w = parse_int(doc, n);
 +            o->w = obt_parse_node_int(n);
          g_free(s);
      }
 -    if ((n = parse_find_node("height", node))) {
 -        gchar *s = parse_string(doc, n);
 +    if ((n = obt_parse_find_node(node, "height"))) {
 +        gchar *s = obt_parse_node_string(n);
          if (g_ascii_strcasecmp(s, "current") != 0)
 -            o->h = parse_int(doc, n);
 +            o->h = obt_parse_node_int(n);
          g_free(s);
      }
  
 -    if ((n = parse_find_node("monitor", node))) {
 -        gchar *s = parse_string(doc, n);
 +    if ((n = obt_parse_find_node(node, "monitor"))) {
 +        gchar *s = obt_parse_node_string(n);
          if (g_ascii_strcasecmp(s, "current") != 0) {
              if (!g_ascii_strcasecmp(s, "all"))
                  o->monitor = ALL_MONITORS;
              else
 -                o->monitor = parse_int(doc, n) - 1;
 +                o->monitor = obt_parse_node_int(n) - 1;
          }
          g_free(s);
      }
      return o;
  }
  
 -static void free_func(gpointer options)
 -{
 -    Options *o = options;
 -
 -    g_free(o);
 -}
 -
  /* Always return FALSE because its not interactive */
  static gboolean run_func(ObActionsData *data, gpointer options)
  {
          x = o->x;
          if (o->xcenter) x = (area->width - w) / 2;
          else if (x == G_MININT) x = c->frame->area.x - carea->x;
-         else if (o->xopposite) x = area->width - w;
+         else if (o->xopposite) x = area->width - w - x;
          x += area->x;
  
          y = o->y;
          if (o->ycenter) y = (area->height - h) / 2;
          else if (y == G_MININT) y = c->frame->area.y - carea->y;
-         else if (o->yopposite) y = area->height - h;
+         else if (o->yopposite) y = area->height - h - y;
          y += area->y;
  
          /* get the client's size back */
diff --combined openbox/config.c
index 0696806bc0329f1374c1c786f62115b4a3afa9d5,00efd5ecea0565ccbe53d8a3fd48aa1f1f1ae2e3..109b2150565019374ef40354e716e9364d55abe8
  #include "keyboard.h"
  #include "mouse.h"
  #include "actions.h"
 -#include "prop.h"
  #include "translate.h"
  #include "client.h"
  #include "screen.h"
 -#include "parser/parse.h"
  #include "openbox.h"
  #include "gettext.h"
 +#include "obt/paths.h"
  
  gboolean config_focus_new;
  gboolean config_focus_follow;
@@@ -145,9 -146,10 +145,9 @@@ void config_app_settings_copy_non_defau
      }
  }
  
 -static void config_parse_gravity_coord(xmlDocPtr doc, xmlNodePtr node,
 -                                       GravityCoord *c)
 +static void config_parse_gravity_coord(xmlNodePtr node, GravityCoord *c)
  {
 -    gchar *s = parse_string(doc, node);
 +    gchar *s = obt_parse_node_string(node);
      if (!g_ascii_strcasecmp(s, "center"))
          c->center = TRUE;
      else {
     the monitor, so <position><x>center</x></position><monitor>2</monitor>
     will center the window on the second monitor.
  */
 -static void parse_per_app_settings(ObParseInst *inst, xmlDocPtr doc,
 -                                   xmlNodePtr node, gpointer data)
 +static void parse_per_app_settings(xmlNodePtr node, gpointer d)
  {
 -    xmlNodePtr app = parse_find_node("application", node->children);
 +    xmlNodePtr app = obt_parse_find_node(node->children, "application");
      gchar *name = NULL, *class = NULL, *role = NULL, *type = NULL;
      gboolean name_set, class_set, type_set;
      gboolean x_pos_given;
      while (app) {
          name_set = class_set = type_set = x_pos_given = FALSE;
  
 -        class_set = parse_attr_string("class", app, &class);
 -        name_set = parse_attr_string("name", app, &name);
 -        type_set = parse_attr_string("type", app, &type);
 +        class_set = obt_parse_attr_string(app, "class", &class);
 +        name_set = obt_parse_attr_string(app, "name", &name);
 +        type_set = obt_parse_attr_string(app, "type", &type);
          if (class_set || name_set) {
              xmlNodePtr n, c;
              ObAppSettings *settings = config_create_app_settings();;
                      settings->type = OB_CLIENT_TYPE_DESKTOP;
              }
  
 -            if (parse_attr_string("role", app, &role))
 +            if (obt_parse_attr_string(app, "role", &role))
                  settings->role = g_pattern_spec_new(role);
  
 -            if ((n = parse_find_node("decor", app->children)))
 -                if (!parse_contains("default", doc, n))
 -                    settings->decor = parse_bool(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "decor")))
 +                if (!obt_parse_node_contains(n, "default"))
 +                    settings->decor = obt_parse_node_bool(n);
  
 -            if ((n = parse_find_node("shade", app->children)))
 -                if (!parse_contains("default", doc, n))
 -                    settings->shade = parse_bool(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "shade")))
 +                if (!obt_parse_node_contains(n, "default"))
 +                    settings->shade = obt_parse_node_bool(n);
  
 -            if ((n = parse_find_node("position", app->children))) {
 -                if ((c = parse_find_node("x", n->children)))
 -                    if (!parse_contains("default", doc, c)) {
 -                        config_parse_gravity_coord(doc, c,
 -                                                   &settings->position.x);
 +            if ((n = obt_parse_find_node(app->children, "position"))) {
 +                if ((c = obt_parse_find_node(n->children, "x")))
 +                    if (!obt_parse_node_contains(c, "default")) {
 +                        config_parse_gravity_coord(c, &settings->position.x);
                          x_pos_given = TRUE;
                      }
  
 -                if (x_pos_given && (c = parse_find_node("y", n->children)))
 -                    if (!parse_contains("default", doc, c)) {
 -                        config_parse_gravity_coord(doc, c,
 -                                                   &settings->position.y);
 +                if (x_pos_given && (c = obt_parse_find_node(n->children, "y")))
 +                    if (!obt_parse_node_contains(c, "default")) {
 +                        config_parse_gravity_coord(c, &settings->position.y);
                          settings->pos_given = TRUE;
                      }
  
                  if (settings->pos_given &&
 -                    (c = parse_find_node("monitor", n->children)))
 -                    if (!parse_contains("default", doc, c)) {
 -                        gchar *s = parse_string(doc, c);
 +                    (c = obt_parse_find_node(n->children, "monitor")))
 +                    if (!obt_parse_node_contains(c, "default")) {
 +                        gchar *s = obt_parse_node_string(c);
                          if (!g_ascii_strcasecmp(s, "mouse"))
                              settings->monitor = 0;
                          else
 -                            settings->monitor = parse_int(doc, c) + 1;
 +                            settings->monitor = obt_parse_node_int(c) + 1;
                          g_free(s);
                      }
  
 -                parse_attr_bool("force", n, &settings->pos_force);
 +                obt_parse_attr_bool(n, "force", &settings->pos_force);
              }
  
 -            if ((n = parse_find_node("focus", app->children)))
 -                if (!parse_contains("default", doc, n))
 -                    settings->focus = parse_bool(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "focus")))
 +                if (!obt_parse_node_contains(n, "default"))
 +                    settings->focus = obt_parse_node_bool(n);
  
 -            if ((n = parse_find_node("desktop", app->children))) {
 -                if (!parse_contains("default", doc, n)) {
 -                    gchar *s = parse_string(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "desktop"))) {
 +                if (!obt_parse_node_contains(n, "default")) {
 +                    gchar *s = obt_parse_node_string(n);
                      if (!g_ascii_strcasecmp(s, "all"))
                          settings->desktop = DESKTOP_ALL;
                      else {
 -                        gint i = parse_int(doc, n);
 +                        gint i = obt_parse_node_int(n);
                          if (i > 0)
                              settings->desktop = i;
                      }
                  }
              }
  
 -            if ((n = parse_find_node("layer", app->children)))
 -                if (!parse_contains("default", doc, n)) {
 -                    gchar *s = parse_string(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "layer")))
 +                if (!obt_parse_node_contains(n, "default")) {
 +                    gchar *s = obt_parse_node_string(n);
                      if (!g_ascii_strcasecmp(s, "above"))
                          settings->layer = 1;
                      else if (!g_ascii_strcasecmp(s, "below"))
                      g_free(s);
                  }
  
 -            if ((n = parse_find_node("iconic", app->children)))
 -                if (!parse_contains("default", doc, n))
 -                    settings->iconic = parse_bool(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "iconic")))
 +                if (!obt_parse_node_contains(n, "default"))
 +                    settings->iconic = obt_parse_node_bool(n);
  
 -            if ((n = parse_find_node("skip_pager", app->children)))
 -                if (!parse_contains("default", doc, n))
 -                    settings->skip_pager = parse_bool(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "skip_pager")))
 +                if (!obt_parse_node_contains(n, "default"))
 +                    settings->skip_pager = obt_parse_node_bool(n);
  
 -            if ((n = parse_find_node("skip_taskbar", app->children)))
 -                if (!parse_contains("default", doc, n))
 -                    settings->skip_taskbar = parse_bool(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "skip_taskbar")))
 +                if (!obt_parse_node_contains(n, "default"))
 +                    settings->skip_taskbar = obt_parse_node_bool(n);
  
 -            if ((n = parse_find_node("fullscreen", app->children)))
 -                if (!parse_contains("default", doc, n))
 -                    settings->fullscreen = parse_bool(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "fullscreen")))
 +                if (!obt_parse_node_contains(n, "default"))
 +                    settings->fullscreen = obt_parse_node_bool(n);
  
 -            if ((n = parse_find_node("maximized", app->children)))
 -                if (!parse_contains("default", doc, n)) {
 -                    gchar *s = parse_string(doc, n);
 +            if ((n = obt_parse_find_node(app->children, "maximized")))
 +                if (!obt_parse_node_contains(n, "default")) {
 +                    gchar *s = obt_parse_node_string(n);
                      if (!g_ascii_strcasecmp(s, "horizontal")) {
                          settings->max_horz = TRUE;
                          settings->max_vert = FALSE;
                          settings->max_vert = TRUE;
                      } else
                          settings->max_horz = settings->max_vert =
 -                            parse_bool(doc, n);
 +                            obt_parse_node_bool(n);
                      g_free(s);
                  }
  
              name = class = role = NULL;
          }
  
 -        app = parse_find_node("application", app->next);
 +        app = obt_parse_find_node(app->next, "application");
      }
  }
  
  
  */
  
 -static void parse_key(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                      GList *keylist)
 +static void parse_key(xmlNodePtr node, GList *keylist)
  {
      gchar *key;
      xmlNodePtr n;
      gboolean is_chroot = FALSE;
  
 -    if (!parse_attr_string("key", node, &key))
 +    if (!obt_parse_attr_string(node, "key", &key))
          return;
  
 -    parse_attr_bool("chroot", node, &is_chroot);
 +    obt_parse_attr_bool(node, "chroot", &is_chroot);
  
      keylist = g_list_append(keylist, key);
  
 -    if ((n = parse_find_node("keybind", node->children))) {
 +    if ((n = obt_parse_find_node(node->children, "keybind"))) {
          while (n) {
 -            parse_key(i, doc, n, keylist);
 -            n = parse_find_node("keybind", n->next);
 +            parse_key(n, keylist);
 +            n = obt_parse_find_node(n->next, "keybind");
          }
      }
 -    else if ((n = parse_find_node("action", node->children))) {
 +    else if ((n = obt_parse_find_node(node->children, "action"))) {
          while (n) {
              ObActionsAct *action;
  
 -            action = actions_parse(i, doc, n);
 +            action = actions_parse(n);
              if (action)
                  keyboard_bind(keylist, action);
 -            n = parse_find_node("action", n->next);
 +            n = obt_parse_find_node(n->next, "action");
          }
      }
  
      keylist = g_list_delete_link(keylist, g_list_last(keylist));
  }
  
 -static void parse_keyboard(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                           gpointer data)
 +static void parse_keyboard(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
      gchar *key;
  
      keyboard_unbind_all();
  
 -    if ((n = parse_find_node("chainQuitKey", node->children))) {
 -        key = parse_string(doc, n);
 +    if ((n = obt_parse_find_node(node->children, "chainQuitKey"))) {
 +        key = obt_parse_node_string(n);
          translate_key(key, &config_keyboard_reset_state,
                        &config_keyboard_reset_keycode);
          g_free(key);
      }
  
 -    if ((n = parse_find_node("keybind", node->children)))
 +    if ((n = obt_parse_find_node(node->children, "keybind")))
          while (n) {
 -            parse_key(i, doc, n, NULL);
 -            n = parse_find_node("keybind", n->next);
 +            parse_key(n, NULL);
 +            n = obt_parse_find_node(n->next, "keybind");
          }
  }
  
  
  */
  
 -static void parse_mouse(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                        gpointer data)
 +static void parse_mouse(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n, nbut, nact;
      gchar *buttonstr;
  
      node = node->children;
  
 -    if ((n = parse_find_node("dragThreshold", node)))
 -        config_mouse_threshold = parse_int(doc, n);
 -    if ((n = parse_find_node("doubleClickTime", node)))
 -        config_mouse_dclicktime = parse_int(doc, n);
 -    if ((n = parse_find_node("screenEdgeWarpTime", node)))
 -        config_mouse_screenedgetime = parse_int(doc, n);
 +    if ((n = obt_parse_find_node(node, "dragThreshold")))
 +        config_mouse_threshold = obt_parse_node_int(n);
 +    if ((n = obt_parse_find_node(node, "doubleClickTime")))
 +        config_mouse_dclicktime = obt_parse_node_int(n);
 +    if ((n = obt_parse_find_node(node, "screenEdgeWarpTime")))
 +        config_mouse_screenedgetime = obt_parse_node_int(n);
  
 -    n = parse_find_node("context", node);
 +    n = obt_parse_find_node(node, "context");
      while (n) {
 -        if (!parse_attr_string("name", n, &contextstr))
 +        if (!obt_parse_attr_string(n, "name", &contextstr))
              goto next_n;
 -        nbut = parse_find_node("mousebind", n->children);
 +        nbut = obt_parse_find_node(n->children, "mousebind");
          while (nbut) {
 -            if (!parse_attr_string("button", nbut, &buttonstr))
 +            if (!obt_parse_attr_string(nbut, "button", &buttonstr))
                  goto next_nbut;
 -            if (parse_attr_contains("press", nbut, "action")) {
 +            if (obt_parse_attr_contains(nbut, "action", "press")) {
                  mact = OB_MOUSE_ACTION_PRESS;
 -            } else if (parse_attr_contains("release", nbut, "action")) {
 +            } else if (obt_parse_attr_contains(nbut, "action", "release")) {
                  mact = OB_MOUSE_ACTION_RELEASE;
 -            } else if (parse_attr_contains("click", nbut, "action")) {
 +            } else if (obt_parse_attr_contains(nbut, "action", "click")) {
                  mact = OB_MOUSE_ACTION_CLICK;
 -            } else if (parse_attr_contains("doubleclick", nbut,"action")) {
 +            } else if (obt_parse_attr_contains(nbut, "action","doubleclick")) {
                  mact = OB_MOUSE_ACTION_DOUBLE_CLICK;
 -            } else if (parse_attr_contains("drag", nbut, "action")) {
 +            } else if (obt_parse_attr_contains(nbut, "action", "drag")) {
                  mact = OB_MOUSE_ACTION_MOTION;
              } else
                  goto next_nbut;
 -            nact = parse_find_node("action", nbut->children);
 +            nact = obt_parse_find_node(nbut->children, "action");
              while (nact) {
                  ObActionsAct *action;
  
 -                if ((action = actions_parse(i, doc, nact)))
 +                if ((action = actions_parse(nact)))
                      mouse_bind(buttonstr, contextstr, mact, action);
 -                nact = parse_find_node("action", nact->next);
 +                nact = obt_parse_find_node(nact->next, "action");
              }
              g_free(buttonstr);
          next_nbut:
 -            nbut = parse_find_node("mousebind", nbut->next);
 +            nbut = obt_parse_find_node(nbut->next, "mousebind");
          }
          g_free(contextstr);
      next_n:
 -        n = parse_find_node("context", n->next);
 +        n = obt_parse_find_node(n->next, "context");
      }
  }
  
 -static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                        gpointer data)
 +static void parse_focus(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
  
      node = node->children;
  
 -    if ((n = parse_find_node("focusNew", node)))
 -        config_focus_new = parse_bool(doc, n);
 -    if ((n = parse_find_node("followMouse", node)))
 -        config_focus_follow = parse_bool(doc, n);
 -    if ((n = parse_find_node("focusDelay", node)))
 -        config_focus_delay = parse_int(doc, n);
 -    if ((n = parse_find_node("raiseOnFocus", node)))
 -        config_focus_raise = parse_bool(doc, n);
 -    if ((n = parse_find_node("focusLast", node)))
 -        config_focus_last = parse_bool(doc, n);
 -    if ((n = parse_find_node("underMouse", node)))
 -        config_focus_under_mouse = parse_bool(doc, n);
 +    if ((n = obt_parse_find_node(node, "focusNew")))
 +        config_focus_new = obt_parse_node_bool(n);
 +    if ((n = obt_parse_find_node(node, "followMouse")))
 +        config_focus_follow = obt_parse_node_bool(n);
 +    if ((n = obt_parse_find_node(node, "focusDelay")))
 +        config_focus_delay = obt_parse_node_int(n);
 +    if ((n = obt_parse_find_node(node, "raiseOnFocus")))
 +        config_focus_raise = obt_parse_node_bool(n);
 +    if ((n = obt_parse_find_node(node, "focusLast")))
 +        config_focus_last = obt_parse_node_bool(n);
 +    if ((n = obt_parse_find_node(node, "underMouse")))
 +        config_focus_under_mouse = obt_parse_node_bool(n);
  }
  
 -static void parse_placement(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                            gpointer data)
 +static void parse_placement(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
  
      node = node->children;
  
 -    if ((n = parse_find_node("policy", node)))
 -        if (parse_contains("UnderMouse", doc, n))
 +    if ((n = obt_parse_find_node(node, "policy")))
 +        if (obt_parse_node_contains(n, "UnderMouse"))
              config_place_policy = OB_PLACE_POLICY_MOUSE;
 -    if ((n = parse_find_node("center", node)))
 -        config_place_center = parse_bool(doc, n);
 -    if ((n = parse_find_node("monitor", node))) {
 -        if (parse_contains("active", doc, n))
 +    if ((n = obt_parse_find_node(node, "center")))
 +        config_place_center = obt_parse_node_bool(n);
 +    if ((n = obt_parse_find_node(node, "monitor"))) {
 +        if (obt_parse_node_contains(n, "active"))
              config_place_monitor = OB_PLACE_MONITOR_ACTIVE;
 -        else if (parse_contains("mouse", doc, n))
 +        else if (obt_parse_node_contains(n, "mouse"))
              config_place_monitor = OB_PLACE_MONITOR_MOUSE;
      }
  }
  
 -static void parse_margins(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                          gpointer data)
 +static void parse_margins(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
  
      node = node->children;
  
 -    if ((n = parse_find_node("top", node)))
 -        config_margins.top = MAX(0, parse_int(doc, n));
 -    if ((n = parse_find_node("left", node)))
 -        config_margins.left = MAX(0, parse_int(doc, n));
 -    if ((n = parse_find_node("right", node)))
 -        config_margins.right = MAX(0, parse_int(doc, n));
 -    if ((n = parse_find_node("bottom", node)))
 -        config_margins.bottom = MAX(0, parse_int(doc, n));
 +    if ((n = obt_parse_find_node(node, "top")))
 +        config_margins.top = MAX(0, obt_parse_node_int(n));
 +    if ((n = obt_parse_find_node(node, "left")))
 +        config_margins.left = MAX(0, obt_parse_node_int(n));
 +    if ((n = obt_parse_find_node(node, "right")))
 +        config_margins.right = MAX(0, obt_parse_node_int(n));
 +    if ((n = obt_parse_find_node(node, "bottom")))
 +        config_margins.bottom = MAX(0, obt_parse_node_int(n));
  }
  
 -static void parse_theme(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                        gpointer data)
 +static void parse_theme(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
  
      node = node->children;
  
 -    if ((n = parse_find_node("name", node))) {
 +    if ((n = obt_parse_find_node(node, "name"))) {
          gchar *c;
  
          g_free(config_theme);
 -        c = parse_string(doc, n);
 -        config_theme = parse_expand_tilde(c);
 +        c = obt_parse_node_string(n);
 +        config_theme = obt_paths_expand_tilde(c);
          g_free(c);
      }
 -    if ((n = parse_find_node("titleLayout", node))) {
 +    if ((n = obt_parse_find_node(node, "titleLayout"))) {
          gchar *c, *d;
  
          g_free(config_title_layout);
 -        config_title_layout = parse_string(doc, n);
 +        config_title_layout = obt_parse_node_string(n);
  
          /* replace duplicates with spaces */
          for (c = config_title_layout; *c != '\0'; ++c)
              for (d = c+1; *d != '\0'; ++d)
                  if (*c == *d) *d = ' ';
      }
 -    if ((n = parse_find_node("keepBorder", node)))
 -        config_theme_keepborder = parse_bool(doc, n);
 -    if ((n = parse_find_node("animateIconify", node)))
 -        config_animate_iconify = parse_bool(doc, n);
 +    if ((n = obt_parse_find_node(node, "keepBorder")))
 +        config_theme_keepborder = obt_parse_node_bool(n);
 +    if ((n = obt_parse_find_node(node, "animateIconify")))
 +        config_animate_iconify = obt_parse_node_bool(n);
  
 -    n = parse_find_node("font", node);
 +    n = obt_parse_find_node(node, "font");
      while (n) {
          xmlNodePtr   fnode;
          RrFont     **font;
          RrFontWeight weight = RrDefaultFontWeight;
          RrFontSlant  slant = RrDefaultFontSlant;
  
 -        if (parse_attr_contains("ActiveWindow", n, "place"))
 +        if (obt_parse_attr_contains(n, "place", "ActiveWindow"))
              font = &config_font_activewindow;
 -        else if (parse_attr_contains("InactiveWindow", n, "place"))
 +        else if (obt_parse_attr_contains(n, "place", "InactiveWindow"))
              font = &config_font_inactivewindow;
 -        else if (parse_attr_contains("MenuHeader", n, "place"))
 +        else if (obt_parse_attr_contains(n, "place", "MenuHeader"))
              font = &config_font_menutitle;
 -        else if (parse_attr_contains("MenuItem", n, "place"))
 +        else if (obt_parse_attr_contains(n, "place", "MenuItem"))
              font = &config_font_menuitem;
 -        else if (parse_attr_contains("OnScreenDisplay", n, "place"))
 +        else if (obt_parse_attr_contains(n, "place", "OnScreenDisplay"))
              font = &config_font_osd;
          else
              goto next_font;
  
 -        if ((fnode = parse_find_node("name", n->children))) {
 +        if ((fnode = obt_parse_find_node(n->children, "name"))) {
              g_free(name);
 -            name = parse_string(doc, fnode);
 +            name = obt_parse_node_string(fnode);
          }
 -        if ((fnode = parse_find_node("size", n->children))) {
 -            int s = parse_int(doc, fnode);
 +        if ((fnode = obt_parse_find_node(n->children, "size"))) {
 +            int s = obt_parse_node_int(fnode);
              if (s > 0) size = s;
          }
 -        if ((fnode = parse_find_node("weight", n->children))) {
 -            gchar *w = parse_string(doc, fnode);
 +        if ((fnode = obt_parse_find_node(n->children, "weight"))) {
 +            gchar *w = obt_parse_node_string(fnode);
              if (!g_ascii_strcasecmp(w, "Bold"))
                  weight = RR_FONTWEIGHT_BOLD;
              g_free(w);
          }
 -        if ((fnode = parse_find_node("slant", n->children))) {
 -            gchar *s = parse_string(doc, fnode);
 +        if ((fnode = obt_parse_find_node(n->children, "slant"))) {
 +            gchar *s = obt_parse_node_string(fnode);
              if (!g_ascii_strcasecmp(s, "Italic"))
                  slant = RR_FONTSLANT_ITALIC;
              if (!g_ascii_strcasecmp(s, "Oblique"))
          *font = RrFontOpen(ob_rr_inst, name, size, weight, slant);
          g_free(name);
      next_font:
 -        n = parse_find_node("font", n->next);
 +        n = obt_parse_find_node(n->next, "font");
      }
  }
  
 -static void parse_desktops(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                           gpointer data)
 +static void parse_desktops(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
  
      node = node->children;
  
 -    if ((n = parse_find_node("number", node))) {
 -        gint d = parse_int(doc, n);
 +    if ((n = obt_parse_find_node(node, "number"))) {
 +        gint d = obt_parse_node_int(n);
          if (d > 0)
              config_desktops_num = (unsigned) d;
      }
 -    if ((n = parse_find_node("firstdesk", node))) {
 -        gint d = parse_int(doc, n);
 +    if ((n = obt_parse_find_node(node, "firstdesk"))) {
 +        gint d = obt_parse_node_int(n);
          if (d > 0)
              config_screen_firstdesk = (unsigned) d;
      }
 -    if ((n = parse_find_node("names", node))) {
 +    if ((n = obt_parse_find_node(node, "names"))) {
          GSList *it;
          xmlNodePtr nname;
  
          g_slist_free(config_desktops_names);
          config_desktops_names = NULL;
  
 -        nname = parse_find_node("name", n->children);
 +        nname = obt_parse_find_node(n->children, "name");
          while (nname) {
 -            config_desktops_names = g_slist_append(config_desktops_names,
 -                                                   parse_string(doc, nname));
 -            nname = parse_find_node("name", nname->next);
 +            config_desktops_names =
 +                g_slist_append(config_desktops_names,
 +                               obt_parse_node_string(nname));
 +            nname = obt_parse_find_node(nname->next, "name");
          }
      }
 -    if ((n = parse_find_node("popupTime", node)))
 -        config_desktop_popup_time = parse_int(doc, n);
 +    if ((n = obt_parse_find_node(node, "popupTime")))
 +        config_desktop_popup_time = obt_parse_node_int(n);
  }
  
 -static void parse_resize(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                         gpointer data)
 +static void parse_resize(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
  
      node = node->children;
  
 -    if ((n = parse_find_node("drawContents", node)))
 -        config_resize_redraw = parse_bool(doc, n);
 -    if ((n = parse_find_node("popupShow", node))) {
 -        config_resize_popup_show = parse_int(doc, n);
 -        if (parse_contains("Always", doc, n))
 +    if ((n = obt_parse_find_node(node, "drawContents")))
 +        config_resize_redraw = obt_parse_node_bool(n);
 +    if ((n = obt_parse_find_node(node, "popupShow"))) {
 +        config_resize_popup_show = obt_parse_node_int(n);
 +        if (obt_parse_node_contains(n, "Always"))
              config_resize_popup_show = 2;
 -        else if (parse_contains("Never", doc, n))
 +        else if (obt_parse_node_contains(n, "Never"))
              config_resize_popup_show = 0;
 -        else if (parse_contains("Nonpixel", doc, n))
 +        else if (obt_parse_node_contains(n, "Nonpixel"))
              config_resize_popup_show = 1;
      }
 -    if ((n = parse_find_node("popupPosition", node))) {
 -        if (parse_contains("Top", doc, n))
 +    if ((n = obt_parse_find_node(node, "popupPosition"))) {
 +        if (obt_parse_node_contains(n, "Top"))
              config_resize_popup_pos = OB_RESIZE_POS_TOP;
 -        else if (parse_contains("Center", doc, n))
 +        else if (obt_parse_node_contains(n, "Center"))
              config_resize_popup_pos = OB_RESIZE_POS_CENTER;
 -        else if (parse_contains("Fixed", doc, n)) {
 +        else if (obt_parse_node_contains(n, "Fixed")) {
              config_resize_popup_pos = OB_RESIZE_POS_FIXED;
  
 -            if ((n = parse_find_node("popupFixedPosition", node))) {
 +            if ((n = obt_parse_find_node(node, "popupFixedPosition"))) {
                  xmlNodePtr n2;
  
 -                if ((n2 = parse_find_node("x", n->children)))
 -                    config_parse_gravity_coord(doc, n2,
 +                if ((n2 = obt_parse_find_node(n->children, "x")))
 +                    config_parse_gravity_coord(n2,
                                                 &config_resize_popup_fixed.x);
 -                if ((n2 = parse_find_node("y", n->children)))
 -                    config_parse_gravity_coord(doc, n2,
 +                if ((n2 = obt_parse_find_node(n->children, "y")))
 +                    config_parse_gravity_coord(n2,
                                                 &config_resize_popup_fixed.y);
  
                  config_resize_popup_fixed.x.pos =
      }
  }
  
 -static void parse_dock(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                       gpointer data)
 +static void parse_dock(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
  
      node = node->children;
  
 -    if ((n = parse_find_node("position", node))) {
 -        if (parse_contains("TopLeft", doc, n))
 +    if ((n = obt_parse_find_node(node, "position"))) {
 +        if (obt_parse_node_contains(n, "TopLeft"))
              config_dock_floating = FALSE,
              config_dock_pos = OB_DIRECTION_NORTHWEST;
 -        else if (parse_contains("Top", doc, n))
 +        else if (obt_parse_node_contains(n, "Top"))
              config_dock_floating = FALSE,
              config_dock_pos = OB_DIRECTION_NORTH;
 -        else if (parse_contains("TopRight", doc, n))
 +        else if (obt_parse_node_contains(n, "TopRight"))
              config_dock_floating = FALSE,
              config_dock_pos = OB_DIRECTION_NORTHEAST;
 -        else if (parse_contains("Right", doc, n))
 +        else if (obt_parse_node_contains(n, "Right"))
              config_dock_floating = FALSE,
              config_dock_pos = OB_DIRECTION_EAST;
 -        else if (parse_contains("BottomRight", doc, n))
 +        else if (obt_parse_node_contains(n, "BottomRight"))
              config_dock_floating = FALSE,
              config_dock_pos = OB_DIRECTION_SOUTHEAST;
 -        else if (parse_contains("Bottom", doc, n))
 +        else if (obt_parse_node_contains(n, "Bottom"))
              config_dock_floating = FALSE,
              config_dock_pos = OB_DIRECTION_SOUTH;
 -        else if (parse_contains("BottomLeft", doc, n))
 +        else if (obt_parse_node_contains(n, "BottomLeft"))
              config_dock_floating = FALSE,
              config_dock_pos = OB_DIRECTION_SOUTHWEST;
 -        else if (parse_contains("Left", doc, n))
 +        else if (obt_parse_node_contains(n, "Left"))
              config_dock_floating = FALSE,
              config_dock_pos = OB_DIRECTION_WEST;
 -        else if (parse_contains("Floating", doc, n))
 +        else if (obt_parse_node_contains(n, "Floating"))
              config_dock_floating = TRUE;
      }
      if (config_dock_floating) {
 -        if ((n = parse_find_node("floatingX", node)))
 -            config_dock_x = parse_int(doc, n);
 -        if ((n = parse_find_node("floatingY", node)))
 -            config_dock_y = parse_int(doc, n);
 +        if ((n = obt_parse_find_node(node, "floatingX")))
 +            config_dock_x = obt_parse_node_int(n);
 +        if ((n = obt_parse_find_node(node, "floatingY")))
 +            config_dock_y = obt_parse_node_int(n);
      } else {
 -        if ((n = parse_find_node("noStrut", node)))
 -            config_dock_nostrut = parse_bool(doc, n);
 +        if ((n = obt_parse_find_node(node, "noStrut")))
 +            config_dock_nostrut = obt_parse_node_bool(n);
      }
 -    if ((n = parse_find_node("stacking", node))) {
 -        if (parse_contains("above", doc, n))
 -            config_dock_layer = OB_STACKING_LAYER_ABOVE;
 -        else if (parse_contains("normal", doc, n))
 +    if ((n = obt_parse_find_node(node, "stacking"))) {
 +        if (obt_parse_node_contains(n, "normal"))
              config_dock_layer = OB_STACKING_LAYER_NORMAL;
 -        else if (parse_contains("below", doc, n))
 +        else if (obt_parse_node_contains(n, "below"))
              config_dock_layer = OB_STACKING_LAYER_BELOW;
 +        else if (obt_parse_node_contains(n, "above"))
 +            config_dock_layer = OB_STACKING_LAYER_ABOVE;
      }
 -    if ((n = parse_find_node("direction", node))) {
 -        if (parse_contains("horizontal", doc, n))
 +    if ((n = obt_parse_find_node(node, "direction"))) {
 +        if (obt_parse_node_contains(n, "horizontal"))
              config_dock_orient = OB_ORIENTATION_HORZ;
 -        else if (parse_contains("vertical", doc, n))
 +        else if (obt_parse_node_contains(n, "vertical"))
              config_dock_orient = OB_ORIENTATION_VERT;
      }
 -    if ((n = parse_find_node("autoHide", node)))
 -        config_dock_hide = parse_bool(doc, n);
 -    if ((n = parse_find_node("hideDelay", node)))
 -        config_dock_hide_delay = parse_int(doc, n);
 -    if ((n = parse_find_node("showDelay", node)))
 -        config_dock_show_delay = parse_int(doc, n);
 -    if ((n = parse_find_node("moveButton", node))) {
 -        gchar *str = parse_string(doc, n);
 +    if ((n = obt_parse_find_node(node, "autoHide")))
 +        config_dock_hide = obt_parse_node_bool(n);
 +    if ((n = obt_parse_find_node(node, "hideDelay")))
 +        config_dock_hide_delay = obt_parse_node_int(n);
 +    if ((n = obt_parse_find_node(node, "showDelay")))
 +        config_dock_show_delay = obt_parse_node_int(n);
 +    if ((n = obt_parse_find_node(node, "moveButton"))) {
 +        gchar *str = obt_parse_node_string(n);
          guint b, s;
          if (translate_button(str, &s, &b)) {
              config_dock_app_move_button = b;
              config_dock_app_move_modifiers = s;
          } else {
-             g_message(_("Invalid button '%s' specified in config file"), str);
+             g_message(_("Invalid button \"%s\" specified in config file"), str);
          }
          g_free(str);
      }
  }
  
 -static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                       gpointer data)
 +static void parse_menu(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
      for (node = node->children; node; node = node->next) {
          if (!xmlStrcasecmp(node->name, (const xmlChar*) "file")) {
              gchar *c;
  
 -            c = parse_string(doc, node);
 +            c = obt_parse_node_string(node);
              config_menu_files = g_slist_append(config_menu_files,
 -                                               parse_expand_tilde(c));
 +                                               obt_paths_expand_tilde(c));
              g_free(c);
          }
 -        if ((n = parse_find_node("hideDelay", node)))
 -            config_menu_hide_delay = parse_int(doc, n);
 -        if ((n = parse_find_node("middle", node)))
 -            config_menu_middle = parse_bool(doc, n);
 -        if ((n = parse_find_node("submenuShowDelay", node)))
 -            config_submenu_show_delay = parse_int(doc, n);
 -        if ((n = parse_find_node("applicationIcons", node)))
 -            config_menu_client_list_icons = parse_bool(doc, n);
 -        if ((n = parse_find_node("manageDesktops", node)))
 -            config_menu_manage_desktops = parse_bool(doc, n);
 +        if ((n = obt_parse_find_node(node, "hideDelay")))
 +            config_menu_hide_delay = obt_parse_node_int(n);
 +        if ((n = obt_parse_find_node(node, "middle")))
 +            config_menu_middle = obt_parse_node_bool(n);
 +        if ((n = obt_parse_find_node(node, "submenuShowDelay")))
 +            config_submenu_show_delay = obt_parse_node_int(n);
 +        if ((n = obt_parse_find_node(node, "applicationIcons")))
 +            config_menu_client_list_icons = obt_parse_node_bool(n);
 +        if ((n = obt_parse_find_node(node, "manageDesktops")))
 +            config_menu_manage_desktops = obt_parse_node_bool(n);
      }
  }
  
 -static void parse_resistance(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                             gpointer data)
 +static void parse_resistance(xmlNodePtr node, gpointer d)
  {
      xmlNodePtr n;
  
      node = node->children;
 -    if ((n = parse_find_node("strength", node)))
 -        config_resist_win = parse_int(doc, n);
 -    if ((n = parse_find_node("screen_edge_strength", node)))
 -        config_resist_edge = parse_int(doc, n);
 +    if ((n = obt_parse_find_node(node, "strength")))
 +        config_resist_win = obt_parse_node_int(n);
 +    if ((n = obt_parse_find_node(node, "screen_edge_strength")))
 +        config_resist_edge = obt_parse_node_int(n);
  }
  
  typedef struct
@@@ -894,7 -910,7 +894,7 @@@ static void bind_default_mouse(void
                     actions_parse_string(it->actname));
  }
  
 -void config_startup(ObParseInst *i)
 +void config_startup(ObtParseInst *i)
  {
      config_focus_new = TRUE;
      config_focus_follow = FALSE;
      config_focus_last = TRUE;
      config_focus_under_mouse = FALSE;
  
 -    parse_register(i, "focus", parse_focus, NULL);
 +    obt_parse_register(i, "focus", parse_focus, NULL);
  
      config_place_policy = OB_PLACE_POLICY_SMART;
      config_place_center = TRUE;
      config_place_monitor = OB_PLACE_MONITOR_ANY;
  
 -    parse_register(i, "placement", parse_placement, NULL);
 +    obt_parse_register(i, "placement", parse_placement, NULL);
  
      STRUT_PARTIAL_SET(config_margins, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  
 -    parse_register(i, "margins", parse_margins, NULL);
 +    obt_parse_register(i, "margins", parse_margins, NULL);
  
      config_theme = NULL;
  
      config_font_menuitem = NULL;
      config_font_menutitle = NULL;
  
 -    parse_register(i, "theme", parse_theme, NULL);
 +    obt_parse_register(i, "theme", parse_theme, NULL);
  
      config_desktops_num = 4;
      config_screen_firstdesk = 1;
      config_desktops_names = NULL;
      config_desktop_popup_time = 875;
  
 -    parse_register(i, "desktops", parse_desktops, NULL);
 +    obt_parse_register(i, "desktops", parse_desktops, NULL);
  
      config_resize_redraw = TRUE;
      config_resize_popup_show = 1; /* nonpixel increments */
      GRAVITY_COORD_SET(config_resize_popup_fixed.x, 0, FALSE, FALSE);
      GRAVITY_COORD_SET(config_resize_popup_fixed.y, 0, FALSE, FALSE);
  
 -    parse_register(i, "resize", parse_resize, NULL);
 +    obt_parse_register(i, "resize", parse_resize, NULL);
  
      config_dock_layer = OB_STACKING_LAYER_ABOVE;
      config_dock_pos = OB_DIRECTION_NORTHEAST;
      config_dock_app_move_button = 2; /* middle */
      config_dock_app_move_modifiers = 0;
  
 -    parse_register(i, "dock", parse_dock, NULL);
 +    obt_parse_register(i, "dock", parse_dock, NULL);
  
      translate_key("C-g", &config_keyboard_reset_state,
                    &config_keyboard_reset_keycode);
  
      bind_default_keyboard();
  
 -    parse_register(i, "keyboard", parse_keyboard, NULL);
 +    obt_parse_register(i, "keyboard", parse_keyboard, NULL);
  
      config_mouse_threshold = 8;
      config_mouse_dclicktime = 200;
  
      bind_default_mouse();
  
 -    parse_register(i, "mouse", parse_mouse, NULL);
 +    obt_parse_register(i, "mouse", parse_mouse, NULL);
  
      config_resist_win = 10;
      config_resist_edge = 20;
  
 -    parse_register(i, "resistance", parse_resistance, NULL);
 +    obt_parse_register(i, "resistance", parse_resistance, NULL);
  
      config_menu_hide_delay = 250;
      config_menu_middle = FALSE;
      config_menu_manage_desktops = TRUE;
      config_menu_files = NULL;
  
 -    parse_register(i, "menu", parse_menu, NULL);
 +    obt_parse_register(i, "menu", parse_menu, NULL);
  
      config_per_app_settings = NULL;
  
 -    parse_register(i, "applications", parse_per_app_settings, NULL);
 +    obt_parse_register(i, "applications", parse_per_app_settings, NULL);
  }
  
  void config_shutdown(void)
diff --combined openbox/menu.c
index 63b74b9520aae55962c5b17ee342022920d3f89b,0c10b757e5ce95b9ff0d56da0d8ca6961568c775..432aa2be9d5b849a6e309f8b402fddba44b8deeb
@@@ -20,6 -20,7 +20,6 @@@
  #include "debug.h"
  #include "menu.h"
  #include "openbox.h"
 -#include "mainloop.h"
  #include "stacking.h"
  #include "grab.h"
  #include "client.h"
@@@ -34,8 -35,7 +34,8 @@@
  #include "client_list_menu.h"
  #include "client_list_combined_menu.h"
  #include "gettext.h"
 -#include "parser/parse.h"
 +#include "obt/parse.h"
 +#include "obt/paths.h"
  
  typedef struct _ObMenuParseState ObMenuParseState;
  
@@@ -46,14 -46,18 +46,14 @@@ struct _ObMenuParseStat
  };
  
  static GHashTable *menu_hash = NULL;
 -static ObParseInst *menu_parse_inst;
 +static ObtParseInst *menu_parse_inst;
  static ObMenuParseState menu_parse_state;
  static gboolean menu_can_hide = FALSE;
  
  static void menu_destroy_hash_value(ObMenu *self);
 -static void parse_menu_item(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                            gpointer data);
 -static void parse_menu_separator(ObParseInst *i,
 -                                 xmlDocPtr doc, xmlNodePtr node,
 -                                 gpointer data);
 -static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                       gpointer data);
 +static void parse_menu_item(xmlNodePtr node, gpointer data);
 +static void parse_menu_separator(xmlNodePtr node, gpointer data);
 +static void parse_menu(xmlNodePtr node, gpointer data);
  static gunichar parse_shortcut(const gchar *label, gboolean allow_shortcut,
                                 gchar **strippedlabel, guint *position,
                                 gboolean *always_show);
@@@ -68,6 -72,8 +68,6 @@@ static void client_dest(ObClient *clien
  
  void menu_startup(gboolean reconfig)
  {
 -    xmlDocPtr doc;
 -    xmlNodePtr node;
      gboolean loaded = FALSE;
      GSList *it;
  
      client_list_combined_menu_startup(reconfig);
      client_menu_startup();
  
 -    menu_parse_inst = parse_startup();
 +    menu_parse_inst = obt_parse_instance_new();
  
      menu_parse_state.parent = NULL;
      menu_parse_state.pipe_creator = NULL;
 -    parse_register(menu_parse_inst, "menu", parse_menu, &menu_parse_state);
 -    parse_register(menu_parse_inst, "item", parse_menu_item,
 -                   &menu_parse_state);
 -    parse_register(menu_parse_inst, "separator",
 -                   parse_menu_separator, &menu_parse_state);
 +    obt_parse_register(menu_parse_inst, "menu", parse_menu, &menu_parse_state);
 +    obt_parse_register(menu_parse_inst, "item", parse_menu_item,
 +                       &menu_parse_state);
 +    obt_parse_register(menu_parse_inst, "separator",
 +                       parse_menu_separator, &menu_parse_state);
  
      for (it = config_menu_files; it; it = g_slist_next(it)) {
 -        if (parse_load_menu(it->data, &doc, &node)) {
 +        if (obt_parse_load_config_file(menu_parse_inst,
 +                                       "openbox",
 +                                       it->data,
 +                                       "openbox_menu"))
 +        {
              loaded = TRUE;
 -            parse_tree(menu_parse_inst, doc, node->children);
 -            xmlFreeDoc(doc);
 +            obt_parse_tree_from_root(menu_parse_inst);
 +            obt_parse_close(menu_parse_inst);
          } else
-             g_message(_("Unable to find a valid menu file '%s'"),
+             g_message(_("Unable to find a valid menu file \"%s\""),
                        (const gchar*)it->data);
      }
      if (!loaded) {
 -        if (parse_load_menu("menu.xml", &doc, &node)) {
 -            parse_tree(menu_parse_inst, doc, node->children);
 -            xmlFreeDoc(doc);
 +        if (obt_parse_load_config_file(menu_parse_inst,
 +                                       "openbox",
 +                                       "menu.xml",
 +                                       "openbox_menu"))
 +        {
 +            obt_parse_tree_from_root(menu_parse_inst);
 +            obt_parse_close(menu_parse_inst);
          } else
-             g_message(_("Unable to find a valid menu file '%s'"),
+             g_message(_("Unable to find a valid menu file \"%s\""),
                        "menu.xml");
      }
  
@@@ -125,7 -123,7 +125,7 @@@ void menu_shutdown(gboolean reconfig
      if (!reconfig)
          client_remove_destroy_notify(client_dest);
  
 -    parse_shutdown(menu_parse_inst);
 +    obt_parse_instance_unref(menu_parse_inst);
      menu_parse_inst = NULL;
  
      client_list_menu_shutdown(reconfig);
@@@ -159,6 -157,8 +159,6 @@@ void menu_clear_pipe_caches(void
  
  void menu_pipe_execute(ObMenu *self)
  {
 -    xmlDocPtr doc;
 -    xmlNodePtr node;
      gchar *output;
      GError *err = NULL;
  
          return;
  
      if (!g_spawn_command_line_sync(self->execute, &output, NULL, NULL, &err)) {
-         g_message(_("Failed to execute command for pipe-menu '%s': %s"),
+         g_message(_("Failed to execute command for pipe-menu \"%s\": %s"),
                    self->execute, err->message);
          g_error_free(err);
          return;
      }
  
 -    if (parse_load_mem(output, strlen(output),
 -                       "openbox_pipe_menu", &doc, &node))
 +    if (obt_parse_load_mem(menu_parse_inst, output, strlen(output),
 +                           "openbox_pipe_menu"))
      {
          menu_parse_state.pipe_creator = self;
          menu_parse_state.parent = self;
 -        parse_tree(menu_parse_inst, doc, node->children);
 -        xmlFreeDoc(doc);
 +        obt_parse_tree_from_root(menu_parse_inst);
 +        obt_parse_close(menu_parse_inst);
      } else {
-         g_message(_("Invalid output from pipe-menu '%s'"), self->execute);
+         g_message(_("Invalid output from pipe-menu \"%s\""), self->execute);
      }
  
      g_free(output);
@@@ -195,7 -195,7 +195,7 @@@ static ObMenu* menu_from_name(gchar *na
      g_assert(name != NULL);
  
      if (!(self = g_hash_table_lookup(menu_hash, name)))
-         g_message(_("Attempted to access menu '%s' but it does not exist"),
+         g_message(_("Attempted to access menu \"%s\" but it does not exist"),
                    name);
      return self;
  }
@@@ -263,18 -263,19 +263,18 @@@ static gunichar parse_shortcut(const gc
      return shortcut;
  }
  
 -static void parse_menu_item(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                            gpointer data)
 +static void parse_menu_item(xmlNodePtr node,  gpointer data)
  {
      ObMenuParseState *state = data;
      gchar *label;
  
      if (state->parent) {
 -        if (parse_attr_string("label", node, &label)) {
 +        if (obt_parse_attr_string(node, "label", &label)) {
              GSList *acts = NULL;
  
              for (node = node->children; node; node = node->next)
                  if (!xmlStrcasecmp(node->name, (const xmlChar*) "action")) {
 -                    ObActionsAct *a = actions_parse(i, doc, node);
 +                    ObActionsAct *a = actions_parse(node);
                      if (a)
                          acts = g_slist_append(acts, a);
                  }
      }
  }
  
 -static void parse_menu_separator(ObParseInst *i,
 -                                 xmlDocPtr doc, xmlNodePtr node,
 -                                 gpointer data)
 +static void parse_menu_separator(xmlNodePtr node, gpointer data)
  {
      ObMenuParseState *state = data;
  
      if (state->parent) {
          gchar *label;
  
 -        if (!parse_attr_string("label", node, &label))
 +        if (!obt_parse_attr_string(node, "label", &label))
              label = NULL;
  
          menu_add_separator(state->parent, -1, label);
      }
  }
  
 -static void parse_menu(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
 -                       gpointer data)
 +static void parse_menu(xmlNodePtr node, gpointer data)
  {
      ObMenuParseState *state = data;
      gchar *name = NULL, *title = NULL, *script = NULL;
      ObMenu *menu;
  
 -    if (!parse_attr_string("id", node, &name))
 +    if (!obt_parse_attr_string(node, "id", &name))
          goto parse_menu_fail;
  
      if (!g_hash_table_lookup(menu_hash, name)) {
 -        if (!parse_attr_string("label", node, &title))
 +        if (!obt_parse_attr_string(node, "label", &title))
              goto parse_menu_fail;
  
          if ((menu = menu_new(name, title, TRUE, NULL))) {
              menu->pipe_creator = state->pipe_creator;
 -            if (parse_attr_string("execute", node, &script)) {
 -                menu->execute = parse_expand_tilde(script);
 +            if (obt_parse_attr_string(node, "execute", &script)) {
 +                menu->execute = obt_paths_expand_tilde(script);
              } else {
                  ObMenu *old;
  
                  old = state->parent;
                  state->parent = menu;
 -                parse_tree(i, doc, node->children);
 +                obt_parse_tree(menu_parse_inst, node->children);
                  state->parent = old;
              }
          }
@@@ -453,10 -457,10 +453,10 @@@ void menu_show(gchar *name, gint x, gin
              menu_can_hide = TRUE;
          else {
              menu_can_hide = FALSE;
 -            ob_main_loop_timeout_add(ob_main_loop,
 -                                     config_menu_hide_delay * 1000,
 -                                     menu_hide_delay_func,
 -                                     NULL, g_direct_equal, NULL);
 +            obt_main_loop_timeout_add(ob_main_loop,
 +                                      config_menu_hide_delay * 1000,
 +                                      menu_hide_delay_func,
 +                                      NULL, g_direct_equal, NULL);
          }
      }
  }
diff --combined openbox/mouse.c
index 0233ac386da1d3c8045bd022c30c10246cd87880,857f6d09e61942b86127edf5e5d85c873fa1773e..b5d97336c90dc87d1ee3f9d18fa5bc09fc2d5134
  
  #include "openbox.h"
  #include "config.h"
 -#include "xerror.h"
  #include "actions.h"
  #include "event.h"
  #include "client.h"
 -#include "prop.h"
  #include "grab.h"
  #include "frame.h"
  #include "translate.h"
  #include "mouse.h"
  #include "gettext.h"
 +#include "obt/display.h"
  
  #include <glib.h>
  
@@@ -202,11 -203,11 +202,11 @@@ static gboolean fire_binding(ObMouseAct
      return TRUE;
  }
  
 -void mouse_replay_pointer()
 +void mouse_replay_pointer(void)
  {
      if (replay_pointer_needed) {
          /* replay the pointer event before any windows move */
 -        XAllowEvents(ob_display, ReplayPointer, event_curtime);
 +        XAllowEvents(obt_display, ReplayPointer, event_curtime);
          replay_pointer_needed = FALSE;
      }
  }
@@@ -286,10 -287,10 +286,10 @@@ void mouse_event(ObClient *client, XEve
              Window wjunk;
              guint ujunk, b, w, h;
              /* this can cause errors to occur when the window closes */
 -            xerror_set_ignore(TRUE);
 -            junk1 = XGetGeometry(ob_display, e->xbutton.window,
 +            obt_display_ignore_errors(TRUE);
 +            junk1 = XGetGeometry(obt_display, e->xbutton.window,
                                   &wjunk, &junk1, &junk2, &w, &h, &b, &ujunk);
 -            xerror_set_ignore(FALSE);
 +            obt_display_ignore_errors(FALSE);
              if (junk1) {
                  if (e->xbutton.x >= (signed)-b &&
                      e->xbutton.y >= (signed)-b &&
@@@ -375,13 -376,13 +375,13 @@@ gboolean mouse_bind(const gchar *button
      GSList *it;
  
      if (!translate_button(buttonstr, &state, &button)) {
-         g_message(_("Invalid button '%s' in mouse binding"), buttonstr);
+         g_message(_("Invalid button \"%s\" in mouse binding"), buttonstr);
          return FALSE;
      }
  
      context = frame_context_from_string(contextstr);
      if (!context) {
-         g_message(_("Invalid context '%s' in mouse binding"), contextstr);
+         g_message(_("Invalid context \"%s\" in mouse binding"), contextstr);
          return FALSE;
      }
  
diff --combined openbox/openbox.c
index 012666dc2668bd0170d33efcd1f7555842e1f2ba,6233ec98b5862394cb624b10312dae2a554f4f31..291b694b90328b574e4a6f5cd7cdfa7ac37482ae
  #include "openbox.h"
  #include "session.h"
  #include "dock.h"
 -#include "modkeys.h"
  #include "event.h"
  #include "menu.h"
  #include "client.h"
 -#include "xerror.h"
 -#include "prop.h"
  #include "screen.h"
  #include "actions.h"
  #include "startupnotify.h"
  #include "framerender.h"
  #include "keyboard.h"
  #include "mouse.h"
 -#include "extensions.h"
  #include "menuframe.h"
  #include "grab.h"
  #include "group.h"
  #include "config.h"
  #include "ping.h"
 -#include "mainloop.h"
  #include "prompt.h"
  #include "gettext.h"
 -#include "parser/parse.h"
  #include "render/render.h"
  #include "render/theme.h"
 +#include "obt/display.h"
 +#include "obt/prop.h"
 +#include "obt/keyboard.h"
 +#include "obt/parse.h"
  
  #ifdef HAVE_FCNTL_H
  #  include <fcntl.h>
  #include <X11/Xlib.h>
  #include <X11/keysym.h>
  
 -
  RrInstance   *ob_rr_inst;
  RrImageCache *ob_rr_icons;
  RrTheme      *ob_rr_theme;
 -ObMainLoop   *ob_main_loop;
 -Display      *ob_display;
 +ObtMainLoop  *ob_main_loop;
  gint          ob_screen;
  gboolean      ob_replace_wm = FALSE;
  gboolean      ob_sm_use = TRUE;
@@@ -119,8 -123,6 +119,8 @@@ gint main(gint argc, gchar **argv
  
      state = OB_STATE_STARTING;
  
 +    ob_debug_startup();
 +
      /* initialize the locale */
      if (!setlocale(LC_ALL, ""))
          g_message("Couldn't set locale from environment.");
      bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
      textdomain(PACKAGE_NAME);
  
+     if (chdir(g_get_home_dir()) == -1)
+         g_message(_("Unable to change to home directory \"%s\": %s"),
+                   g_get_home_dir(), g_strerror(errno));
      /* parse the command line args, which can change the argv[0] */
      parse_args(&argc, argv);
      /* parse the environment variables */
      program_name = g_path_get_basename(argv[0]);
      g_set_prgname(program_name);
  
 -    if (!remote_control) {
 -        parse_paths_startup();
 -
 +    if (!remote_control)
          session_startup(argc, argv);
 -    }
 -
  
 -    ob_display = XOpenDisplay(NULL);
 -    if (ob_display == NULL)
 +    if (!obt_display_open(NULL))
          ob_exit_with_error(_("Failed to open the display from the DISPLAY environment variable."));
 -    if (fcntl(ConnectionNumber(ob_display), F_SETFD, 1) == -1)
 -        ob_exit_with_error("Failed to set display as close-on-exec");
  
      if (remote_control) {
 -        prop_startup();
 -
          /* Send client message telling the OB process to:
           * remote_control = 1 -> reconfigure
           * remote_control = 2 -> restart */
 -        PROP_MSG(RootWindow(ob_display, ob_screen),
 -                 ob_control, remote_control, 0, 0, 0);
 -        XCloseDisplay(ob_display);
 +        OBT_PROP_MSG(ob_screen, obt_root(ob_screen),
 +                     OB_CONTROL, remote_control, 0, 0, 0, 0);
 +        obt_display_close();
          exit(EXIT_SUCCESS);
      }
  
 -    ob_main_loop = ob_main_loop_new(ob_display);
 +    ob_main_loop = obt_main_loop_new();
  
      /* set up signal handler */
 -    ob_main_loop_signal_add(ob_main_loop, SIGUSR1, signal_handler, NULL, NULL);
 -    ob_main_loop_signal_add(ob_main_loop, SIGUSR2, signal_handler, NULL, NULL);
 -    ob_main_loop_signal_add(ob_main_loop, SIGTERM, signal_handler, NULL, NULL);
 -    ob_main_loop_signal_add(ob_main_loop, SIGINT, signal_handler, NULL, NULL);
 -    ob_main_loop_signal_add(ob_main_loop, SIGHUP, signal_handler, NULL, NULL);
 -    ob_main_loop_signal_add(ob_main_loop, SIGPIPE, signal_handler, NULL, NULL);
 -    ob_main_loop_signal_add(ob_main_loop, SIGCHLD, signal_handler, NULL, NULL);
 +    obt_main_loop_signal_add(ob_main_loop, SIGUSR1, signal_handler, NULL,NULL);
 +    obt_main_loop_signal_add(ob_main_loop, SIGUSR2, signal_handler, NULL,NULL);
 +    obt_main_loop_signal_add(ob_main_loop, SIGTERM, signal_handler, NULL,NULL);
 +    obt_main_loop_signal_add(ob_main_loop, SIGINT, signal_handler,  NULL,NULL);
 +    obt_main_loop_signal_add(ob_main_loop, SIGHUP, signal_handler,  NULL,NULL);
 +    obt_main_loop_signal_add(ob_main_loop, SIGPIPE, signal_handler, NULL,NULL);
 +    obt_main_loop_signal_add(ob_main_loop, SIGCHLD, signal_handler, NULL,NULL);
  
 -    ob_screen = DefaultScreen(ob_display);
 +    ob_screen = DefaultScreen(obt_display);
  
 -    ob_rr_inst = RrInstanceNew(ob_display, ob_screen);
 +    ob_rr_inst = RrInstanceNew(obt_display, ob_screen);
      if (ob_rr_inst == NULL)
          ob_exit_with_error(_("Failed to initialize the obrender library."));
      /* Saving 3 resizes of an RrImage makes a lot of sense for icons, as there
      */
      ob_rr_icons = RrImageCacheNew(3);
  
 -    XSynchronize(ob_display, xsync);
 +    XSynchronize(obt_display, xsync);
  
      /* check for locale support */
      if (!XSupportsLocale())
      if (!XSetLocaleModifiers(""))
          g_message(_("Cannot set locale modifiers for the X server."));
  
 -    /* set our error handler */
 -    XSetErrorHandler(xerror_handler);
 -
      /* set the DISPLAY environment variable for any lauched children, to the
         display we're using, so they open in the right place. */
 -    setenv("DISPLAY", DisplayString(ob_display), TRUE);
 +    setenv("DISPLAY", DisplayString(obt_display), TRUE);
  
      /* create available cursors */
      cursors[OB_CURSOR_NONE] = None;
      cursors[OB_CURSOR_NORTHWEST] = load_cursor("top_left_corner",
                                                 XC_top_left_corner);
  
 -
 -    prop_startup(); /* get atoms values for the display */
 -    extensions_query_all(); /* find which extensions are present */
 -
      if (screen_annex()) { /* it will be ours! */
          do {
 -            modkeys_startup(reconfigure);
 +            if (reconfigure) obt_keyboard_reload();
  
              /* get the keycodes for keys we use */
 -            keys[OB_KEY_RETURN] = modkeys_sym_to_code(XK_Return);
 -            keys[OB_KEY_ESCAPE] = modkeys_sym_to_code(XK_Escape);
 -            keys[OB_KEY_LEFT] = modkeys_sym_to_code(XK_Left);
 -            keys[OB_KEY_RIGHT] = modkeys_sym_to_code(XK_Right);
 -            keys[OB_KEY_UP] = modkeys_sym_to_code(XK_Up);
 -            keys[OB_KEY_DOWN] = modkeys_sym_to_code(XK_Down);
 -            keys[OB_KEY_TAB] = modkeys_sym_to_code(XK_Tab);
 -            keys[OB_KEY_SPACE] = modkeys_sym_to_code(XK_space);
 +            keys[OB_KEY_RETURN] = obt_keyboard_keysym_to_keycode(XK_Return);
 +            keys[OB_KEY_ESCAPE] = obt_keyboard_keysym_to_keycode(XK_Escape);
 +            keys[OB_KEY_LEFT] = obt_keyboard_keysym_to_keycode(XK_Left);
 +            keys[OB_KEY_RIGHT] = obt_keyboard_keysym_to_keycode(XK_Right);
 +            keys[OB_KEY_UP] = obt_keyboard_keysym_to_keycode(XK_Up);
 +            keys[OB_KEY_DOWN] = obt_keyboard_keysym_to_keycode(XK_Down);
 +            keys[OB_KEY_TAB] = obt_keyboard_keysym_to_keycode(XK_Tab);
 +            keys[OB_KEY_SPACE] = obt_keyboard_keysym_to_keycode(XK_space);
  
              {
 -                ObParseInst *i;
 -                xmlDocPtr doc;
 -                xmlNodePtr node;
 +                ObtParseInst *i;
  
                  /* startup the parsing so everything can register sections
                     of the rc */
 -                i = parse_startup();
 +                i = obt_parse_instance_new();
  
                  /* register all the available actions */
                  actions_startup(reconfigure);
                  config_startup(i);
  
                  /* parse/load user options */
 -                if (parse_load_rc(config_file, &doc, &node)) {
 -                    parse_tree(i, doc, node->xmlChildrenNode);
 -                    parse_close(doc);
 +                if ((config_file &&
 +                     obt_parse_load_file(i, config_file, "openbox_config")) ||
 +                    obt_parse_load_config_file(i, "openbox", "rc.xml",
 +                                               "openbox_config"))
 +                {
 +                    obt_parse_tree_from_root(i);
 +                    obt_parse_close(i);
                  }
                  else {
                      g_message(_("Unable to find a valid config file, using some simple defaults"));
                      gchar *p = g_filename_to_utf8(config_file, -1,
                                                    NULL, NULL, NULL);
                      if (p)
 -                        PROP_SETS(RootWindow(ob_display, ob_screen),
 -                                  ob_config_file, p);
 +                        OBT_PROP_SETS(obt_root(ob_screen), OB_CONFIG_FILE,
 +                                      utf8, p);
                      g_free(p);
                  }
                  else
 -                    PROP_ERASE(RootWindow(ob_display, ob_screen),
 -                               ob_config_file);
 +                    OBT_PROP_ERASE(obt_root(ob_screen), OB_CONFIG_FILE);
  
                  /* we're done with parsing now, kill it */
 -                parse_shutdown(i);
 +                obt_parse_instance_unref(i);
              }
  
              /* load the theme specified in the rc file */
                  if (ob_rr_theme == NULL)
                      ob_exit_with_error(_("Unable to load a theme."));
  
 -                PROP_SETS(RootWindow(ob_display, ob_screen),
 -                          ob_theme, ob_rr_theme->name);
 +                OBT_PROP_SETS(obt_root(ob_screen),
 +                              OB_THEME, utf8, ob_rr_theme->name);
              }
  
              if (reconfigure) {
                  ObWindow *w;
  
                  /* get all the existing windows */
 -                client_manage_all();
 +                window_manage_all();
                  focus_nothing();
  
                  /* focus what was focused if a wm was already running */
 -                if (PROP_GET32(RootWindow(ob_display, ob_screen),
 -                               net_active_window, window, &xid) &&
 -                    (w = g_hash_table_lookup(window_map, &xid)) &&
 -                    WINDOW_IS_CLIENT(w))
 +                if (OBT_PROP_GET32(obt_root(ob_screen),
 +                                   NET_ACTIVE_WINDOW, WINDOW, &xid) &&
 +                    (w = window_find(xid)) && WINDOW_IS_CLIENT(w))
                  {
                      client_focus(WINDOW_AS_CLIENT(w));
                  }
              reconfigure = FALSE;
  
              state = OB_STATE_RUNNING;
 -            ob_main_loop_run(ob_main_loop);
 +            obt_main_loop_run(ob_main_loop);
              state = OB_STATE_EXITING;
  
 -            if (!reconfigure) {
 -                dock_remove_all();
 -                client_unmanage_all();
 -            }
 +            if (!reconfigure)
 +                window_unmanage_all();
  
              menu_shutdown(reconfigure);
              menu_frame_shutdown(reconfigure);
              event_shutdown(reconfigure);
              config_shutdown();
              actions_shutdown(reconfigure);
 -            modkeys_shutdown(reconfigure);
          } while (reconfigure);
      }
  
 -    XSync(ob_display, FALSE);
 +    XSync(obt_display, FALSE);
  
      RrThemeFree(ob_rr_theme);
      RrImageCacheUnref(ob_rr_icons);
  
      session_shutdown(being_replaced);
  
 -    XCloseDisplay(ob_display);
 -
 -    parse_paths_shutdown();
 +    obt_display_close();
  
      if (restart) {
          if (restart_path != NULL) {
                  g_strfreev(argvp);
              } else {
                  g_message(
-                     _("Restart failed to execute new executable '%s': %s"),
+                     _("Restart failed to execute new executable \"%s\": %s"),
                      restart_path, err->message);
                  g_error_free(err);
              }
      g_free(ob_sm_id);
      g_free(program_name);
  
 +    ob_debug_shutdown();
 +
      return exitcode;
  }
  
@@@ -449,11 -474,11 +453,11 @@@ static void signal_handler(gint signal
  {
      switch (signal) {
      case SIGUSR1:
 -        ob_debug("Caught signal %d. Restarting.\n", signal);
 +        ob_debug("Caught signal %d. Restarting.", signal);
          ob_restart();
          break;
      case SIGUSR2:
 -        ob_debug("Caught signal %d. Reconfiguring.\n", signal);
 +        ob_debug("Caught signal %d. Reconfiguring.", signal);
          ob_reconfigure();
          break;
      case SIGCHLD:
          while (waitpid(-1, NULL, WNOHANG) > 0);
          break;
      default:
 -        ob_debug("Caught signal %d. Exiting.\n", signal);
 +        ob_debug("Caught signal %d. Exiting.", signal);
          /* TERM and INT return a 0 code */
          ob_exit(!(signal == SIGTERM || signal == SIGINT));
      }
  }
  
 -static void print_version()
 +static void print_version(void)
  {
      g_print("Openbox %s\n", PACKAGE_VERSION);
      g_print(_("Copyright (c)"));
      g_print("under certain conditions. See the file COPYING for details.\n\n");
  }
  
 -static void print_help()
 +static void print_help(void)
  {
      g_print(_("Syntax: openbox [options]\n"));
      g_print(_("\nOptions:\n"));
      g_print(_("  --sync              Run in synchronous mode\n"));
      g_print(_("  --debug             Display debugging output\n"));
      g_print(_("  --debug-focus       Display debugging output for focus handling\n"));
 +    g_print(_("  --debug-session     Display debugging output for session managment\n"));
      g_print(_("  --debug-xinerama    Split the display into fake xinerama screens\n"));
      g_print(_("\nPlease report bugs at %s\n"), PACKAGE_BUGREPORT);
  }
@@@ -512,7 -536,7 +516,7 @@@ static void remove_args(gint *argc, gch
      *argc -= num;
  }
  
 -static void parse_env()
 +static void parse_env(void)
  {
      /* unset this so we don't pass it on unknowingly */
      unsetenv("DESKTOP_STARTUP_ID");
@@@ -543,19 -567,16 +547,19 @@@ static void parse_args(gint *argc, gcha
              xsync = TRUE;
          }
          else if (!strcmp(argv[i], "--debug")) {
 -            ob_debug_show_output(TRUE);
 -            ob_debug_enable(OB_DEBUG_SM, TRUE);
 +            ob_debug_enable(OB_DEBUG_NORMAL, TRUE);
              ob_debug_enable(OB_DEBUG_APP_BUGS, TRUE);
          }
          else if (!strcmp(argv[i], "--debug-focus")) {
 -            ob_debug_show_output(TRUE);
 -            ob_debug_enable(OB_DEBUG_SM, TRUE);
 +            ob_debug_enable(OB_DEBUG_NORMAL, TRUE);
              ob_debug_enable(OB_DEBUG_APP_BUGS, TRUE);
              ob_debug_enable(OB_DEBUG_FOCUS, TRUE);
          }
 +        else if (!strcmp(argv[i], "--debug-session")) {
 +            ob_debug_enable(OB_DEBUG_NORMAL, TRUE);
 +            ob_debug_enable(OB_DEBUG_APP_BUGS, TRUE);
 +            ob_debug_enable(OB_DEBUG_SM, TRUE);
 +        }
          else if (!strcmp(argv[i], "--debug-xinerama")) {
              ob_debug_xinerama = TRUE;
          }
                  ob_sm_save_file = g_strdup(argv[i+1]);
                  remove_args(argc, argv, i, 2);
                  --i; /* this arg was removed so go back */
 -                ob_debug_type(OB_DEBUG_SM, "--sm-save-file %s\n",
 +                ob_debug_type(OB_DEBUG_SM, "--sm-save-file %s",
                                ob_sm_save_file);
              }
          }
                  ob_sm_id = g_strdup(argv[i+1]);
                  remove_args(argc, argv, i, 2);
                  --i; /* this arg was removed so go back */
 -                ob_debug_type(OB_DEBUG_SM, "--sm-client-id %s\n", ob_sm_id);
 +                ob_debug_type(OB_DEBUG_SM, "--sm-client-id %s", ob_sm_id);
              }
          }
          else if (!strcmp(argv[i], "--sm-disable")) {
          else {
              /* this is a memleak.. oh well.. heh */
              gchar *err = g_strdup_printf
-                 (_("Invalid command line argument '%s'\n"), argv[i]);
+                 (_("Invalid command line argument \"%s\"\n"), argv[i]);
              ob_exit_with_error(err);
          }
      }
@@@ -624,10 -645,10 +628,10 @@@ static Cursor load_cursor(const gchar *
      Cursor c = None;
  
  #if USE_XCURSOR
 -    c = XcursorLibraryLoadCursor(ob_display, name);
 +    c = XcursorLibraryLoadCursor(obt_display, name);
  #endif
      if (c == None)
 -        c = XCreateFontCursor(ob_display, fontval);
 +        c = XCreateFontCursor(obt_display, fontval);
      return c;
  }
  
@@@ -644,13 -665,13 +648,13 @@@ void ob_restart_other(const gchar *path
      ob_restart();
  }
  
 -void ob_restart()
 +void ob_restart(void)
  {
      restart = TRUE;
      ob_exit(0);
  }
  
 -void ob_reconfigure()
 +void ob_reconfigure(void)
  {
      reconfigure = TRUE;
      ob_exit(0);
  void ob_exit(gint code)
  {
      exitcode = code;
 -    ob_main_loop_exit(ob_main_loop);
 +    obt_main_loop_exit(ob_main_loop);
  }
  
 -void ob_exit_replace()
 +void ob_exit_replace(void)
  {
      exitcode = 0;
      being_replaced = TRUE;
 -    ob_main_loop_exit(ob_main_loop);
 +    obt_main_loop_exit(ob_main_loop);
  }
  
  Cursor ob_cursor(ObCursor cursor)
@@@ -681,7 -702,7 +685,7 @@@ KeyCode ob_keycode(ObKey key
      return keys[key];
  }
  
 -ObState ob_state()
 +ObState ob_state(void)
  {
      return state;
  }
diff --combined openbox/session.c
index 3822d41483b688662cb9b445a657ac83fc016710,0f74ec28bdcda79ea67dc62cdac017e2fec2513e..99d66221ce4a7f3e5993642c223884716e6a4472
@@@ -38,10 -38,10 +38,10 @@@ GList* session_state_find(struct _ObCli
  #include "debug.h"
  #include "openbox.h"
  #include "client.h"
 -#include "prop.h"
  #include "focus.h"
  #include "gettext.h"
 -#include "parser/parse.h"
 +#include "obt/parse.h"
 +#include "obt/paths.h"
  
  #include <time.h>
  #include <errno.h>
@@@ -91,26 -91,22 +91,26 @@@ static void session_state_free(ObSessio
  void session_startup(gint argc, gchar **argv)
  {
      gchar *dir;
 +    ObtPaths *p;
  
      if (!ob_sm_use) return;
  
      sm_argc = argc;
      sm_argv = argv;
  
 -    dir = g_build_filename(parse_xdg_data_home_path(),
 +    p = obt_paths_new();
 +    dir = g_build_filename(obt_paths_cache_home(p),
                             "openbox", "sessions", NULL);
 -    if (!parse_mkdir_path(dir, 0700)) {
 +    obt_paths_unref(p), p = NULL;
 +
 +    if (!obt_paths_mkdir_path(dir, 0700)) {
-         g_message(_("Unable to make directory '%s': %s"),
+         g_message(_("Unable to make directory \"%s\": %s"),
                    dir, g_strerror(errno));
      }
  
      if (ob_sm_save_file != NULL) {
          if (ob_sm_restore) {
 -            ob_debug_type(OB_DEBUG_SM, "Loading from session file %s\n",
 +            ob_debug_type(OB_DEBUG_SM, "Loading from session file %s",
                            ob_sm_save_file);
              session_load_file(ob_sm_save_file);
          }
@@@ -159,7 -155,7 +159,7 @@@ void session_shutdown(gboolean permanen
  }
  
  /*! Connect to the session manager and set up our callback functions */
 -static gboolean session_connect()
 +static gboolean session_connect(void)
  {
      SmcCallbacks cb;
      gchar *oldid;
  
      /* connect to the server */
      oldid = ob_sm_id;
 -    ob_debug_type(OB_DEBUG_SM, "Connecting to SM with id: %s\n",
 +    ob_debug_type(OB_DEBUG_SM, "Connecting to SM with id: %s",
                    oldid ? oldid : "(null)");
      sm_conn = SmcOpenConnection(NULL, NULL, 1, 0,
                                  SmcSaveYourselfProcMask |
                                  &cb, oldid, &ob_sm_id,
                                  SM_ERR_LEN-1, sm_err);
      g_free(oldid);
 -    ob_debug_type(OB_DEBUG_SM, "Connected to SM with id: %s\n", ob_sm_id);
 +    ob_debug_type(OB_DEBUG_SM, "Connected to SM with id: %s", ob_sm_id);
      if (sm_conn == NULL)
 -        ob_debug("Failed to connect to session manager: %s\n", sm_err);
 +        ob_debug("Failed to connect to session manager: %s", sm_err);
      return sm_conn != NULL;
  }
  
 -static void session_setup_program()
 +static void session_setup_program(void)
  {
      SmPropValue vals = {
          .value = sm_argv[0],
          .vals = &vals
      };
      SmProp *list = &prop;
 -    ob_debug_type(OB_DEBUG_SM, "Setting program: %s\n", sm_argv[0]);
 +    ob_debug_type(OB_DEBUG_SM, "Setting program: %s", sm_argv[0]);
      SmcSetProperties(sm_conn, 1, &list);
      g_free(prop.name);
      g_free(prop.type);
  }
  
 -static void session_setup_user()
 +static void session_setup_user(void)
  {
      char *user = g_strdup(g_get_user_name());
  
          .vals = &vals
      };
      SmProp *list = &prop;
 -    ob_debug_type(OB_DEBUG_SM, "Setting user: %s\n", user);
 +    ob_debug_type(OB_DEBUG_SM, "Setting user: %s", user);
      SmcSetProperties(sm_conn, 1, &list);
      g_free(prop.name);
      g_free(prop.type);
@@@ -249,13 -245,13 +249,13 @@@ static void session_setup_restart_style
          .vals = &vals
      };
      SmProp *list = &prop;
 -    ob_debug_type(OB_DEBUG_SM, "Setting restart: %d\n", restart);
 +    ob_debug_type(OB_DEBUG_SM, "Setting restart: %d", restart);
      SmcSetProperties(sm_conn, 1, &list);
      g_free(prop.name);
      g_free(prop.type);
  }
  
 -static void session_setup_pid()
 +static void session_setup_pid(void)
  {
      gchar *pid = g_strdup_printf("%ld", (glong) getpid());
  
          .vals = &vals
      };
      SmProp *list = &prop;
 -    ob_debug_type(OB_DEBUG_SM, "Setting pid: %s\n", pid);
 +    ob_debug_type(OB_DEBUG_SM, "Setting pid: %s", pid);
      SmcSetProperties(sm_conn, 1, &list);
      g_free(prop.name);
      g_free(prop.type);
  }
  
  /*! This is a gnome-session-manager extension */
 -static void session_setup_priority()
 +static void session_setup_priority(void)
  {
      gchar priority = 20; /* 20 is a lower prioity to run before other apps */
  
          .vals = &vals
      };
      SmProp *list = &prop;
 -    ob_debug_type(OB_DEBUG_SM, "Setting priority: %d\n", priority);
 +    ob_debug_type(OB_DEBUG_SM, "Setting priority: %d", priority);
      SmcSetProperties(sm_conn, 1, &list);
      g_free(prop.name);
      g_free(prop.type);
  }
  
 -static void session_setup_clone_command()
 +static void session_setup_clone_command(void)
  {
      gint i;
  
      };
      SmProp *list = &prop;
  
 -    ob_debug_type(OB_DEBUG_SM, "Setting clone command: (%d)\n", sm_argc);
 +    ob_debug_type(OB_DEBUG_SM, "Setting clone command: (%d)", sm_argc);
      for (i = 0; i < sm_argc; ++i) {
          vals[i].value = sm_argv[i];
          vals[i].length = strlen(sm_argv[i]) + 1;
 -        ob_debug_type(OB_DEBUG_SM, "    %s\n", vals[i].value);
 +        ob_debug_type(OB_DEBUG_SM, "    %s", vals[i].value);
      }
  
      SmcSetProperties(sm_conn, 1, &list);
      g_free(vals);
  }
  
 -static void session_setup_restart_command()
 +static void session_setup_restart_command(void)
  {
      gint i;
  
      };
      SmProp *list = &prop;
  
 -    ob_debug_type(OB_DEBUG_SM, "Setting restart command: (%d)\n", sm_argc+4);
 +    ob_debug_type(OB_DEBUG_SM, "Setting restart command: (%d)", sm_argc+4);
      for (i = 0; i < sm_argc; ++i) {
          vals[i].value = sm_argv[i];
          vals[i].length = strlen(sm_argv[i]) + 1;
 -        ob_debug_type(OB_DEBUG_SM, "    %s\n", vals[i].value);
 +        ob_debug_type(OB_DEBUG_SM, "    %s", vals[i].value);
      }
  
      vals[i].value = g_strdup("--sm-client-id");
      vals[i].length = strlen("--sm-client-id") + 1;
      vals[i+1].value = ob_sm_id;
      vals[i+1].length = strlen(ob_sm_id) + 1;
 -    ob_debug_type(OB_DEBUG_SM, "    %s\n", vals[i].value);
 -    ob_debug_type(OB_DEBUG_SM, "    %s\n", vals[i+1].value);
 +    ob_debug_type(OB_DEBUG_SM, "    %s", vals[i].value);
 +    ob_debug_type(OB_DEBUG_SM, "    %s", vals[i+1].value);
  
      vals[i+2].value = g_strdup("--sm-save-file");
      vals[i+2].length = strlen("--sm-save-file") + 1;
      vals[i+3].value = ob_sm_save_file;
      vals[i+3].length = strlen(ob_sm_save_file) + 1;
 -    ob_debug_type(OB_DEBUG_SM, "    %s\n", vals[i+2].value);
 -    ob_debug_type(OB_DEBUG_SM, "    %s\n", vals[i+3].value);
 +    ob_debug_type(OB_DEBUG_SM, "    %s", vals[i+2].value);
 +    ob_debug_type(OB_DEBUG_SM, "    %s", vals[i+3].value);
  
      SmcSetProperties(sm_conn, 1, &list);
      g_free(prop.name);
      g_free(vals);
  }
  
 -static ObSMSaveData *sm_save_get_data()
 +static ObSMSaveData *sm_save_get_data(void)
  {
      ObSMSaveData *savedata = g_new0(ObSMSaveData, 1);
      /* save the active desktop and client.
@@@ -385,9 -381,9 +385,9 @@@ static void sm_save_yourself_2(SmcConn 
      ObSMSaveData *savedata = data;
  
      /* save the current state */
 -    ob_debug_type(OB_DEBUG_SM, "Session save phase 2 requested\n");
 +    ob_debug_type(OB_DEBUG_SM, "Session save phase 2 requested");
      ob_debug_type(OB_DEBUG_SM,
 -                  "  Saving session to file '%s'\n", ob_sm_save_file);
 +                  "  Saving session to file '%s'", ob_sm_save_file);
      if (savedata == NULL)
          savedata = sm_save_get_data();
      success = session_save_to_file(savedata);
      /* tell the session manager how to restore this state */
      if (success) session_setup_restart_command();
  
 -    ob_debug_type(OB_DEBUG_SM, "Saving is done (success = %d)\n", success);
 +    ob_debug_type(OB_DEBUG_SM, "Saving is done (success = %d)", success);
      SmcSaveYourselfDone(conn, success);
  }
  
@@@ -407,10 -403,10 +407,10 @@@ static void sm_save_yourself(SmcConn co
      ObSMSaveData *savedata = NULL;
      gchar *vendor;
  
 -    ob_debug_type(OB_DEBUG_SM, "Session save requested\n");
 +    ob_debug_type(OB_DEBUG_SM, "Session save requested");
  
      vendor = SmcVendor(sm_conn);
 -    ob_debug_type(OB_DEBUG_SM, "Session manager's vendor: %s\n", vendor);
 +    ob_debug_type(OB_DEBUG_SM, "Session manager's vendor: %s", vendor);
  
      if (!strcmp(vendor, "KDE")) {
          /* ksmserver guarantees that phase 1 will complete before allowing any
      free(vendor);
  
      if (!SmcRequestSaveYourselfPhase2(conn, sm_save_yourself_2, savedata)) {
 -        ob_debug_type(OB_DEBUG_SM, "Requst for phase 2 failed\n");
 +        ob_debug_type(OB_DEBUG_SM, "Requst for phase 2 failed");
          g_free(savedata);
          SmcSaveYourselfDone(conn, FALSE);
      }
  
  static void sm_die(SmcConn conn, SmPointer data)
  {
 -    ob_debug_type(OB_DEBUG_SM, "Die requested\n");
 +    ob_debug_type(OB_DEBUG_SM, "Die requested");
      ob_exit(0);
  }
  
  static void sm_save_complete(SmcConn conn, SmPointer data)
  {
 -    ob_debug_type(OB_DEBUG_SM, "Save complete\n");
 +    ob_debug_type(OB_DEBUG_SM, "Save complete");
  }
  
  static void sm_shutdown_cancelled(SmcConn conn, SmPointer data)
  {
 -    ob_debug_type(OB_DEBUG_SM, "Shutdown cancelled\n");
 +    ob_debug_type(OB_DEBUG_SM, "Shutdown cancelled");
  }
  
  static gboolean session_save_to_file(const ObSMSaveData *savedata)
      f = fopen(ob_sm_save_file, "w");
      if (!f) {
          success = FALSE;
-         g_message(_("Unable to save the session to '%s': %s"),
+         g_message(_("Unable to save the session to \"%s\": %s"),
                    ob_sm_save_file, g_strerror(errno));
      } else {
          fprintf(f, "<?xml version=\"1.0\"?>\n\n");
  
              if (!c->sm_client_id) {
                  ob_debug_type(OB_DEBUG_SM, "Client %s does not have a "
 -                              "session id set\n",
 +                              "session id set",
                                c->title);
                  if (!c->wm_command) {
                      ob_debug_type(OB_DEBUG_SM, "Client %s does not have an "
                                    "oldskool wm_command set either. We won't "
 -                                  "be saving its data\n",
 +                                  "be saving its data",
                                    c->title);
                      continue;
                  }
              }
  
 -            ob_debug_type(OB_DEBUG_SM, "Saving state for client %s\n",
 +            ob_debug_type(OB_DEBUG_SM, "Saving state for client %s",
                            c->title);
  
              prex = c->area.x;
  
          if (fflush(f)) {
              success = FALSE;
-             g_message(_("Error while saving the session to '%s': %s"),
+             g_message(_("Error while saving the session to \"%s\": %s"),
                        ob_sm_save_file, g_strerror(errno));
          }
          fclose(f);
@@@ -608,20 -604,20 +608,20 @@@ static void session_state_free(ObSessio
  
  static gboolean session_state_cmp(ObSessionState *s, ObClient *c)
  {
 -    ob_debug_type(OB_DEBUG_SM, "Comparing client against saved state: \n");
 -    ob_debug_type(OB_DEBUG_SM, "  client id: %s \n", c->sm_client_id);
 -    ob_debug_type(OB_DEBUG_SM, "  client name: %s \n", c->name);
 -    ob_debug_type(OB_DEBUG_SM, "  client class: %s \n", c->class);
 -    ob_debug_type(OB_DEBUG_SM, "  client role: %s \n", c->role);
 -    ob_debug_type(OB_DEBUG_SM, "  client type: %d \n", c->type);
 -    ob_debug_type(OB_DEBUG_SM, "  client command: %s \n",
 +    ob_debug_type(OB_DEBUG_SM, "Comparing client against saved state: ");
 +    ob_debug_type(OB_DEBUG_SM, "  client id: %s ", c->sm_client_id);
 +    ob_debug_type(OB_DEBUG_SM, "  client name: %s ", c->name);
 +    ob_debug_type(OB_DEBUG_SM, "  client class: %s ", c->class);
 +    ob_debug_type(OB_DEBUG_SM, "  client role: %s ", c->role);
 +    ob_debug_type(OB_DEBUG_SM, "  client type: %d ", c->type);
 +    ob_debug_type(OB_DEBUG_SM, "  client command: %s ",
                    c->wm_command ? c->wm_command : "(null)");
 -    ob_debug_type(OB_DEBUG_SM, "  state id: %s \n", s->id);
 -    ob_debug_type(OB_DEBUG_SM, "  state name: %s \n", s->name);
 -    ob_debug_type(OB_DEBUG_SM, "  state class: %s \n", s->class);
 -    ob_debug_type(OB_DEBUG_SM, "  state role: %s \n", s->role);
 -    ob_debug_type(OB_DEBUG_SM, "  state type: %d \n", s->type);
 -    ob_debug_type(OB_DEBUG_SM, "  state command: %s \n",
 +    ob_debug_type(OB_DEBUG_SM, "  state id: %s ", s->id);
 +    ob_debug_type(OB_DEBUG_SM, "  state name: %s ", s->name);
 +    ob_debug_type(OB_DEBUG_SM, "  state class: %s ", s->class);
 +    ob_debug_type(OB_DEBUG_SM, "  state role: %s ", s->role);
 +    ob_debug_type(OB_DEBUG_SM, "  state type: %d ", s->type);
 +    ob_debug_type(OB_DEBUG_SM, "  state command: %s ",
                    s->command ? s->command : "(null)");
  
      if ((c->sm_client_id && s->id && !strcmp(c->sm_client_id, s->id)) ||
@@@ -656,106 -652,101 +656,106 @@@ GList* session_state_find(ObClient *c
  
  static void session_load_file(const gchar *path)
  {
 -    xmlDocPtr doc;
 +    ObtParseInst *i;
      xmlNodePtr node, n, m;
      GList *it, *inext;
  
 -    if (!parse_load(path, "openbox_session", &doc, &node))
 +    i = obt_parse_instance_new();
 +
 +    if (!obt_parse_load_file(i, path, "openbox_session")) {
 +        obt_parse_instance_unref(i);
          return;
 +    }
 +    node = obt_parse_root(i);
  
 -    if ((n = parse_find_node("desktop", node->children)))
 -        session_desktop = parse_int(doc, n);
 +    if ((n = obt_parse_find_node(node->children, "desktop")))
 +        session_desktop = obt_parse_node_int(n);
  
 -    if ((n = parse_find_node("numdesktops", node->children)))
 -        session_num_desktops = parse_int(doc, n);
 +    if ((n = obt_parse_find_node(node->children, "numdesktops")))
 +        session_num_desktops = obt_parse_node_int(n);
  
 -    if ((n = parse_find_node("desktoplayout", node->children))) {
 +    if ((n = obt_parse_find_node(node->children, "desktoplayout"))) {
          /* make sure they are all there for it to be valid */
 -        if ((m = parse_find_node("orientation", n->children)))
 -            session_desktop_layout.orientation = parse_int(doc, m);
 -        if (m && (m = parse_find_node("startcorner", n->children)))
 -            session_desktop_layout.start_corner = parse_int(doc, m);
 -        if (m && (m = parse_find_node("columns", n->children)))
 -            session_desktop_layout.columns = parse_int(doc, m);
 -        if (m && (m = parse_find_node("rows", n->children)))
 -            session_desktop_layout.rows = parse_int(doc, m);
 +        if ((m = obt_parse_find_node(n->children, "orientation")))
 +            session_desktop_layout.orientation = obt_parse_node_int(m);
 +        if (m && (m = obt_parse_find_node(n->children, "startcorner")))
 +            session_desktop_layout.start_corner = obt_parse_node_int(m);
 +        if (m && (m = obt_parse_find_node(n->children, "columns")))
 +            session_desktop_layout.columns = obt_parse_node_int(m);
 +        if (m && (m = obt_parse_find_node(n->children, "rows")))
 +            session_desktop_layout.rows = obt_parse_node_int(m);
          session_desktop_layout_present = m != NULL;
      }
  
 -    if ((n = parse_find_node("desktopnames", node->children))) {
 -        for (m = parse_find_node("name", n->children); m;
 -             m = parse_find_node("name", m->next))
 +    if ((n = obt_parse_find_node(node->children, "desktopnames"))) {
 +        for (m = obt_parse_find_node(n->children, "name"); m;
 +             m = obt_parse_find_node(m->next, "name"))
          {
              session_desktop_names = g_slist_append(session_desktop_names,
 -                                                   parse_string(doc, m));
 +                                                   obt_parse_node_string(m));
          }
      }
  
 -    for (node = parse_find_node("window", node->children); node != NULL;
 -         node = parse_find_node("window", node->next))
 +    for (node = obt_parse_find_node(node->children, "window"); node != NULL;
 +         node = obt_parse_find_node(node->next, "window"))
      {
          ObSessionState *state;
  
          state = g_new0(ObSessionState, 1);
  
 -        if (!parse_attr_string("id", node, &state->id))
 -            if (!parse_attr_string("command", node, &state->command))
 +        if (!obt_parse_attr_string(node, "id", &state->id))
 +            if (!obt_parse_attr_string(node, "command", &state->command))
              goto session_load_bail;
 -        if (!(n = parse_find_node("name", node->children)))
 +        if (!(n = obt_parse_find_node(node->children, "name")))
              goto session_load_bail;
 -        state->name = parse_string(doc, n);
 -        if (!(n = parse_find_node("class", node->children)))
 +        state->name = obt_parse_node_string(n);
 +        if (!(n = obt_parse_find_node(node->children, "class")))
              goto session_load_bail;
 -        state->class = parse_string(doc, n);
 -        if (!(n = parse_find_node("role", node->children)))
 +        state->class = obt_parse_node_string(n);
 +        if (!(n = obt_parse_find_node(node->children, "role")))
              goto session_load_bail;
 -        state->role = parse_string(doc, n);
 -        if (!(n = parse_find_node("windowtype", node->children)))
 +        state->role = obt_parse_node_string(n);
 +        if (!(n = obt_parse_find_node(node->children, "windowtype")))
              goto session_load_bail;
 -        state->type = parse_int(doc, n);
 -        if (!(n = parse_find_node("desktop", node->children)))
 +        state->type = obt_parse_node_int(n);
 +        if (!(n = obt_parse_find_node(node->children, "desktop")))
              goto session_load_bail;
 -        state->desktop = parse_int(doc, n);
 -        if (!(n = parse_find_node("x", node->children)))
 +        state->desktop = obt_parse_node_int(n);
 +        if (!(n = obt_parse_find_node(node->children, "x")))
              goto session_load_bail;
 -        state->x = parse_int(doc, n);
 -        if (!(n = parse_find_node("y", node->children)))
 +        state->x = obt_parse_node_int(n);
 +        if (!(n = obt_parse_find_node(node->children, "y")))
              goto session_load_bail;
 -        state->y = parse_int(doc, n);
 -        if (!(n = parse_find_node("width", node->children)))
 +        state->y = obt_parse_node_int(n);
 +        if (!(n = obt_parse_find_node(node->children, "width")))
              goto session_load_bail;
 -        state->w = parse_int(doc, n);
 -        if (!(n = parse_find_node("height", node->children)))
 +        state->w = obt_parse_node_int(n);
 +        if (!(n = obt_parse_find_node(node->children, "height")))
              goto session_load_bail;
 -        state->h = parse_int(doc, n);
 +        state->h = obt_parse_node_int(n);
  
          state->shaded =
 -            parse_find_node("shaded", node->children) != NULL;
 +            obt_parse_find_node(node->children, "shaded") != NULL;
          state->iconic =
 -            parse_find_node("iconic", node->children) != NULL;
 +            obt_parse_find_node(node->children, "iconic") != NULL;
          state->skip_pager =
 -            parse_find_node("skip_pager", node->children) != NULL;
 +            obt_parse_find_node(node->children, "skip_pager") != NULL;
          state->skip_taskbar =
 -            parse_find_node("skip_taskbar", node->children) != NULL;
 +            obt_parse_find_node(node->children, "skip_taskbar") != NULL;
          state->fullscreen =
 -            parse_find_node("fullscreen", node->children) != NULL;
 +            obt_parse_find_node(node->children, "fullscreen") != NULL;
          state->above =
 -            parse_find_node("above", node->children) != NULL;
 +            obt_parse_find_node(node->children, "above") != NULL;
          state->below =
 -            parse_find_node("below", node->children) != NULL;
 +            obt_parse_find_node(node->children, "below") != NULL;
          state->max_horz =
 -            parse_find_node("max_horz", node->children) != NULL;
 +            obt_parse_find_node(node->children, "max_horz") != NULL;
          state->max_vert =
 -            parse_find_node("max_vert", node->children) != NULL;
 +            obt_parse_find_node(node->children, "max_vert") != NULL;
          state->undecorated =
 -            parse_find_node("undecorated", node->children) != NULL;
 +            obt_parse_find_node(node->children, "undecorated") != NULL;
          state->focused =
 -            parse_find_node("focused", node->children) != NULL;
 +            obt_parse_find_node(node->children, "focused") != NULL;
  
          /* save this. they are in the file in stacking order, so preserve
             that order here */
          }
      }
  
 -    xmlFreeDoc(doc);
 +    obt_parse_instance_unref(i);
  }
  
  #endif
diff --combined openbox/translate.c
index 7e89e32cf0cc03de34d383ce2fef6a0d0c6b961f,bd8b88f69922112e0008bf022b2d48437bbab6ca..50d500082ce098757b795972700f6f4abebf4279
@@@ -19,9 -19,9 +19,9 @@@
  
  #include "openbox.h"
  #include "mouse.h"
 -#include "modkeys.h"
 -#include "translate.h"
  #include "gettext.h"
 +#include "obt/keyboard.h"
 +
  #include <glib.h>
  #include <string.h>
  #include <stdlib.h>
@@@ -38,25 -38,25 +38,25 @@@ static guint translate_modifier(gchar *
  
      else if (!g_ascii_strcasecmp("Control", str) ||
               !g_ascii_strcasecmp("C", str))
 -        mask = modkeys_key_to_mask(OB_MODKEY_KEY_CONTROL);
 +        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_CONTROL);
      else if (!g_ascii_strcasecmp("Alt", str) ||
               !g_ascii_strcasecmp("A", str))
 -        mask = modkeys_key_to_mask(OB_MODKEY_KEY_ALT);
 +        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_ALT);
      else if (!g_ascii_strcasecmp("Meta", str) ||
               !g_ascii_strcasecmp("M", str))
 -        mask = modkeys_key_to_mask(OB_MODKEY_KEY_META);
 +        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_META);
      /* W = windows key, is linked to the Super_L/R buttons */
      else if (!g_ascii_strcasecmp("Super", str) ||
               !g_ascii_strcasecmp("W", str))
 -        mask = modkeys_key_to_mask(OB_MODKEY_KEY_SUPER);
 +        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_SUPER);
      else if (!g_ascii_strcasecmp("Shift", str) ||
               !g_ascii_strcasecmp("S", str))
 -        mask = modkeys_key_to_mask(OB_MODKEY_KEY_SHIFT);
 +        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_SHIFT);
      else if (!g_ascii_strcasecmp("Hyper", str) ||
               !g_ascii_strcasecmp("H", str))
 -        mask = modkeys_key_to_mask(OB_MODKEY_KEY_HYPER);
 +        mask = obt_keyboard_modkey_to_modmask(OBT_KEYBOARD_MODKEY_HYPER);
      else
-         g_message(_("Invalid modifier key '%s' in key/mouse binding"), str);
+         g_message(_("Invalid modifier key \"%s\" in key/mouse binding"), str);
  
      return mask;
  }
@@@ -135,20 -135,20 +135,20 @@@ gboolean translate_key(const gchar *str
          /* take it directly */
          *keycode = strtol(l, &end, 16);
          if (*l == '\0' || *end != '\0') {
-             g_message(_("Invalid key code '%s' in key binding"), l);
+             g_message(_("Invalid key code \"%s\" in key binding"), l);
              goto translation_fail;
          }
      } else {
          /* figure out the keycode */
          sym = XStringToKeysym(l);
          if (sym == NoSymbol) {
-             g_message(_("Invalid key name '%s' in key binding"), l);
+             g_message(_("Invalid key name \"%s\" in key binding"), l);
              goto translation_fail;
          }
 -        *keycode = XKeysymToKeycode(ob_display, sym);
 +        *keycode = XKeysymToKeycode(obt_display, sym);
      }
      if (!*keycode) {
-         g_message(_("Requested key '%s' does not exist on the display"), l);
+         g_message(_("Requested key \"%s\" does not exist on the display"), l);
          goto translation_fail;
      }
  
@@@ -158,3 -158,30 +158,3 @@@ translation_fail
      g_strfreev(parsed);
      return ret;
  }
 -
 -gchar *translate_keycode(guint keycode)
 -{
 -    KeySym sym;
 -    const gchar *ret = NULL;
 -
 -    if ((sym = XKeycodeToKeysym(ob_display, keycode, 0)) != NoSymbol)
 -        ret = XKeysymToString(sym);
 -    return g_locale_to_utf8(ret, -1, NULL, NULL, NULL);
 -}
 -
 -gunichar translate_unichar(guint keycode)
 -{
 -    gunichar unikey = 0;
 -
 -    char *key;
 -    if ((key = translate_keycode(keycode)) != NULL &&
 -        /* don't accept keys that aren't a single letter, like "space" */
 -        key[1] == '\0')
 -    {
 -        unikey = g_utf8_get_char_validated(key, -1);
 -        if (unikey == (gunichar)-1 || unikey == (gunichar)-2 || unikey == 0)
 -            unikey = 0;
 -    }
 -    g_free(key);
 -    return unikey;
 -}
This page took 0.13238 seconds and 4 git commands to generate.