gboolean config_unfocus_leave;
ObPlacePolicy config_place_policy;
+gboolean config_place_center;
ObPlaceMonitor config_place_monitor;
guint config_primary_monitor_index;
guint config_dock_app_move_button;
guint config_dock_app_move_modifiers;
-guint config_keyboard_reset_keycode;
-guint config_keyboard_reset_state;
+guint config_keyboard_reset_keycode;
+guint config_keyboard_reset_state;
+gboolean config_keyboard_rebind_on_mapping_notify;
gint config_mouse_threshold;
gint config_mouse_dclicktime;
/* monitor is copied above */
}
- if (src->size_given) {
- dst->size_given = TRUE;
- dst->width_num = src->width_num;
- dst->width_denom = src->width_denom;
- dst->height_num = src->height_num;
- dst->height_denom = src->height_denom;
- }
+ dst->width_num = src->width_num;
+ dst->width_denom = src->width_denom;
+ dst->height_num = src->height_num;
+ dst->height_denom = src->height_denom;
}
void config_parse_relative_number(gchar *s, gint *num, gint *denom)
{
xmlNodePtr n, c;
gboolean x_pos_given = FALSE;
- gboolean width_given = FALSE;
if ((n = obt_xml_find_node(app->children, "decor")))
if (!obt_xml_node_contains(n, "default"))
config_parse_relative_number(s,
&settings->width_num,
&settings->width_denom);
- if (settings->width_num > 0 && settings->width_denom >= 0)
- width_given = TRUE;
+ if (settings->width_num <= 0 || settings->width_denom < 0)
+ settings->width_num = settings->width_denom = 0;
g_free(s);
}
}
- if (width_given && (c = obt_xml_find_node(n->children, "height"))) {
- gchar *s = obt_xml_node_string(c);
- config_parse_relative_number(s,
- &settings->height_num,
- &settings->height_denom);
- if (settings->height_num > 0 && settings->height_denom >= 0)
- settings->size_given = TRUE;
- g_free(s);
+ if ((c = obt_xml_find_node(n->children, "height"))) {
+ if (!obt_xml_node_contains(c, "default")) {
+ gchar *s = obt_xml_node_string(c);
+ config_parse_relative_number(s,
+ &settings->height_num,
+ &settings->height_denom);
+ if (settings->height_num <= 0 || settings->height_denom < 0)
+ settings->height_num = settings->height_denom = 0;
+ g_free(s);
+ }
}
}
parse_key(n, NULL);
n = obt_xml_find_node(n->next, "keybind");
}
+
+ if ((n = obt_xml_find_node(node->children, "rebindOnMappingNotify")))
+ config_keyboard_rebind_on_mapping_notify = obt_xml_node_bool(n);
}
/*
nbut = obt_xml_find_node(n->children, "mousebind");
while (nbut) {
+ gchar **button, **buttons;
+
if (!obt_xml_attr_string(nbut, "button", &buttonstr))
goto next_nbut;
if (obt_xml_attr_contains(nbut, "action", "press"))
else
goto next_nbut;
+ buttons = g_strsplit(buttonstr, " ", 0);
nact = obt_xml_find_node(nbut->children, "action");
while (nact) {
ObActionsAct *action;
- if ((action = actions_parse(nact)))
- mouse_bind(buttonstr, cx, mact, action);
+ /* actions_parse() creates one ref to the action, but we need
+ * exactly one ref per binding we use it for. */
+ if ((action = actions_parse(nact))) {
+ for (button = buttons; *button; ++button) {
+ actions_act_ref(action);
+ mouse_bind(*button, cx, mact, action);
+ }
+ actions_act_unref(action);
+ }
nact = obt_xml_find_node(nact->next, "action");
}
- g_free(buttonstr);
+ g_strfreev(buttons);
+ g_free(buttonstr);
next_nbut:
- nbut = obt_xml_find_node(nbut->next, "mousebind");
+ nbut = obt_xml_find_node(nbut->next, "mousebind");
}
}
g_free(modcxstr);
node = node->children;
- if ((n = obt_xml_find_node(node, "policy")))
+ if ((n = obt_xml_find_node(node, "policy"))) {
if (obt_xml_node_contains(n, "UnderMouse"))
config_place_policy = OB_PLACE_POLICY_MOUSE;
+ }
+ if ((n = obt_xml_find_node(node, "center"))) {
+ config_place_center = obt_xml_node_bool(n);
+ }
if ((n = obt_xml_find_node(node, "monitor"))) {
if (obt_xml_node_contains(n, "active"))
config_place_monitor = OB_PLACE_MONITOR_ACTIVE;
obt_xml_register(i, "focus", parse_focus, NULL);
config_place_policy = OB_PLACE_POLICY_SMART;
+ config_place_center = TRUE;
config_place_monitor = OB_PLACE_MONITOR_PRIMARY;
config_primary_monitor_index = 1;
translate_key("C-g", &config_keyboard_reset_state,
&config_keyboard_reset_keycode);
+ config_keyboard_rebind_on_mapping_notify = TRUE;
bind_default_keyboard();