- if ((n = parse_find_node("position", node))) {
- if (parse_contains("TopLeft", doc, n))
- config_dock_pos = DockPos_TopLeft;
- else if (parse_contains("Top", doc, n))
- config_dock_pos = DockPos_Top;
- else if (parse_contains("TopRight", doc, n))
- config_dock_pos = DockPos_TopRight;
- else if (parse_contains("Right", doc, n))
- config_dock_pos = DockPos_Right;
- else if (parse_contains("BottomRight", doc, n))
- config_dock_pos = DockPos_BottomRight;
- else if (parse_contains("Bottom", doc, n))
- config_dock_pos = DockPos_Bottom;
- else if (parse_contains("BottomLeft", doc, n))
- config_dock_pos = DockPos_BottomLeft;
- else if (parse_contains("Left", doc, n))
- config_dock_pos = DockPos_Left;
- else if (parse_contains("Floating", doc, n))
- config_dock_pos = DockPos_Floating;
- }
- if (config_dock_pos == DockPos_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 = parse_find_node("stacking", node))) {
- if (parse_contains("top", doc, n))
- config_dock_layer = Layer_Top;
- else if (parse_contains("normal", doc, n))
- config_dock_layer = Layer_Normal;
- else if (parse_contains("bottom", doc, n))
- config_dock_layer = Layer_Below;
- }
- if ((n = parse_find_node("direction", node))) {
- if (parse_contains("horizontal", doc, n))
- config_dock_horz = TRUE;
- else if (parse_contains("vertical", doc, n))
- config_dock_horz = FALSE;
- }
- if ((n = parse_find_node("autoHide", node)))
- config_dock_hide = parse_bool(doc, n);
- if ((n = parse_find_node("hideTimeout", node)))
- config_dock_hide_timeout = parse_int(doc, n);
-}
-
-void config_startup()
+ node = node->children;
+
+ 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 (obt_parse_node_contains(n, "Top"))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_NORTH;
+ else if (obt_parse_node_contains(n, "TopRight"))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_NORTHEAST;
+ else if (obt_parse_node_contains(n, "Right"))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_EAST;
+ else if (obt_parse_node_contains(n, "BottomRight"))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_SOUTHEAST;
+ else if (obt_parse_node_contains(n, "Bottom"))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_SOUTH;
+ else if (obt_parse_node_contains(n, "BottomLeft"))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_SOUTHWEST;
+ else if (obt_parse_node_contains(n, "Left"))
+ config_dock_floating = FALSE,
+ config_dock_pos = OB_DIRECTION_WEST;
+ else if (obt_parse_node_contains(n, "Floating"))
+ config_dock_floating = TRUE;
+ }
+ if (config_dock_floating) {
+ 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 = obt_parse_find_node(node, "noStrut")))
+ config_dock_nostrut = obt_parse_node_bool(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 (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 = obt_parse_find_node(node, "direction"))) {
+ if (obt_parse_node_contains(n, "horizontal"))
+ config_dock_orient = OB_ORIENTATION_HORZ;
+ else if (obt_parse_node_contains(n, "vertical"))
+ config_dock_orient = OB_ORIENTATION_VERT;
+ }
+ 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_free(str);
+ }
+}
+
+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 = obt_parse_node_string(node);
+ config_menu_files = g_slist_append(config_menu_files,
+ obt_paths_expand_tilde(c));
+ g_free(c);
+ }
+ 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);
+ }
+}
+
+static void parse_resistance(xmlNodePtr node, gpointer d)
+{
+ xmlNodePtr n;
+
+ node = node->children;
+ 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
+{
+ const gchar *key;
+ const gchar *actname;
+} ObDefKeyBind;
+
+static void bind_default_keyboard(void)
+{
+ ObDefKeyBind *it;
+ ObDefKeyBind binds[] = {
+ { "A-Tab", "NextWindow" },
+ { "S-A-Tab", "PreviousWindow" },
+ { "A-F4", "Close" },
+ { NULL, NULL }
+ };
+ for (it = binds; it->key; ++it) {
+ GList *l = g_list_append(NULL, g_strdup(it->key));
+ keyboard_bind(l, actions_parse_string(it->actname));
+ }
+}
+
+typedef struct
+{
+ const gchar *button;
+ const gchar *context;
+ const ObMouseAction mact;
+ const gchar *actname;
+} ObDefMouseBind;
+
+static void bind_default_mouse(void)
+{
+ ObDefMouseBind *it;
+ ObDefMouseBind binds[] = {
+ { "Left", "Client", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Middle", "Client", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Right", "Client", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "Desktop", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Middle", "Desktop", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Right", "Desktop", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "Titlebar", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "Bottom", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "BLCorner", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "BRCorner", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "TLCorner", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "TRCorner", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "Close", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "Maximize", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "Iconify", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "Icon", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "AllDesktops", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "Shade", OB_MOUSE_ACTION_PRESS, "Focus" },
+ { "Left", "Client", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "Titlebar", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Middle", "Titlebar", OB_MOUSE_ACTION_CLICK, "Lower" },
+ { "Left", "BLCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "BRCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "TLCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "TRCorner", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "Close", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "Maximize", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "Iconify", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "Icon", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "Shade", OB_MOUSE_ACTION_CLICK, "Raise" },
+ { "Left", "Close", OB_MOUSE_ACTION_CLICK, "Close" },
+ { "Left", "Maximize", OB_MOUSE_ACTION_CLICK, "ToggleMaximize" },
+ { "Left", "Iconify", OB_MOUSE_ACTION_CLICK, "Iconify" },
+ { "Left", "AllDesktops", OB_MOUSE_ACTION_CLICK, "ToggleOmnipresent" },
+ { "Left", "Shade", OB_MOUSE_ACTION_CLICK, "ToggleShade" },
+ { "Left", "TLCorner", OB_MOUSE_ACTION_MOTION, "Resize" },
+ { "Left", "TRCorner", OB_MOUSE_ACTION_MOTION, "Resize" },
+ { "Left", "BLCorner", OB_MOUSE_ACTION_MOTION, "Resize" },
+ { "Left", "BRCorner", OB_MOUSE_ACTION_MOTION, "Resize" },
+ { "Left", "Top", OB_MOUSE_ACTION_MOTION, "Resize" },
+ { "Left", "Bottom", OB_MOUSE_ACTION_MOTION, "Resize" },
+ { "Left", "Left", OB_MOUSE_ACTION_MOTION, "Resize" },
+ { "Left", "Right", OB_MOUSE_ACTION_MOTION, "Resize" },
+ { "Left", "Titlebar", OB_MOUSE_ACTION_MOTION, "Move" },
+ { "A-Left", "Frame", OB_MOUSE_ACTION_MOTION, "Move" },
+ { "A-Middle", "Frame", OB_MOUSE_ACTION_MOTION, "Resize" },
+ { NULL, NULL, 0, NULL }
+ };
+
+ for (it = binds; it->button; ++it)
+ mouse_bind(it->button, it->context, it->mact,
+ actions_parse_string(it->actname));
+}
+
+void config_startup(ObtParseInst *i)